Author Topic: Prevent setting the quanity higher than the quantity of a product in stock?  (Read 6342 times)

Offline OneMore

  • Newbie
  • *
  • Posts: 46
  • Karma: +13/-0
    • View Profile
Hello,

I plan selling mostly unique (spare) parts, and items in small quantities, and without quantity discounts, nor priced options.

On the product page, how can one prevent setting a quantity higher than the inventory level being added to the cart?
I would like to control the quantity enterd in the quantity field, as well as disable the "Add to cart" button if the quantity already in cart
plus the quantity mentioned are above the inventory level.

Exploring the source code with the browser development tools, the field is:
Quote
<input type="text" name="quantity" id="product_quantity" value="1" placeholder="" class="form-control short" size="3">

If the number of a given product in stock is 3, I would like to modify it to:
Quote
<input type="number" min="0" max="3" name="quantity" id="product_quantity" value="1" placeholder="" class="form-control short" size="3">

Doing a grep search,I could find the "product_quantity" string only in ".../templates/embed/js_product.tpl", but modifying the code there was without effect, even after clearing the cache.

So far, I could not find where in the code the "product_quantity" field is generated ...  :-[
Who can help?

Offline dickinsonron

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
    • basketball stars
Your best bet for getting the inventory control features you desire for your e-commerce website is to either modify your site's code or install a plugin/module that provides it.

 

Powered by SMFPacks Social Login Mod