I want to change a checkout/onepage
layout based on a condition.
Example:
<?php
$coupon = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
if(($coupon == "SE50") || ($coupon == "SE00")){
}
?>
To showcheckout.xml
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
I mean this page:
if(empty($coupon))
<action method="setTemplate"><template>page/checkout-onepage.phtml</template></action>
A page like:
Note: checkout-onepage.phtml
is a custom page.
Best Answer
You can use a helper function to set the template based on a condition. Follow the below code.
Change the action tag in your
layout.xml
to the below.In your module's helper file
Data.php
add the below code.