Important articles:

 

This article is obsolete. check out the updated article:
VirtueMart Invoice, Delivery Note and Receipt

 

VirtueMart 1.1.0 - Invoice, Delivery Note, Receipt

VirtueMart 1.1.0 Sending Invoice, Delivery Note, Receipt via Email

1. Is is possible to change the format of the date from 2008-12-31 to 31.12.2008?

Change the file ps_delivery.php in the directory administrator/components/com_virtuemart/classes

There three queries can be found:

$q = "SELECT *, FROM_UNIXTIME(cdate, '%Y-%m-%d') as order_date";

By simply changing the pattern "%Y-%m-%d" to the desired date format (like "%d.%m.%Y) does it. The characters are standing for day, month and year.

 

2. Is it possible to create more detailed entries for the products, so that the invoice etc. shows not only the product name, but also the options chosen (like color or upgrades...)?

Change the lines in the delivery.pdf.php (just above "// Sumarize").

$pdf->Cell(30,5,'',0,0,'L');
$varPA = ereg_replace ("<br/>", "\n", $db->f("product_attribute") );
$varPA2 = $varPA . "\n";
$pdf->MultiCell(130,5,$pdf->unhtmlentities($varPA2),0,0,'L');
$pdf->Ln(5);

The trick is to change the product_attribute string step by step. First, the HTML-breaks are changed into linebreaks that FPDF can understand. Second, a closing linebreak is added ($varPA . "\n";). Third, to get the linebreaks working, the cell command is extended to the "multicell" command.

 

3. Is it possible to have the name and the title in the e-mail-text that is automatically created (like "Dear Mr. J.P. Newman...")?

The text of e-mail is automatically created from language file. Open the language file (administrator/components/com_virtuemart/languages/common/english.php). Find the string you want to change. E.g. VM_DELIVERY_EMAIL_INVOICE_MESSAGE. Change the 'Dear Customer ...' to 'Dear {customer-name}':

'VM_DELIVERY_EMAIL_INVOICE_MESSAGE' => 'Dear {customer-name}, <br /><br />
Thank you for your order dated {OrderDate}.
 Enclosed you will find PDF invoice.<br />
 The items you ordered will be shipped within a week.<br/>
 We assure you that your order will be performed to your entire satisfaction.<br /></br />
 Yours sincerely<br /><br />{Footer}',

Then paste the following code into administrator/components/com_virtuemart/html/order.order_email.php e.g. in row 143 + (invoice):

$message = str_replace('{customer-name}',
 'Mr. '$dbbt->f('first_name') 
 . $dbbt->f('middle_name') 
 . $dbbt->f('last_name'), $message);

The text will be automatically changed in your e-mail: 'Dear Mr. J.P. Newman ...'

 

4. How to set VAT for a vendor (store)?

If you want that in your documents (invoice, delivery note, receipt) the VAT will be displayed, you can add the information about VAT into the language file (common), e.g.

'VM_DELIVERY_VENDOR_VAT_NR1_LABEL' 	=> 	'VAT1',
'VM_DELIVERY_VENDOR_VAT_NR1_VALUE' 	=>	'1020304050',
'VM_DELIVERY_VENDOR_VAT_NR2_LABEL' 	=> 	'VAT2',
'VM_DELIVERY_VENDOR_VAT_NR2_VALUE' 	=>	'EU1020304050'

If the values will be not empty, the vendor's VAT will be displayed in document.

 

5. How to set VAT fields for customers? How to display the VAT in the document?

First go to Admin - Manage User Fields and publish extra field, e.g:

  • extra_field_1 - change the name PHPSHOP_SHOPPER_FORM_EXTRA_FIELD_1 e.g. to VAT1
  • extra_field_2 - change the name PHPSHOP_SHOPPER_FORM_EXTRA_FIELD_2 e.g. to VAT2

Than add the label name values in language file (common), e.g.:

	'PHPSHOP_SHOPPER_FORM_EXTRA_FIELD_1' => 'VAT1',
	'PHPSHOP_SHOPPER_FORM_EXTRA_FIELD_2' => 'VAT2',

If the values will be not empty, the customer's VAT will be displayed in document.

 

6. How to administrate delivery (invoices, delivery notes, receipts) from frontend?

If You want to be able to administrate orders from the front end of Joomla! You need to put the pdf-files also in directory components/com_virtuemart/pdf. If You don’t You cannot generate invoices/delivery notes/receipts from that side. If You want to delegate invoicing to another user You most likely want this feature. Just remember to keep the files in sync if You customize them. The error message You get is something like:

Fatal error: ps_delivery::require_once() [function.require]: Failed opening required 'components/com_virtuemart/pdf/delivery.pdf.php' (include_path='.:/usr/lib/php5') in components/com_virtuemart/classes/ps_delivery.php on line 347

Added by PeO

 

7. Changing the currency symbol in PDF

Virtuemart includes a method which changes currency symbol for orders. This method is used in VirtueMart Invoice, Delivery Note and Receipt addon. Example: EUR will be changed to €, USD to $, etc. But not all currencies are listed in this method. So if your currency is not translated, you need to add it to this method.

Open:

administrator\components\com_virtuemart\classes\currency\class_currency_display.php

cca. line 123

method: function getFullValue

Add your currency to this method, e.g. Czech currency symbol, change the code

FROM:

switch($this->symbol) {
            case 'USD': $this->symbol='$';break;
            case 'EUR': $this->symbol='€';break;
            case 'GBP': $this->symbol='£';break;
            case 'JPY': $this->symbol='¥';break;
            case 'AUD': $this->symbol='AUD $';break;
            case 'CAD': $this->symbol='CAD $';break;
            case 'HKD': $this->symbol='HKD $';break;
            case 'NZD': $this->symbol='NZD $';break;
            case 'SGD': $this->symbol='SGD $';break;
        }

TO:

switch($this->symbol) {
            case 'USD': $this->symbol='$';break;
            case 'EUR': $this->symbol='€';break;
            case 'GBP': $this->symbol='£';break;
            case 'JPY': $this->symbol='¥';break;
            case 'AUD': $this->symbol='AUD $';break;
            case 'CAD': $this->symbol='CAD $';break;
            case 'HKD': $this->symbol='HKD $';break;
            case 'NZD': $this->symbol='NZD $';break;
            case 'SGD': $this->symbol='SGD $';break;
            // Modified currency symbol
            case 'CZK': $this->symbol='Kč';break;
        }

 Don't forget to save the modified file as UTF-8 without BOM.