Magento – Tax variable in Magento invoice PDF

magento-1.8taxtax-class

On Magento 1.8

I need the variables for the following list, so that I can modify the invoice:

| 1)No.  | Product     | 2)Total excl VAT | 3) VAT 6%
|:-------|------------:|:----------------:| :-------:
| 1      | Product A   |      $200        |    $12
| 2      | Product B   |      $300        |    $18
| 3      | Product C   |      $100        |     $6
  1. Items numbering
  2. Total exclude Tax on ROW item
  3. Total Tax on ROW item
  4. Is it possible to retrieve the type of tax code applied on product?

eg, Tax VAT 6% on Product A. So the name of product A will be "T6 – Product A"

I have tried looking in table sales_flat_invoice_item but did not find anything related.

Updated Findings:

There aren't any default variable in Magento for the items 1-4 above therefore new variable needs to be added. To add a new variable, go to the following file:

app/code/community/MDN/GlobalPDF/Model/Pdf/Order/invoice.php

and add the new variable in this function:

protected function setTemplateData($invoice) {

for example:

$data['store_id'] = $rma->getSalesOrder()->getstore_id();

and add a value with the variable $data.

Lastly open the XML file with the same name of the php file previously and add the new variable into your text, multitext, etc.

For this case, ROW total without tax should be row_total_incl_tax - row_total.
I have used this as example $data['store_id'] = $rma->getSalesOrder()->getstore_id(); but it produces error as below.

Fatal error: Call to a member function getstore_id() on a non-object in /var/www/app/code/community/MDN/GlobalPDF/Model/Pdf/Order/Invoice.php on line 43

Best Answer

Try getStoreId() instead of getstore_id()

Magento's __call function will translate this to getData('store_id')

Related Topic