Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using one step checkout and shipping_method.phtml resposible for showing the shipping now i have 2 more modules which both have shipping_method.phtml 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" />
share|improve this question
up vote 4 down vote accepted

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 {
share|improve this answer
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 – Pradeep Sanku Apr 30 '14 at 11:16
@pradeepsanku. Oups. Sorry about that. I forgot an ->getUpdate() in the code. I've updated the code, try it now. – Marius Apr 30 '14 at 11:26
thanks it had worked for me.thanks a lot. – Pradeep Sanku Apr 30 '14 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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