Post by attiliok » Fri May 10, 2019 3:11 pm

I wanted to let the customer choose quantity to add into cart directly on the product list page (category, search etc). Here is the way I solved this problem on OC3. Please be advised that I'm not an expert and a Vqmod modification would be much better than my "hardcoded" solution.

Anyway, here is it:

1. Edit catalog/view/theme/default/template/product/category.twig
2. Add following code before {% for product in products %}

Code: Select all

                 function inviacart(id) {
                 quant= $('#input-quantity-'+id).val();
3. Add following code before div class="button-group">

Code: Select all

 <div class="form-group">
    <label class="control-label" for="input-quantity">Qt.</label>
    <input type="text" name="quantity" value="{{ product.minimum }}" size="2" id="input-quantity-{{ product.product_id }}" class="form-control" />
4. replace

Code: Select all

    <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span></button>

Code: Select all

    <button type="button" onclick="inviacart('{{ product.product_id }}');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span></button>
5. repeat the same for search page or other product list pages.



Wed Apr 10, 2019 4:16 pm

Post by dparakhiya » Fri May 10, 2019 3:56 pm

For quick, professional OpenCart support
contact me on skype : dparakhiya_1
email :

User avatar
New member


Fri Jul 28, 2017 1:13 pm
Location - India
Who is online

Users browsing this forum: FrankR, Google [Bot] and 31 guests