THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline


Hello,

I would like to display prices only for logged in customers. What would be the best logic to achieve this?

Thanks,
Simon

Offline


Hello,

You can extend the product loop, get the customer in the session and if the value is null, change the price of the products.

Here is the doc for the extend loops. http://doc.thelia.net/en/documentation/loop/extend.html

(Sorry for my bad english)

Offline


You may also change the template, to check if a customer is logged in when a price shoud be displayed :

{if {customer attr="id"}}
... customer is connected ...
{/if}

You could optimize this by defining a variable in layout.tpl :

{$customerIsLoggedIn = {customer attr="id"} > 0}

The you can write in all templates which inherits layout.tpl :

{if $customerIsLoggedIn}
... customer is connected ...
{/if}

OpenStudio Toulouse

Offline


Thank you guys!