I have added a new shipping method module for my magento store. This module allows the user to set shipping rates based on shipping address country.
I have added an observer on customer shipping address save after, the code is below.
In config.xml
I added new event.
<events>
<checkout_controller_onepage_save_shipping_address_after>
<observers>
<zones>
<type>model</type>
<class>zones/observer</class>
<method>getShippingMethods</method>
</zones>
</observers>
</checkout_controller_onepage_save_shipping_address_after>
</events>
After that I have dispatched the event in OnepageController > SaveShipping
method like,
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_address_after', array('page' => $model, 'request' => $this->getRequest()));
This calls the observer when I save my shipping address. But I have no idea how to change the shipping method charge as per the shipping address country.
I have used this thread http://www.opencart60s.com/magento/changing-or-set-shipping-price-on-fly-from-event-or-observer-in-magento.html-13407.html to change the shipping cost. But without success.
I need to change my shipping flat rate as per the country.
I have already created the module which will store the country and shipping rate details. I can get the shipping rate using that module. Now, I just have to update the flat rate value with the custom shipping rate value.
Please help me setting my flat rate as per the country code. Thanks..