Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As a followup to the accepted answer, I'd like to point out that people (like me from the past) who are having trouble getting their custom totals reflected on invoices will need to add a few more things.</p> <p>First, your column needs to be added to the <code>sales/invoice</code> table, as well.</p> <p>Second, Mage_Sales uses Convert objects to propagate data from quotes to orders to invoices. To get <code>your_custom_total</code> included in this flow, add a couple config hooks:</p> <pre><code>&lt;global&gt; &lt;fieldsets&gt; &lt;sales_convert_quote&gt; &lt;your_custom_total&gt;&lt;to_order&gt;*&lt;/to_order&gt;&lt;/your_custom_total&gt; &lt;/sales_convert_quote&gt; &lt;sales_convert_order&gt; &lt;your_custom_total&gt;&lt;to_invoice&gt;*&lt;/to_invoice&gt;&lt;/your_custom_total&gt; &lt;/sales_convert_order&gt; &lt;/fieldsets&gt; &lt;/global&gt; </code></pre> <p>Now your total will be included when a quote is converted to an order, and that order to an invoice.</p> <p>However, even though your total is saved on the invoice, the invoice does not know how that total affects its grand total. Thus, an invoice total model similar to the quote address total model needs to be added.</p> <p>The config hook:</p> <pre><code>&lt;global&gt; &lt;sales&gt; &lt;order_invoice&gt; &lt;totals&gt; &lt;namespace_custom&gt; &lt;class&gt;namespace/sales_order_invoice_total_custom&lt;/class&gt; &lt;after&gt;subtotal&lt;/after&gt; &lt;/namespace_custom&gt; &lt;/totals&gt; &lt;/order_invoice&gt; &lt;/sales&gt; &lt;/global&gt; </code></pre> <p>And the class:</p> <pre><code>class Package_Module_Model_Sales_Order_Invoice_Total_Custom extends Mage_Sales_Model_Order_Invoice_Total_Abstract { public function collect(Mage_Sales_Model_Order_Invoice $invoice) { $invoice-&gt;setBaseGrandTotal($invoice-&gt;getBaseGrandTotal() + $invoice-&gt;getYourCustomTotal()) -&gt;setGrandTotal($invoice-&gt;getGrandTotal() + $invoice-&gt;getYourCustomTotal()); return $this; } } </code></pre> <p>You can mirror the above for converting invoices to credit memos as well, if your total is applicable.</p> <p>This link <a href="http://magento.ikantam.com/qa/how-add-discount-total-magento" rel="nofollow">http://magento.ikantam.com/qa/how-add-discount-total-magento</a> explains how to rewrite adminhtml blocks to show your total on the backend.</p>
    singulars
    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.
    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