S
S
staniki2021-07-27 17:56:30
opencart
staniki, 2021-07-27 17:56:30

How to increase the quantity of a product by a multiple of the minimum in the product card?

Actually, subject. Wholesale store, sold only in boxes, with a clear number of items in each box.
For OpenCart, there is the Simple module, which does an excellent job, but only with a check-out (purchase confirmation: +/- number of products is also possible on this page).

Here is tiwg

<div class="products-full-list__spinner">
                                <div class="spinner-wrap products-qty-info-spinner">
                                    <input type="text" name="quantity" class="spinner" value="{{ minimum }}"  placeholder="{{ minimum }}" id="input-quantity">
                                </div>
                            </div>


here are the pieces of js (I don't know which ones exactly)
function fastCartData($objectClick) {
            var product_id = $objectClick.attr('data-for');
            var qty = $objectClick.closest(".products-qty-info").find('.products-qty-info-spinner input').val();
            var type = $objectClick.attr('data-typefrom');

            $('#cat_qty').val(qty);
            $('#cat_prod_id').val(product_id);
            if(type == "category-popup"){
                $('.fast-redirect').val(0);
                var selector = 'popupprodid_'+product_id;
                var $data = $('#'+selector+' input[type=\'text\'], #'+selector+' input[type=\'hidden\'], #'+selector+' input[type=\'radio\']:checked, #'+selector+' input[type=\'checkbox\']:checked, #'+selector+' select, #'+selector+' textarea');
            }
            if(type == "category-list"){
                $('.fast-redirect').val(1);
                var $data = $('#popup-buy-click input');
            }
            if(type == "cart-popup"){
                return;
            }
            if(type == "product"){
                var $data = $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea');
            }
            add2cartFast($data);
}

function spinner() {
    if ($('.spinner').length) {
        $('.spinner').spinner({
            min: 1,
        });
    }

    $( "#cartcontent .spinner" ).on( "change", function( event, ui ) {setTimeout(function() { $('#cartcontent').submit();}, 100);    } );
    $( "#product .spinner" ).on( "change", function( event, ui ) { $('#product input[name="quantity"]').change();  } );
    $( "#cartcontent .spinner-wrap a" ).on( "click", function( event, ui ) { $('#cartcontent').submit();} );

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question