Magento – Grand total update on billing information save in onepage checkout —Magento

grand-totalmagento-1.9

I have created a custom module to update grand total but I need to update grand total only after filling address information on one page checkout because I have to check particular postal/zip code that user added and based on that have to update grand total.Here is my config file code

   <checkout_onepage_savePayment>
        <observers>
        <magepal_mycheckout_order_observer>
        <type>singleton</type>
        <class>MagePal_MyCheckout_Model_Observer</class>
        <method>sendemail</method>
        </magepal_mycheckout_order_observer>
        </observers>
    </checkout_onepage_savePayment>

Observer.php code

$quote = $observer->getEvent()->getQuote();
    $grandTotal = $quote->getGrandTotal();
    $baseGrandTotal = $quote->getBaseGrandTotal();
    $partialPrice = $grandTotal + 10;
    $basePartialPrice = $baseGrandTotal + 10;
    $quote->setGrandTotal($partialPrice);
    $quote->setBaseGrandTotal($basePartialPrice);
    $quote->save();

I have tried several other events but when I reach to review order step,no change to grand total.

Can anybody please point me out where I did wrong ?

Best Answer

Any event of save of checkout_onepage_savePayment does not exit in magento.

There is an events is fire on every controller dispatch.If i guess that billing has been save it checkout/onepage/saveBilling then it dispatch event for this route is

controller_action_predispatch_checkout_onepage_saveBilling 

you get data from using :

$this->getRequest()->getPost('billing', array());

checkout object from

Mage::getSingleton('checkout/type_onepage')
Related Topic