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} {else} {convertPrice price=$productPrice} {/if} {/if}
solution:
{if $priceDisplay >= 0 && $priceDisplay {if $logged} {if $product->specificPrice.reduction} {convertPrice price=$productPrice} {else} {convertPrice price=$productPrice} {/if} {/if} {/if}
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->getPageLink('cart.php')}?qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add" rel="ajax_id_product_{$accessory.id_product|intval}">{l s='Add to cart'}</a>
solution:
<pre><span style="color: #008000;">{if $logged}</span> <a class="exclusive button ajax_add_to_cart_button" style="color: #000000;"> href="{$link->getPageLink('cart.php')}?qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{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->getPageLink('authentication.php')}">{l s='Add to cart'}</a></span> <span style="color: #008000;">{/if}</span></pre>
8 Comentarios
Adam
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
Luis
This explanation is very poor and Useless
Mari
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.
Mari
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.
Useless
This is the worst expanation I have seen. You gave absolutely no direction as to where to place this information
Beginer_pl
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?