Popular Posts

Monday, 31 March 2014

How to add php code in .tpl type of file in cs-cart

Can anyone tell me how to add php code in .tpl file e.g i want to add the following code but it didn't work



{php}
    if(isset($_GET['redirect']) && $_GET['redirect']=='clipboard'){

    echo '<input type="hidden" name="check" value="redirect" />' ;

 } 
 else{

     echo '<input type="hidden" name="check" value="notredirect" />' ;
 }

{/php}

I think that what you want is this:
 input type="hidden" name="check" value="{if $smarty.get.redirect != "clipboard"}not{/if}redirect" />


You must set:
'allow_php_in_templates' => true, // Allow to use {php} tags in templates
in your config.local.php, and then it will work.
Enjoy .................... :)

No comments:

Post a Comment

Magento: How to get last order id

There are many ways to get last order id:   1. From checkout session: $lastOrderId = Mage::getSingleton('checkout/session'...