last day (26 days later) » 

1:17 PM
Hi bro
I have doubt in xml file
I want to call page based on coupon code
In app\design\frontend\base\default\layout\checkout.xml
Example like this
<reference name="root">
<?php
$coupon = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
if(($coupon == "SE50") || ($coupon == "SE00")) {
?>
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
<?php } else { ?>
<action method="setTemplate"><template>page/checkout-onepage.phtml</template></action>
<?php } ?>
</reference>
 
Noooooo
 
If coupon "SE50" or "SE00" call page/2columns-right.phtml
else
page/checkout-onepage.phtml
Is any other way ?
 
it does not exist
Where have you find this : page/checkout-onepage.phtml ?
you created it ?
 
1:37 PM
I just create the PHTML file inside app\design\frontend\themename\default\template\page folder
its called checkout-onepage.phtml
 
ok
explain me what you want to do
 
This is my scenario i have 2 buttons in view page
1. add cart
2. insta buy
 
I guess you want change a template in some condtion right ?
 
if user choose insta buy
Yeah u r right!
If user choose insta buy redirect to checkout-onepage.phtml layout page
 
when user click on insta buy, you want to redirect to this page or you you want to change this layout ?
 
1:50 PM
Yeah
you will under stand
@Prince i want to change layout
See this
if user select Add cart this layout will show
If user select Insta buy this layout will show(checkout-onepage.phtml)
 
2:22 PM
Try this before redirect : $this->getLayout()->getBlock('root')->setTemplate('page/checkout-onepage.phtml')‌​;
Or you need an observer to do it clean, it's not possible to do this in xml
 
var data = jQuery('#product_addtocart_form').serialize();
data += '&isAjax=1';
jQuery('#preloader .loader').fadeIn(300);
try {
jQuery.ajax({
url: url,
dataType: 'json',
type: 'post',
data: data,
success: function (data) {
showMessage(data);
if(data.status != 'ERROR'){
ajax_add_to_cart_post_update(data);
/*code added*/
window.location.href = checkout;
/*code added*/
}
}
});
} catch (e) {
}
this is my redirect function
Insta buy click window.location.href = checkout; will redirect to checkout/onepage
Is any way to redirect link with layout
?
 
No, the best way is to create an observer, refer you to this exemple but you need some updates : magento.stackexchange.com/questions/64988/…
 
sure bro thanks
 
you're welcome
 

  last day (26 days later) »