I am using one step checkout and shipping_method.phtml responsible for showing the shipping methods.so now i have 2 more modules which both have shipping_method.phtml each.so i need to show either shipping_method.phtml from Module A or Module B depending on the shipping country.

so i wanted to update handle called in that i will be updating the handle with module A or B depending on the condition statfication which just updates the setTemplate file either from A or B.

Please Help me how to achive this.

    <reference name="choose-shipping-method">
        <action method="setTemplate">

    <reference name="choose-shipping-method">
        <action method="setTemplate">

// either a_onestepcheckout or b_onestepcheckout depending on condition
    <update handle="a_onestepcheckout" /> or <update handle="b_onestepcheckout" />

1 Answer 1


I don't think you can load a conditional layout handle from the xml.
You will have to do this in an observer.

Use the event controller_action_layout_load_before.
Something like this:

public function addSomeHandle($observer) {
    $action = $observer->getEvent()->getAction();
    $actionName = $action->getFullActionName();
    if ($actionName == 'onestepcheckout_index_index') { //if on your desired page
         $layout = $observer->getEvent()->getLayout();
         if (CONDITION GOES HERE) {
         else {
  • thanks for answer.i tried this but i am getting error Fatal error: Call to undefined method Mage_Core_Model_Layout::addHandle() in Observer.php Commented Apr 30, 2014 at 11:16
  • @pradeepsanku. Oups. Sorry about that. I forgot an ->getUpdate() in the code. I've updated the code, try it now.
    – Marius
    Commented Apr 30, 2014 at 11:26

Your Answer

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

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