Jump to content

[Solved] How do i remove the option to select quantities from my product pages?


Recommended Posts

I sell geodes and minerals and each and every one is one of a kind and unique.  I want it so that customers aren't able to add multiple items of the same product.  I want  the quantity option completely removed from both the product page and from the shopping cart.  Any help would be greatly appreciated.  I'm using Prestashop 8.2

Edited by denniswixom (see edit history)
Link to comment
Share on other sites

1 minute ago, yama said:

You just need to set 1 quantity. Seems enough.

I've done that, but I want the option to add more than 1 gone from the shop.  I see that someone did that 10+ years ago on an older version of ps but that line isn't in my product.tpl file.  Having the option to add more than 1 of a 1-of-a-kind product kinda makes the UI ugly.

Link to comment
Share on other sites

I'm not sure to understand what you want to do.

 

Do you want propose 1 quantity of a product with some pictures,

And then, as soon as this qty is sold, you would like to set an other 1 qty for the same product but with different pictures?

Link to comment
Share on other sites

25 minutes ago, yama said:

I'm not sure to understand what you want to do.

 

Do you want propose 1 quantity of a product with some pictures,

And then, as soon as this qty is sold, you would like to set an other 1 qty for the same product but with different pictures?

No, what I'm saying is that I want every product i put on my website to NOT be able to change quantities.  Every item i sell is unique and there's no other like it, so i won't be able to sell more than 1 anyways.  Imagine you're an artist and you paint custom pictures for people.  No 2 paintings will be alike, so you can't sell more than 1 of those paintings, right?  That's what my geodes and minerals are.  They are 1 of a kind.  Having a quantity selector there would be obsolete for my purposes.  

Screenshot (1).jpg

Screenshot (2).jpg

Link to comment
Share on other sites

Hi.

This is what it needs:

image.png.ba3ee634d8ebe91e208c07c28ce39afa.png

 

image.png.90e582f26c0cfd7f24d44c432d9178c9.png

Please note that you also need to enable or disable the button on the product page if the product or product combination is already in the cart.
So hiding only quantity filed is not enough.
It is necessary to find out in advance if the product is in the Cart and disable the button and inform the customer that the product is already in the Cart and cannot be added more than once.

 

Edited by ps8modules (see edit history)
Link to comment
Share on other sites

12 hours ago, ps8modules said:

Hi.

This is what it needs:

image.png.ba3ee634d8ebe91e208c07c28ce39afa.png

 

image.png.90e582f26c0cfd7f24d44c432d9178c9.png

Please note that you also need to enable or disable the button on the product page if the product or product combination is already in the cart.
So hiding only quantity filed is not enough.
It is necessary to find out in advance if the product is in the Cart and disable the button and inform the customer that the product is already in the Cart and cannot be added more than once.

 

Yes, i know what it needs.  I just don't know how to do it.  Can you help?

Link to comment
Share on other sites

You can either remove the corresponding areas in the tpl files or simply hide them using the CSS instruction "display: none;", with the "Inspect" function available in most browsers by right-clicking, you can see what exactly you need to remove (usually a DIV).

 

Link to comment
Share on other sites

3 hours ago, rictools said:

You can either remove the corresponding areas in the tpl files or simply hide them using the CSS instruction "display: none;", with the "Inspect" function available in most browsers by right-clicking, you can see what exactly you need to remove (usually a DIV).

 

I found a step by step guide posted by someone on how to remove them from the TPL file on an older version of PS (1.7), but when i followed those instructions to the tee, the line i was supposed to delete and replace wasn't anywhere in the file.  Would you be able to show me how to remove in CSS?

Link to comment
Share on other sites

solution 1.) (only for computer, for mobile display, you still need to add custom.js)

./themes/classic/assets/css/custom.css

.product-add-to-cart > .control-label, 
.product-add-to-cart > .product-quantity > .qty,
.product-line-grid-right .input-group
{
    display: none !important;
}

 

solution 2.) (work in computer and mobile)

find 1: (/themes/classic/templates/catalog/_partials/product-add-to-cart.tpl)

<span class="control-label">{l s='Quantity' d='Shop.Theme.Catalog'}</span>

change to:

<span class="control-label" style="display: none !important;">{l s='Quantity' d='Shop.Theme.Catalog'}</span>

 find 2:

<div class="qty">

change to:

<div class="qty" style="display: none !important;">

 

