3rtt Posted January 6, 2011 Share Posted January 6, 2011 I haven't found an answer to this anywhere, so I hope someone here can help me. I would like to hide the add to cart button when a user is not logged in, but show it after log-in. Is this possible? Thanks in advance. Link to comment Share on other sites More sharing options...
shokinro Posted January 6, 2011 Share Posted January 6, 2011 it is possible, you can do it as following.Here I am using product page as an example1. Add following line to your product.php fileBefore following line $smarty->display(_PS_THEME_DIR_.'product.tpl'); Add line $smarty->assign('logged', $cookie->isLogged()); 2. Find the code for "add to cat" button/link in product .tpl file , then add {if $logged} before that code and {/if} after that code.Here is example"Add to cart" button code before change <a class="exclusive button ajax_add_to_cart_button" href="{$base_dir}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> code after change {if $logged} <a class="exclusive button ajax_add_to_cart_button" href="{$base_dir}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> {/if} Link to comment Share on other sites More sharing options...
3rtt Posted January 7, 2011 Author Share Posted January 7, 2011 it is possible, you can do it as following.Find the code for "add to cat" button/link in related .tpl file(such as product.tpl), then add {if $logged} before that code and {/if} after that code. I tried this suggestion, and after refreshing the product page, the entire right column was missing, along with the page center including product image and information. This was the product.tpl file found in themes/prestashop. I tried to paste the line of code as modified into this post, but when I reviewed the post before adding it to the thread, most of the code was missing.I restored the original product.tpl file and all the missing information reappeared...along with the add to cart button. Is there any other way to accomplish this? Link to comment Share on other sites More sharing options...
shokinro Posted January 7, 2011 Share Posted January 7, 2011 I have updated my previous post to make it more detailed with example.Please go check that post again and hope that helps. Link to comment Share on other sites More sharing options...
3rtt Posted January 7, 2011 Author Share Posted January 7, 2011 I have updated my previous post to make it more detailed with example.Please go check that post again and hope that helps. THANK YOU THANK YOU THANK YOU!!! I had been struggling with this issue for at least a couple of days now. I had the bracketed "if"s in all the right places, but wasn't aware of the need to edit the product.php file. That made all the difference!Now if I can just figure out how to edit the topic title for this thread to show it is resolved! LOL Link to comment Share on other sites More sharing options...
jpadvertising Posted April 19, 2011 Share Posted April 19, 2011 I was looking for this... I would like to ask how to hide both prices and cart until the user has logged in.I really need presta shop to work as a catalog showing items but no prices or Cart until the customer logs in (I'm manually creating accounts for customers)Could you help me PLEASE.I'm using 1.3.6 Link to comment Share on other sites More sharing options...
jpadvertising Posted April 22, 2011 Share Posted April 22, 2011 I tried the above to the tee... and NOTHING HAPPENED at all.The add to cart button still shows even when not logged in.I also tried placing {if $logged} at the top of blockcart.tpl and {/if} at end and again nothing changed!Willing to pay someone to get this working for me! Link to comment Share on other sites More sharing options...
shokinro Posted April 22, 2011 Share Posted April 22, 2011 If you put it at right place and in correct way. it should work.Make sure you have cleared cache/compiled files of smarty to force the changes to be reflected.if you are using 1.4, you can do this at Preference/Performance tab Link to comment Share on other sites More sharing options...
AshKay Posted May 29, 2012 Share Posted May 29, 2012 (edited) How can i hide payment methods and leave a message untill GUEST has saved details in PS v 1.4.7.3 ? Thanks, Ash Edited May 29, 2012 by AshKay (see edit history) Link to comment Share on other sites More sharing options...
ricky11 Posted January 25, 2013 Share Posted January 25, 2013 Does this work in 1.5 is there anther solution to this? Link to comment Share on other sites More sharing options...
Recommended Posts