Product-sets

Product-sets for Shop-Script

Creation of product-sets like a unique unit

You can make dynamic checking, when you delete the product or change the quantity of product on the cart page.

You can't do this without making changes in the design theme, so You need to do the following steps:

  1. Go to Shop - Storefront - Template - cart.js
  2. Add code to the function, which is responsible for changing the quantity of product:
        if (typeof $.itemsetsFrontend !== 'undefined') {
            $.itemsetsFrontend.quantityChange(that);
        }
    where "that" - field of product quantity (jQuery object)
  3. Add code to the function, which is responsible for deleting product:
        if (typeof $.itemsetsFrontend !== 'undefined') {
            $.itemsetsFrontend.cartDelete(that);
        }
    where "that" - delete button (jQuery object)

If You are not confident in your knowledge - contact the developer of the theme. This task should not take more than two minutes.

Examples for some themes:

Design theme Default 2.0

About the same thing in themes Asсetiс, Clear, Nifty, Custom, Facebook, Sidebar, Vkontakte and others.

  1. Find code
        $(".cart input.qty").change(function () {
            var that = $(this);
            if (that.val() > 0) {
                var row = that.closest('div.row');
                if (that.val()) {
                    $.post('save/', {html: 1, id: row.data('id'), quantity: that.val()}, function (response) {
                        row.find('.item-total').html(response.data.item_total);
                        if (response.data.q) {
                            that.val(response.data.q);
                        }
                        if (response.data.error) {
                            alert(response.data.error);
                        } else {
                            that.removeClass('error');
                        }
                        updateCart(response.data);
                    }, "json");
                }
            } else {
                that.val(1);
            }
        });

    And after "updateCart(response.data)" add code, like this:

        $(".cart input.qty").change(function () {
            var that = $(this);
            if (that.val() > 0) {
                var row = that.closest('div.row');
                if (that.val()) {
                    $.post('save/', {html: 1, id: row.data('id'), quantity: that.val()}, function (response) {
                        row.find('.item-total').html(response.data.item_total);
                        if (response.data.q) {
                            that.val(response.data.q);
                        }
                        if (response.data.error) {
                            alert(response.data.error);
                        } else {
                            that.removeClass('error');
                        }
                        updateCart(response.data);
                        if (typeof $.itemsetsFrontend !== 'undefined') {
                            $.itemsetsFrontend.quantityChange(that);
                        }
                    }, "json");
                }
            } else {
                that.val(1);
            }
        });

  2. Find code
        $(".cart a.delete").click(function () {
            var row = $(this).closest('div.row');
            $.post('delete/', {html: 1, id: row.data('id')}, function (response) {
                if (response.data.count == 0) {
                    location.reload();
                }
                row.remove();
                updateCart(response.data);
            }, "json");
            return false;
        });

    And add at the beginning string "var that = $(this);" and after "updateCart(response.data)" code, like this:

        $(".cart a.delete").click(function () {
            var that = $(this);
            var row = $(this).closest('div.row');
            $.post('delete/', {html: 1, id: row.data('id')}, function (response) {
                if (response.data.count == 0) {
                    location.reload();
                }
                row.remove();
                updateCart(response.data);
                if (typeof $.itemsetsFrontend !== 'undefined') {
                    $.itemsetsFrontend.cartDelete(that);
                }
            }, "json");
            return false;
        });

Design theme Multishop

Let's see individually theme Multishop.

  1. Find code:

        // Изменение количества товаров
        var changeQuantity = function(that, callback) {
            if (that.val() > 0) {
                ...

    Below this function there is a string:

    cartBlockRow.find('input.qty').val(that.val());

    After that string add code:

        if (typeof $.itemsetsFrontend !== 'undefined') {
            $.itemsetsFrontend.quantityChange(that);
        }
  2. Find code:

        $(".cart a.delete").click(function() {
            var cartRow = $(this).closest('.cart-row');
            var id = cartRow.data('id');
            var i = $(this).find("i");
            i.removeClass("close-bw").addClass("loading");
            $.post('delete/', {html: ($.multishop.ruble == 'html' ? 1 : 0), id: id}, function(response) {
                if (response.data.count == 0) {
                    location.reload();
                }
                cartRow.remove();
                $(".cart-block-row[data-id='" + id + "']").remove();
                updateCart(response.data);
                if ($(".bottom-fixed .mobile-cart").is(":visible")) {
                    bouncePopup($(".bottom-fixed .mobile-cart"), "+ " + $.multishop.translate('Removed from cart'));
                }
            }, "json");
            return false;
        });

    And change code, like this:

        $(".cart a.delete").click(function() {
            var that = $(this);
            var cartRow = $(this).closest('.cart-row');
            var id = cartRow.data('id');
            var i = $(this).find("i");
            i.removeClass("close-bw").addClass("loading");
            $.post('delete/', {html: ($.multishop.ruble == 'html' ? 1 : 0), id: id}, function(response) {
                if (response.data.count == 0) {
                    location.reload();
                }
                cartRow.remove();
                $(".cart-block-row[data-id='" + id + "']").remove();
                updateCart(response.data);
                if ($(".bottom-fixed .mobile-cart").is(":visible")) {
                    bouncePopup($(".bottom-fixed .mobile-cart"), "+ " + $.multishop.translate('Removed from cart'));
                }
                if (typeof $.itemsetsFrontend !== 'undefined') {
                    $.itemsetsFrontend.cartDelete(that);
                }
            }, "json");
            return false;
        });

If you have some bugs - mail to: gapon2401@gmail.com