Note that there are some explanatory texts on larger screens.

plurals
  1. POQuestions About Creating An Order Total In Magento
    primarykey
    data
    text
    <p>I am attempting to create an order total module to do some custom price adjustments. Just to get started with this I am just trying to get it to add $20 to every single order (eventually putting in the real logic).</p> <p>I am having issues with the module that I created. The first issue is that it appears to be running twice (so it is taking $40 off instead of only $20 -- Logging showed me that both the collect and fetch methods are being run twice)</p> <p>The second issue is that the discount line item is appearing below the Grand Total line.</p> <p>Can someone tell me what I am doing wrong here? The contents of my config.xml and order total class are below.</p> <p>config.xml Content</p> <pre><code>&lt;global&gt; &lt;sales&gt; &lt;quote&gt; &lt;totals&gt; &lt;mud&gt; &lt;class&gt;Wpe_Multiunitdiscount_Model_Multiunitdiscount&lt;/class&gt; &lt;before&gt;grand_total&lt;/before&gt; &lt;/mud&gt; &lt;/totals&gt; &lt;/quote&gt; &lt;/sales&gt; &lt;/global&gt; </code></pre> <p>Wpe_Multiunitdiscount_Model_Multiunitdiscount Content</p> <pre><code>class Wpe_Multiunitdiscount_Model_Multiunitdiscount extends Mage_Sales_Model_Quote_Address_Total_Abstract { public function collect(Mage_Sales_Model_Quote_Address $address) { $address-&gt;setGrandTotal($address-&gt;getGrandTotal() + 20 ); $address-&gt;setBaseGrandTotal($address-&gt;getBaseGrandTotal() + 20); return $this; } public function fetch(Mage_Sales_Model_Quote_Address $address) { $address-&gt;addTotal(array( 'code' =&gt; $this-&gt;getCode(), 'title' =&gt; Mage::helper('sales')-&gt;__('Super Tax'), 'value' =&gt; 20, )); return $this; } } </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.
 

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