1

I've made a custom shipping calculation, but now I need to remove the Shipping Amount on the pdf invoice. I'm using the Symmetrics Invoice Pdf, and I've tried to copy

app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php to app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php

and changed

 $totalShippingChargesText = "(" . Mage::helper('sales')->__('Total Shipping Charges') . " " . $order->formatPriceTxt($order->getShippingAmount()) . ")"; 

to

 $totalShippingChargesText = " "; 

but it still shows the shipping costs on the invoice pdf. I don't have a getShippingAmount in my invoice.php (app/code/local/Symmetrics/Invoicepdf/Model/Pdf/Invoice.php).

The module can be find here: https://github.com/symmetrics/mrg_invoicepdf

So where do I have to look?

2
  • Have you tried the solution below? Did it help? Commented Oct 7, 2014 at 9:45
  • Unfortunately the solution below doesn't remove the Shipping costs. I'm now trying Firegento Pdf as suggested. I will keep you updated on my progress. Suggestions for either Symmetrics or Firegento are welcome. Commented Oct 7, 2014 at 15:23

1 Answer 1

1

You could rewrite Symmetrics_InvoicePdf_Model_Pdf_Items_Totals and overwrite the function _getTotalsList() as follows:

protected function _getTotalsList() { $totals = Mage::getConfig()->getNode('global/invoicepdf/totals')->asArray(); usort($totals, array($this, '_sortTotalsList')); $totalModels = array(); foreach ($totals as $totalInfo) { // ignore the shipping amount if (!empty($totalInfo['model']) && $totalInfo['source_field'] != 'shipping_amount') { $totalModel = Mage::getModel($totalInfo['model']); if ($totalModel instanceof Mage_Sales_Model_Order_Pdf_Total_Default) { $totalInfo['model'] = $totalModel; } else { Mage::throwException( Mage::helper('sales')->__( 'Pdf total model should extend Mage_Sales_Model_Order_Pdf_Total_Default' ) ); } } else { $totalModel = Mage::getModel($this->_defaultTotalModel); } $totalModel->setData($totalInfo); $totalModels[] = $totalModel; } return $totalModels; } 

Another option: It should even be enough to build an extension which depends on Symmetrics_InvoicePdf with the following config.xml:

<?xml version="1.0" encoding="UTF-8"?> <config> <global> <invoicepdf> <totals> <shipping> <model/> </shipping> </totals> </invoicepdf> </global> </config> 

By the way you could also have a look at the more flexible, more customisable and better supported extension Firegento_Pdf.

1
  • It works! But I edited the app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php and used the above code. Commented Oct 9, 2014 at 13:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.