0

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 ?

2 Answers 2

1

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')
0

You can use the standard controller action events: 'controller_action_predispatch_' . $this->getFullActionName()

In the case of the saveBilling action the event is controller_action_predispatch_checkout_onepage_saveBilling

and for saveShipping is controller_action_predispatch_checkout_onepage_saveShiping.

You can access the values sent to that action by

Mage::app()->getRequest()->getPost();

I hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.