gracenote Posted November 13, 2014 Share Posted November 13, 2014 Is it possible to simply hide the quantity field in global.css for specific product pages? Preferable if I could hide it for all product pages that belong to a particular category. I've been trying different things to hide the quantity box on select product pages, but have not found a solution. Link to comment Share on other sites More sharing options...
MEG Venture Posted November 13, 2014 Share Posted November 13, 2014 Hi You can try this Open themes>yourtheme>product.tpl Go to the end of the file and paste the below code for the selected category id. In this case, the products under the default category id 3 will have a product page with hidden quantity box, quantity label, plus/minus buttons. {if $category->id==3} <script type="text/javascript"> $("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" ); $("#quantity_wanted").prev().css( "display", "none" ); </script> {/if} Link to comment Share on other sites More sharing options...
gracenote Posted November 13, 2014 Author Share Posted November 13, 2014 YES!! It worked!!!!! MEG Venture, you're a hero!! Thank you!! Link to comment Share on other sites More sharing options...
vekia Posted November 14, 2014 Share Posted November 14, 2014 hello and what if product will be associated with more than one category, and category you want to hide will not be default product category? hmmm ? :-) Link to comment Share on other sites More sharing options...
MEG Venture Posted November 14, 2014 Share Posted November 14, 2014 hello and what if product will be associated with more than one category, and category you want to hide will not be default product category? hmmm ? :-) Then I will call Vekia to build a module Link to comment Share on other sites More sharing options...
adtastic Posted January 11, 2016 Share Posted January 11, 2016 Hi You can try this Open themes>yourtheme>product.tpl Go to the end of the file and paste the below code for the selected category id. In this case, the products under the default category id 3 will have a product page with hidden quantity box, quantity label, plus/minus buttons. {if $category->id==3} <script type="text/javascript"> $("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" ); $("#quantity_wanted").prev().css( "display", "none" ); </script> {/if} This does exactly what i need to do in a store however there are multiple categories we need to hide the add quantity box. How would I write this to include multiple category numbers? Link to comment Share on other sites More sharing options...
MEG Venture Posted January 11, 2016 Share Posted January 11, 2016 This does exactly what i need to do in a store however there are multiple categories we need to hide the add quantity box. How would I write this to include multiple category numbers? Hi You can code like below: {if ($category->id==3) || ($category->id==4) || ($category->id==5)} <script type="text/javascript"> $("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" ); $("#quantity_wanted").prev().css( "display", "none" ); </script> {/if} Link to comment Share on other sites More sharing options...
adtastic Posted January 11, 2016 Share Posted January 11, 2016 perfect, thanks for the input! Link to comment Share on other sites More sharing options...
ecmscm Posted November 10, 2016 Share Posted November 10, 2016 (edited) hello i have same problem but with quantity in groups, i need visitor group or guest can NOT see quantity available, and only register can see the stock, how is the code ?? Prestashop 1.6.1.9 thanks a lot. Edited November 10, 2016 by ecmscm (see edit history) Link to comment Share on other sites More sharing options...
MEG Venture Posted November 10, 2016 Share Posted November 10, 2016 hello i have same problem but with quantity in groups, i need visitor group or guest can NOT see quantity available, and only register can see the stock, how is the code ?? Prestashop 1.6.1.9 thanks a lot. You can try this (add the below lines to the themes>yourtheme>product.tpl at the end of file) {if (Group::getCurrent()->id == '1' || Group::getCurrent()->id == '2')} <script type="text/javascript"> $("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" ); $("#quantity_wanted").prev().css( "display", "none" ); </script> {/if} Link to comment Share on other sites More sharing options...
ecmscm Posted November 10, 2016 Share Posted November 10, 2016 Ok, but must be #quatityavailable? Link to comment Share on other sites More sharing options...
ecmscm Posted November 11, 2016 Share Posted November 11, 2016 ok, works fine, thanks a lot. Link to comment Share on other sites More sharing options...
Recommended Posts