title: Magento, getSubtotal and getGrandTotal always return zero
body: <p>I have a weird problem. I have developed a module which adds a line to totals according to some value in database. But in my module model (which is inherited from Mage_Sales_Model_Quote_Address_Total_Abstract) when I call</p>
  
  <pre><code>$address-&gt;getSubtotal()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$address-&gt;getGrandTotal()
  </code></pre>
  
  <p>or any other totals method, I get zero (0) returned. But in phpmyadmin, I see that those values are not zero. Any other column except these totals columns returns their correct value (i.e, getAddressId() return the ID, getAddressType returns "shipping" etc.)</p>
  
  <p>What may be the problem, any idea?
  Thanks
  ---------- EDIT -----------
  OK, After @Alan Storm's comment, I see that I should be more clear.
  I'm trying to develop an instalment module. I will set instalment fees (changing according to months count) in the admin, and I will add this fee to cart total at the checkout.</p>
  
  <p>This is my collect method,</p>
  
  <pre><code>public function collect(Mage_Sales_Model_Quote_Address $address)
  {
  
  $address-&gt;setInstalmentCount(2); //instalment count is hardcoded as 2 for debugging
  
  $paymentMethod = Mage::app()-&gt;getFrontController()-&gt;getRequest()-&gt;getParam('payment');
  $paymentMethod = Mage::app()-&gt;getStore()-&gt;isAdmin() &amp;&amp; isset($paymentMethod['method']) ? $paymentMethod['method'] : null;
  if ($paymentMethod != 'oos' &amp;&amp; (!count($address-&gt;getQuote()-&gt;getPaymentsCollection()) || !$address-&gt;getQuote()-&gt;getPayment()-&gt;hasMethodInstance())){            
      return $this;
  }
  
  $paymentMethod = $address-&gt;getQuote()-&gt;getPayment()-&gt;getMethodInstance();
  
  if ($paymentMethod-&gt;getCode() != 'oos') {            
      return $this;
  }
  
  $items = $address-&gt;getAllItems();
  if (!count($items)) {
      return $this;
  }
  
  $baseTotal = $address-&gt;getBaseGrandTotal();   // THIS ALWAYS RETURNS ZERO
  
  // adress is the reference for grand total
  $quote = $address-&gt;getQuote();
  $store = $quote-&gt;getStore();
  
  $fee_perc = $oosconfig['inst' . round($address-&gt;getInstalmentCount())]; // get the setting from admin
  $ins_fee = $store-&gt;convertPrice($baseTotal*$fee_perc/100.0, false); // calculate the fee    
  
  $baseTotal += $ins_fee; // add to totals
  
  $address-&gt;setInstalmentFee($ins_fee);
  
  // update totals
  $address-&gt;setBaseGrandTotal($baseTotal);
  $address-&gt;setGrandTotal($store-&gt;convertPrice($baseTotal, false));    
  
  return $this;   
  
  }
  </code></pre>
  
  <p>------ EDIT2 ------</p>
  
  <p>OK guys, I have figured it out! The problem was with my config.xml
  I should have added</p>
  
  <pre><code>&lt;after&gt;grand_total&lt;/after&gt;
  </code></pre>
  
  <p>Since it is absent, it was first collecting my module's total while subtotal and grand_total were not calculated yet. Because of this, they were coming as zeros.</p>
  
  <p>Thank you though!</p>