Jump to content

code help!!! - Resolved


emmim44

Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...