Jump to content

Hide Add Quantity Box On Select Products


Recommended Posts

We have select products that are sold via attributes and the quantity is selected via a dropdown box in the attributes. Have a problem where a lot of people try to increase the quantity via the default quantity box in prestashop because they are not computer savvy and it results in a lot of abandoned carts.

 

We need to remove the default quantity box only from these products sold via attributes but not other products. They are in various categories so just isolating one category won't work.

 

I found this link to a thread that purports to offer a solution: https://www.prestashop.com/forums/topic/165599-solved-display-the-quantity-box-for-some-products-only/ but it is a little confusing. Not sure if it is a solution so need some help from someone that understands prestashop coding better than I do.

 

The code it provides is this:

 

Where the attributes are displayed change

{foreach from=$groups key=id_attribute_group item=group}


to

   {assign var='attribute_group_exists' value=0}
   {foreach from=$groups key=id_attribute_group item=group}
   {if $id_attribute_group == ID_OF_THE_ATTRIBUTE_GROUP}
    {assign var='attribute_group_exists' value=1}
   {/if}


Where quantity is displayed:

{if $attribute_group_exists == 1}
<input type="hidden" name="qty" id="quantity_wanted" value="1"/>
{else}
[PUT HERE THE CURRENT CODE FOR QUANTITY INPUT]
{/if}

 

my assumption here is that the code will indeed hide the quantity box if a product has attributes is this correct?

 

And if so I am confused about how to implement it. I know where it goes.

 

The first part seems straightforward.

 

But the second part where it says: {if $id_attribute_group == ID_OF_THE_ATTRIBUTE_GROUP}

 

what is "ID_OF_THE_ATTRIBUTE_GROUP" and where do I find this?

Or, is there a better solution to do what I am trying to do?

 

 

Link to comment
Share on other sites

The code you posted seems to do what you ask if you need to hide the quantity input for all the attributes in an attribute group.

To find the attribute group id you should look into BO > Catalog > Product Attributes, all the attributes that you see listed or you add are actually attribute groups and all the values are actually attributes.

The code should be placed in your theme's product.tpl, look for the quantity input.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...