find 3: (/themes/classic/templates/checkout/_partials/cart-detailed-product-line.tpl)

            {if !empty($product.is_gift)}
              <span class="gift-quantity">{$product.quantity}</span>
            {else}
              <input
                class="js-cart-line-product-quantity"
                data-down-url="{$product.down_quantity_url}"
                data-up-url="{$product.up_quantity_url}"
                data-update-url="{$product.update_quantity_url}"
                data-product-id="{$product.id_product}"
                type="number"
                inputmode="numeric"
                pattern="[0-9]*"
                {if $product.minimal_quantity > 1 || $product.quantity_wanted}
                  value="{$product.quantity}"
                  min="{$product.minimal_quantity}"
                  step="{$product.minimal_quantity}"
                  data-step="{$product.minimal_quantity}"
                {else}
                  value="{$product.quantity}"
                  min="1"
                {/if}
                name="product-quantity-spin"
                aria-label="{l s='%productName% product quantity field' sprintf=['%productName%' => $product.name] d='Shop.Theme.Checkout'}"
              />
            {/if}

change to:

<span class="gift-quantity">{$product.quantity}</span>

 

Edited by ps8modules (see edit history)
Link to comment
Share on other sites

20 minutes ago, ps8modules said:

solution 1.) (only for computer, for mobile display, you still need to add custom.js)

./themes/classic/assets/css/custom.css

.product-add-to-cart > .control-label, 
.product-add-to-cart > .product-quantity > .qty,
.product-line-grid-right .input-group
{
    display: none !important;
}

 

solution 2.) (work in computer and mobile)

find 1: (/themes/classic/templates/catalog/_partials/product-add-to-cart.tpl)

<span class="control-label">{l s='Quantity' d='Shop.Theme.Catalog'}</span>

change to:

<span class="control-label" style="display: none !important;">{l s='Quantity' d='Shop.Theme.Catalog'}</span>

 find 2:

<div class="qty">

change to:

<div class="qty" style="display: none !important;">

 

find 3: (/themes/classic/templates/checkout/_partials/cart-detailed-product-line.tpl)

            {if !empty($product.is_gift)}
              <span class="gift-quantity">{$product.quantity}</span>
            {else}
              <input
                class="js-cart-line-product-quantity"
                data-down-url="{$product.down_quantity_url}"
                data-up-url="{$product.up_quantity_url}"
                data-update-url="{$product.update_quantity_url}"
                data-product-id="{$product.id_product}"
                type="number"
                inputmode="numeric"
                pattern="[0-9]*"
                {if $product.minimal_quantity > 1 || $product.quantity_wanted}
                  value="{$product.quantity}"
                  min="{$product.minimal_quantity}"
                  step="{$product.minimal_quantity}"
                  data-step="{$product.minimal_quantity}"
                {else}
                  value="{$product.quantity}"
                  min="1"
                {/if}
                name="product-quantity-spin"
                aria-label="{l s='%productName% product quantity field' sprintf=['%productName%' => $product.name] d='Shop.Theme.Checkout'}"
              />
            {/if}

change to:

<span class="gift-quantity">{$product.quantity}</span>

 

Thank you for the detailed answer.  Do i upload them back into the exact same directory i got the files from?  That's what I did and it didn't remove the quantity option out of the cart nor the product page.  I even went and cleared my cache.  Not sure if this is something that takes several minutes to do since it's working across product pages for the whole website.  

Link to comment
Share on other sites

Just now, denniswixom said:

Thank you for the detailed answer.  Do i upload them back into the exact same directory i got the files from?  That's what I did and it didn't remove the quantity option out of the cart nor the product page.  I even went and cleared my cache.  Not sure if this is something that takes several minutes to do since it's working across product pages for the whole website.  

Oh i did Solution 2 by the way for the PC and mobile screens

Link to comment
Share on other sites

Just now, ps8modules said:

No need to upload again. What version of Prestashop do you have please?

I just saw that when i went to download those TPL files, they were already updated to what i changed it to and it looks great on my website.  THANK YOU so much!!!!! I really appreciate it.  I'm using PS 8.2

  • Like 1
Link to comment
Share on other sites

  • denniswixom changed the title to [Solved] How do i remove the option to select quantities from my product pages?
  • 2 weeks later...

I found the easiest and least intrusive way to remove the quantity box from the product page in prestahop 8 is to add the following line of code at the end of your themes css file. For the default theme this can be found themes>classic>assets>css>theme.css add this code:

.product-quantity .qty { display: none; }

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...