Jump to content

Show message only to non logged users - Prestashop 1.6


mayah

Recommended Posts

Hello,

 

I need help with Prestashop 1.6 and will appreciate any answers, thank you!

I need to show prices only to logged in users AND inform them that the need to log in on product page and product lists. 

 

What I've done:

 

1) Disabled price showing for visitors and guests;

2) Put this function in product.tpl and product-list.tpl where I want it to appear: 

 

{if !$logged} <p>Notice: Please <a href="/login">log in</a> to see the prices</p> {/if}

 

Everything works fine, but the problem is that when user is logged in, this message is still showing. I need it to be hidden or simply not displayed when user is logged in. 

 

What did I do wrong? 

 

Thank you so much.

Link to comment
Share on other sites

$logged doesn't exis at all. Hence your code was looking like working because your condition asks if it is not set. It's not set because not existing.

But the good is:

All code is already available, even the if clause to show prices. Your use the existing code. In your product.tpl you fine a line like this around line # 263:

{if $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}

The corresponding end if is found at appx. line 317, replace the simple /if with the following

                        {else}    
                            <h4>Please log in to see prices</h4>
                        {/if} {*close if for show price*}

If you have done so, everything is controlled by the group setting => show prices.

Edited by Scully (see edit history)
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...