emmim44 Posted May 21, 2010 Share Posted May 21, 2010 hi all, i am implementing below code in product-list.tpl however it doesnt work .... am i doing something wrong? <?php if (isset($_COOKIE["vip"]) && ($_COOKIE["vip"] =='xyz') ) { $sty = "style='display: inline;'"; $vipTrue=1; } else { $sty = "style='display: none;'"; $vipTrue=0; } ?> {convertPrice price=$product.price_tax_exc} Link to comment Share on other sites More sharing options...
Burhan BVK Posted May 21, 2010 Share Posted May 21, 2010 It is more complicated than that to use php within a smarty template, you should not do that anyway. Google for smarty if tags instead. Link to comment Share on other sites More sharing options...
emmim44 Posted May 21, 2010 Author Share Posted May 21, 2010 i already googled and there is something i cannot see the error... any one else. Link to comment Share on other sites More sharing options...
rocky Posted May 22, 2010 Share Posted May 22, 2010 What is it that you are trying to do? It looks like you are trying to display a price only if a customer is in the VIP customer group. If that is what you are trying to do, I think you are approaching it the wrong way. See my post here for my suggested solution. Link to comment Share on other sites More sharing options...
emmim44 Posted May 22, 2010 Author Share Posted May 22, 2010 i think my case is different. I am not allowed to show prices and add to chart to any one on the web unless they request that static code to be mailed them...(like lifemana.com)...Yes i am using cookie to ensure that... the only thing left is that if statement in few pages. I need to someone to point/correct where my statement is wrong... even below doesnt work. Anyone? {if (isset($_COOKIE["vip"]) && ($_COOKIE["vip"] =='xyz') )} $sty = "style='display: inline;'"; $vipTrue=1; { else} $sty = "style='display: none;'"; $vipTrue=0; {/if} {convertPrice price=$product.price_tax_exc} Link to comment Share on other sites More sharing options...
rocky Posted May 22, 2010 Share Posted May 22, 2010 Are you using PrestaShop's cookie or a separate cookie? If you are using PrestaShop's cookie, you can use code like the following: {if $cookie->vip == 'xyz'} {assign var='vip' value=1} {else} {assign var='vip' value=0} {/if} {if $vip}{convertPrice price=$product.price_tax_exc}{/if} You can change the first line if you aren't using PrestaShop's cookie. I also changed it so that the code is removed instead of just hidden, otherwise the non-VIP customers can just view the source code to see the prices. Link to comment Share on other sites More sharing options...
emmim44 Posted May 22, 2010 Author Share Posted May 22, 2010 No i am using a cookie different than presta...somethink like....then how would i change? Thank you man <?phpif (!(isset($_COOKIE["vip"])) )setcookie("vip", "xyz", time()+3600); //one hour?> Link to comment Share on other sites More sharing options...
rocky Posted May 22, 2010 Share Posted May 22, 2010 Try the following: {if $smarty.cookies.vip == 'xyz'} {assign var='vip' value=1} {else} {assign var='vip' value=0} {/if} {if $vip}{convertPrice price=$product.price_tax_exc}{/if} Or even simpler: {if $smarty.cookies.vip == 'xyz'}{convertPrice price=$product.price_tax_exc}{/if} Link to comment Share on other sites More sharing options...
emmim44 Posted May 23, 2010 Author Share Posted May 23, 2010 it works rocky. Thank you very much. Link to comment Share on other sites More sharing options...
rocky Posted May 24, 2010 Share Posted May 24, 2010 If your issue is resolved, please edit your first post and add [sOLVED] to the front of the title. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now