1

I have a list of taxes in Magento 1.9 and I need to display all this available taxes in the admin Order Grid. I found all this taxes in database in the sales_order_tax. Is there any way to display all this taxes?

My database table is look like this:

enter image description here

So the idea is: each tax must have their own column in the order grid

columns:

  • HST-ON;
  • HST-NS;
  • GST;
  • PST-BC;

I try something like this but is not work:

$collection->getSelect()->joinLeft(
    array('sf' => $resource->getTableName('sales_order_tax')),
    'sf.entity_id=main_table.order_id',
    array(
        'sf.code'

    )
);
2

Copy the file from path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php to app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php

Please use the below join,

$collection->getSelect()->joinLeft(array('sf' => 'sales_order_tax'),'sf.order_id=main_table.entity_id',array('sf.amount'));

Add the tax column under _prepareColumns(),

 $this->addColumn('tax_amount', array(
            'header' => Mage::helper('sales')->__('Tax Amount'),
            'index' => 'amount',
            'type'  => 'currency',
            'currency' => 'order_currency_code',
        ));

Hope this will help you.

Thank you!

  • thank you so much and how I can put the column for rate code for example? – Robert Oct 12 '17 at 11:08
  • I use your code and I am to display only the amount, my question is how I can separate taxes? – Robert Oct 12 '17 at 11:20
  • Do you want to display each order tax amount in sales grid? – Ranipriyanka Oct 12 '17 at 11:24
  • yes this is the idea – Robert Oct 12 '17 at 11:28
  • I need to display for example this column HST-ON and will contain amount only for HST-ON tax, the same for the next column HST-NS and so on – Robert Oct 12 '17 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.