Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In short all you need to do is add some XML:</p> <pre><code>&lt;global&gt; &lt;pdf&gt; &lt;totals&gt; &lt;mygrand_total translate="title"&gt; &lt;title&gt;Grand Total To Be Charged&lt;/title&gt; &lt;source_field&gt;base_grand_total&lt;/source_field&gt; &lt;font_size&gt;8&lt;/font_size&gt; &lt;display_zero&gt;1&lt;/display_zero&gt; &lt;sort_order&gt;705&lt;/sort_order&gt; &lt;/mygrand_total&gt; &lt;/totals&gt; &lt;/pdf&gt; &lt;/global&gt; </code></pre> <p>I would create a separate module under <code>app/code/local/Yourcompanyname/PDFBasetotal</code> and enable the module via <code>etc/modules/</code> after which create a <code>config.xml</code> file under <code>Yourcompanyname/PDFBasetotal/etc/</code> here I would add the above XML as to avoid any touching of core functionality.</p> <p>As to why this works see the method below from the file: <code>app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php</code></p> <p>Note the <code>$totals = Mage::getConfig()-&gt;getNode('global/pdf/totals')-&gt;asArray();</code> as this is what is looped over when creating the total output.</p> <pre><code>protected function _getTotalsList($source) { $totals = Mage::getConfig()-&gt;getNode('global/pdf/totals')-&gt;asArray(); usort($totals, array($this, '_sortTotalsList')); $totalModels = array(); foreach ($totals as $index =&gt; $totalInfo) { if (!empty($totalInfo['model'])) { $totalModel = Mage::getModel($totalInfo['model']); if ($totalModel instanceof Mage_Sales_Model_Order_Pdf_Total_Default) { $totalInfo['model'] = $totalModel; } else { Mage::throwException( Mage::helper('sales')-&gt;__('PDF total model should extend Mage_Sales_Model_Order_Pdf_Total_Default') ); } } else { $totalModel = Mage::getModel($this-&gt;_defaultTotalModel); } $totalModel-&gt;setData($totalInfo); $totalModels[] = $totalModel; } return $totalModels; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload