Hide prices for unregistered prestashop

… as I was telling the other day I had to modify to Hide prestashop price of an item when the user is viewing it is not logged, also had to check that all purchase buttons are redirected to the login page. After many forums unreadable codes, or tedious explanations, I discovered that the solution was simpler than it seemed. I show several example solved my problem. Case where a field is shown

{if $priceDisplay >= 0 && $priceDisplay specificPrice.reduction}
{convertPrice price=$productPrice}
{convertPrice price=$productPrice}


{if $priceDisplay >= 0 && $priceDisplay {if $logged}
{if $product->specificPrice.reduction}
{convertPrice price=$productPrice}
{convertPrice price=$productPrice}

the variable $loggedindicates whether the current user was logged and if done correctly. So simply with a “IF $ LOGGED” we can play with the values ​​shown to the persons identified as users and those without. The other example of which is to redirect talked buttons related to a purchase page identification / registration for users not logged in or registered. If the “Add to Cart”, we want if the user is not logged in, we redirect to the login page.

< a title="{l s='Add to cart'}" href= {$link-&gt;getPageLink('cart.php')}?qty=1&amp;id_product={$accessory.id_product|intval}&amp;token={$static_token}&amp;add" rel="ajax_id_product_{$accessory.id_product|intval}">{l s='Add to cart'}</a>


<pre><span style="color: #008000;">{if $logged}</span>
<a class="exclusive button ajax_add_to_cart_button" style="color: #000000;"> href="{$link-&gt;getPageLink('cart.php')}?qty=1&amp;id_product={$accessory.id_product|intval}&amp;token={$static_token}&amp;add" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}"&gt;{l s='Add to cart'}</a>
<span style="color: #008000;">{else}</span>
<span style="color: #008000;"><a class="exclusive button" title="{l s='Add to cart'}" href="{$link-&gt;getPageLink('authentication.php')}">{l s='Add to cart'}</a></span>
<span style="color: #008000;">{/if}</span></pre>
¿Te ha gustado el artículo?
Sé el primero en calificar esta publicación.
1 estrella2 estrellas3 estrellas4 estrellas5 estrellas

Suscríbete. Déjanos tu email y recibe contenido genial cada mes

Artículo escrito por

¡Exprésate! Dejanos tu comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

8 Comentarios


Hello, for hide prices for unregistered, you can use this module: http://addons.prestashop.com/en/24196-b2b-validate-user-registration-hide-price-for-visitors.html


This explanation is very poor and Useless


The code will be helpful for those users who are aware of coding, but for those who are completely new or not know the basic of coding will get confused.


The code will be helpful for those users who are aware of coding, but for those who are completely new or not know the basic of coding will get confused. So, as for their help they can use ready made plugin like this: http://goo.gl/JsNH11 to hide prices and add to cart button.


This is the worst expanation I have seen. You gave absolutely no direction as to where to place this information


hello. that is, where? in product.tpl and product-list.tpl there is no such code. where is the core prestashop?

Rubén Muñoz

Hi Rosemary, this modication to take in core of prestashop. Another solution is create one plugin. Regards

rosemary chimbganda

Hi Laura, This looks like what I need. Which modules do I modify for this to take effect?