I needed to create a custom invoice that was easily printable for a Magento store. The built in PDF generation system (at least in earlier versions of Magento) was not very flexible and did not meet my requirements.
The solution looks great – see example below and contains some nice touches including the option to create a watermark graphic on the invoice and a comments box.
I have also developed a standalone invoice management solution that can run externally to magento. Click here for more.
Tested with Magento CE 1.3 -> 1.9.x
- Add an Email button to email the HTML invoice directly to the customer.
modman clone https://github.com/gaiterjones/magento-htmlinvoice
Download and extract the source files and copy to your Magento root folder.
Refresh your Magento system cache, log out and back into admin to enable the module and confguration area.
The extension is configurable under system > configuration > my extensions > html invoice. The configuration consists of some options to help customise the html invoice.
Enter the URL to an image to use as a logo to appear on the invoice. Default if blank is no logo.
Enter the URL to a watermark image if you want to use one. Default if left blank is no watermark image.
Enter the text (or html) you want to appear at in the header of the invoice, your company name and address for example. Default is no header
SHOW COMMENTS BOX
Select Yes to enable the comments box on the invoice, this lets you type a short comment that will appear on the printed invoice.
Enter the text (or html) you want to appear on the bottom of the invoice. Default is no footer text.
ADD VAT / TAX TO PRICING
Set this to YES and then specify your VAT rate as an integer i.e. 19 for 19% VAT, this will add VAT to the invoice pricing at the rate you specify.
Save any options you have changed and goto an order in Sales > Orders. Select an order to view and you should see a new PRINT button on the top right hand side of the order view screen.
Clicking the print button will open the HTML invoice for this order in a new browser tab. An invoice example is below.
To customise the invoice further just take a look at the code in
This contains all the formatting for the invoice and is fairly easy to modify for your exact requirements.
To extract individual product information to display on the invoice insert the following within the foreach loop
$_product = Mage::getModel('catalog/product')->load($_item->getProductId());
Now you can echo out product information e.g. custom attributes
Acknowledgments again to the original developer for parts of the code used in this solution.