AbanteCart Development > Customization help

Prevent setting the quanity higher than the quantity of a product in stock?

(1/1)

OneMore:
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">
--- End quote ---

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">
--- End quote ---

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?

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

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod