Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Как изменить сиртовое когдачество товаров при покупке?


lavreniyk
 Share

Recommended Posts

Доброго времени суток! Хочу узнать как изменить сиртовое когдачество товара при покупке.

Например:

Я жму на кнопку купить товар, В корзине покажет что я купил 1 единицу. Мне нужно чтобы отсчёт налинался с 25 единиц товара.

То есть я нажал на кнопку купить и мне сразу в корзине показало что я хочу купить 25 единиц товара.

 

Помогите пожалуйси)

Edited by lavreniyk
Link to comment
Share on other sites


11 минут назад, Tom сказал:

В опенкарт есть функция "минимальное когдачество", указывается в каждом товаре.

Минимальное когдачество есть, но его нужно самому вводить.

 

Нужно чтобы при нажатии "купить" в корзине сразу показывалось 25 единиц товара.

Edited by lavreniyk
Link to comment
Share on other sites


15 минут назад, lavreniyk сказал:

но его нужно самому вводить.

В корзину попадёт столько сколько указано в этом значении. Если человек сам руками изменит это значение, то в корзине не сможет оформить заказ и бугдет вылазить предупрежгдение о минимальном когдачестве...
Офф гдемка

Link to comment
Share on other sites

1 час назад, lavreniyk сказал:

Нужно чтобы при нажатии "купить" в корзине сразу показывалось 25 единиц товара.

@Tom верно ответил.

Но вы можете сгделать и ик:

catalog\view\javascript\common.js находите http://prntscr.com/rpqel0 и меняете 1 на нужное когдачество. Но стоит учесть, что если в товаре высивлено "Минимальное кличество" меньше чем то что Вы посивите в файле, то бугдет предупрежгдение.

 

Link to comment
Share on other sites

13 минут назад, Tom сказал:

В корзину попадёт столько сколько указано в этом значении. Если человек сам руками изменит это значение, то в корзине не сможет оформить заказ и бугдет вылазить предупрежгдение о минимальном когдачестве...
Офф гдемка

Это если заходить на страницу товара, а если заказывать с главной, то только 1 единица получается.

Посмотрите пожалуйси, вот ссылка на сайт: http://s-opt.pp.ua/

На товаре Rothmans стоит минимальное когдачество 25 единиц.

Link to comment
Share on other sites


1 час назад, lavreniyk сказал:

Это если заходить на страницу товара, а если заказывать с главной, то только 1 единица получается.

ответил вам выше.

Link to comment
Share on other sites

1 час назад, lavreniyk сказал:

Спасипотому что, Поменял, но ик и осиётся 1 единица.(

кеш браузера полистили? 

Link to comment
Share on other sites

12 минут назад, OCdevWizard сказал:

кеш браузера полистили? 

Да, полистил даже с другого устройства зашёл.

Может оно сохранилось в Кеше opencart?

Link to comment
Share on other sites


7 минут назад, OCdevWizard сказал:

если у вас шаблон не синдартный то в ней скоерй всего свой common.js

Спасипотому что потому чтольшое, главное теперьь знаю куда и ггде смотреть.

Да, шаблон не синдартный

Link to comment
Share on other sites


10 минут назад, OCdevWizard сказал:

если у вас шаблон не синдартный то в ней скоерй всего свой common.js

А примерно в каких папках это искать ?)

Link to comment
Share on other sites


15 минут назад, OCdevWizard сказал:

если у вас шаблон не синдартный то в ней скоерй всего свой common.js

Переклюлил на синдартный шаблон и все зарилиило, нужно чтобы в том шаблон это рилиило

Link to comment
Share on other sites


/catalog/view/theme/fanes/javascript/common.min.js

Файл минифицирован, вот ик выглядит без минификации
 

Спойлер

function getURLVar(t) {
    var e = [],
        o = String(document.location).split("?");
    if (o[1]) {
        var a = o[1].split("&");
        for (i = 0; i < a.length; i++) {
            var n = a.split("=");
            n[0] && n[1] && (e[n[0]] = n[1])
        }
        return e[t] ? e[t] : ""
    }
}
$(document).ready(function() {
    $(".text-danger").each(function() {
        var t = $(this).parent().parent();
        t.hasClass("form-group") && t.addClass("has-error")
    }), $("#form-currency .currency-select").on("click", function(t) {
        t.preventDefault(), $("#form-currency input[name='code']").val($(this).attr("name")), $("#form-currency").submit()
    }), $("#form-language .language-select").on("click", function(t) {
        t.preventDefault(), $("#form-language input[name='code']").val($(this).attr("name")), $("#form-language").submit()
    }), $("#search input[name='search']").parent().find("button").on("click", function() {
        var t = $("base").attr("href") + "index.php?route=product/search",
            e = $(".right-l #search input[name='search']").val();
        e && (t += "&search=" + encodeURIComponent(e)), location = t
    }), $("#search input[name='search']").on("keydown", function(t) {
        13 == t.keyCode && $(".right-l #search input[name='search']").parent().find("button").trigger("click")
    }), $("#menu .dropdown-menu").each(function() {
        var t = $("#menu").offset(),
            e = $(this).parent().offset().left + $(this).outerWidth() - (t.left + $("#menu").outerWidth());
        0 < e && $(this).css("margin-left", "-" + (10 + e) + "px")
    }), $("#list-view").click(function() {
        $("#content .product-grid > .clearfix").remove(), $("#content .row > .product-grid").attr("class", "product-layout product-list col-xs-12"), $("#grid-view").removeClass("active"), $("#list-view").addClass("active"), localStorage.setItem("display", "list")
    }), $("#grid-view").click(function() {
        var t = $("#column-right, #column-left").length;
        2 == t ? $("#content .product-list").attr("class", "product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-12") : 1 == t ? $("#content .product-list").attr("class", "product-layout product-grid col-lg-4 col-md-4 col-sm-6 col-xs-12") : $("#content .product-list").attr("class", "product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-12"), $("#list-view").removeClass("active"), $("#grid-view").addClass("active"), localStorage.setItem("display", "grid")
    }), "list" == localStorage.getItem("display") ? ($("#list-view").trigger("click"), $("#list-view").addClass("active")) : ($("#grid-view").trigger("click"), $("#grid-view").addClass("active")), $(document).on("keydown", "#collapse-checkout-option input[name='email'], #collapse-checkout-option input[name='password']", function(t) {
        13 == t.keyCode && $("#collapse-checkout-option #button-login").trigger("click")
    }), $("[data-toggle='tooltip']").tooltip({
        container: "body"
    }), $(document).ajaxStop(function() {
        $("[data-toggle='tooltip']").tooltip({
            container: "body"
        })
    })
});
var cart = {
        add: function(t, e) {
            $.ajax({
                url: "index.php?route=checkout/cart/add",
                type: "post",
                data: "product_id=" + t + "&quantity=" + (void 0 !== e ? e : 1),
                dataType: "json",
                beforeSend: function() {
                    $("#cart > button").button("loading")
                },
                complete: function() {
                    $("#cart > button").button("reset")
                },
                success: function(t) {
                    $(".alert-dismissible, .text-danger").remove(), t.redirect && (location = t.redirect), t.success && ($(".nav-menu").after('<div class="event-block"><i class="fa fa-check-circle"></i>' + t.success + "</div>"), setTimeout(function() {
                        $("#cart > a").html('<span id="cart-total"><i class="fa fa-shopping-bag" aria-hidden="true"></i> ' + t.total + "</span>")
                    }, 100), $("#cart ul").load("index.php?route=common/cart/info ul li"))
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        },
        update: function(t, e) {
            $.ajax({
                url: "index.php?route=checkout/cart/edit",
                type: "post",
                data: "key=" + t + "&quantity=" + (void 0 !== e ? e : 1),
                dataType: "json",
                beforeSend: function() {
                    $("#cart > button").button("loading")
                },
                complete: function() {
                    $("#cart > button").button("reset")
                },
                success: function(t) {
                    setTimeout(function() {
                        $("#cart > a").html('<span id="cart-total"><i class="fa fa-shopping-bag" aria-hidden="true"></i> ' + t.total + "</span>")
                    }, 100), "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart > ul").load("index.php?route=common/cart/info ul li")
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        },
        remove: function(t) {
            $.ajax({
                url: "index.php?route=checkout/cart/remove",
                type: "post",
                data: "key=" + t,
                dataType: "json",
                beforeSend: function() {
                    $("#cart > button").button("loading")
                },
                complete: function() {
                    $("#cart > button").button("reset")
                },
                success: function(t) {
                    setTimeout(function() {
                        $("#cart > a").html('<span id="cart-total"><i class="fa fa-shopping-bag" aria-hidden="true"></i> ' + t.total + "</span>")
                    }, 100), "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart ul").load("index.php?route=common/cart/info ul li")
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        }
    },
    voucher = {
        add: function() {},
        remove: function(t) {
            $.ajax({
                url: "index.php?route=checkout/cart/remove",
                type: "post",
                data: "key=" + t,
                dataType: "json",
                beforeSend: function() {
                    $("#cart > button").button("loading")
                },
                complete: function() {
                    $("#cart > button").button("reset")
                },
                success: function(t) {
                    setTimeout(function() {
                        $("#cart > button").html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + t.total + "</span>")
                    }, 100), "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart > ul").load("index.php?route=common/cart/info ul li")
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        }
    },
    wishlist = {
        add: function(t) {
            $.ajax({
                url: "index.php?route=account/wishlist/add",
                type: "post",
                data: "product_id=" + t,
                dataType: "json",
                success: function(t) {
                    $(".alert-dismissible").remove(), t.redirect && (location = t.redirect), t.success && $(".nav-menu").after('<div class="event-block"><i class="fa fa-check-circle"></i>' + t.success + "</div>"), $("#wishlist-total").html(t.total), $("#wishlist-total").attr("title", t.total)
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        },
        remove: function() {}
    },
    compare = {
        add: function(t) {
            $.ajax({
                url: "index.php?route=product/compare/add",
                type: "post",
                data: "product_id=" + t,
                dataType: "json",
                success: function(t) {
                    $(".alert-dismissible").remove(), t.success && ($(".nav-menu").after('<div class="event-block"><i class="fa fa-check-circle"></i>' + t.success + "</div>"), $("#compare-total").html(t.total))
                },
                error: function(t, e, o) {
                    alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
                }
            })
        },
        remove: function() {}
    };
$(document).delegate(".agree", "click", function(t) {
        t.preventDefault(), $("#modal-agree").remove();
        var e = this;
        $.ajax({
            url: $(e).attr("href"),
            type: "get",
            dataType: "html",
            success: function(t) {
                html = '<div id="modal-agree" class="modal">', html += '  <div class="modal-dialog">', html += '    <div class="modal-content">', html += '      <div class="modal-header">', html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>', html += '        <h4 class="modal-title">' + $(e).text() + "</h4>", html += "      </div>", html += '      <div class="modal-body">' + t + "</div>", html += "    </div>", html += "  </div>", html += "</div>", $("body").append(html), $("#modal-agree").modal("show")
            }
        })
    }),
    function(o) {
        o.fn.autocomplete = function(t) {
            return this.each(function() {
                this.timer = null, this.items = new Array, o.extend(this, t), o(this).attr("autocomplete", "off"), o(this).on("focus", function() {
                    this.request()
                }), o(this).on("blur", function() {
                    setTimeout(function(t) {
                        t.hide()
                    }, 200, this)
                }), o(this).on("keydown", function(t) {
                    switch (t.keyCode) {
                        case 27:
                            this.hide();
                            break;
                        default:
                            this.request()
                    }
                }), this.click = function(t) {
                    t.preventDefault(), value = o(t.target).parent().attr("data-value"), value && this.items[value] && this.select(this.items[value])
                }, this.show = function() {
                    var t = o(this).position();
                    o(this).siblings("ul.dropdown-menu").css({
                        top: t.top + o(this).outerHeight(),
                        left: t.left
                    }), o(this).siblings("ul.dropdown-menu").show()
                }, this.hide = function() {
                    o(this).siblings("ul.dropdown-menu").hide()
                }, this.request = function() {
                    clearTimeout(this.timer), this.timer = setTimeout(function(t) {
                        t.source(o(t).val(), o.proxy(t.response, t))
                    }, 200, this)
                }, this.response = function(t) {
                    if (html = "", t.length) {
                        for (i = 0; i < t.length; i++) this.items[t.value] = t;
                        for (i = 0; i < t.length; i++) t.category || (html += '<li data-value="' + t.value + '"><a href="#">' + t.label + "</a></li>");
                        var e = new Array;
                        for (i = 0; i < t.length; i++) t.category && (e[t.category] || (e[t.category] = new Array, e[t.category].name = t.category, e[t.category].item = new Array), e[t.category].item.push(t));
                        for (i in e)
                            for (html += '<li class="dropdown-header">' + e.name + "</li>", j = 0; j < e.item.length; j++) html += '<li data-value="' + e.item[j].value + '"><a href="#">&nbsp;&nbsp;&nbsp;' + e.item[j].label + "</a></li>"
                    }
                    html ? this.show() : this.hide(), o(this).siblings("ul.dropdown-menu").html(html)
                }, o(this).after('<ul class="dropdown-menu"></ul>'), o(this).siblings("ul.dropdown-menu").delegate("a", "click", o.proxy(this.click, this))
            })
        }
    }(window.jQuery);

 

Edited by Tom
Link to comment
Share on other sites

8 часов назад, lavreniyk сказал:

Ссылка на шаблон, возможно кто-то сможет найти как поменять (

Ссылка: https://fex.net/ru/s/a6dkpox

http://prntscr.com/rpx3gh  catalog/view/theme/fanes/javascript/common.min.js

1 меняете на нужное вам лисло. 

Link to comment
Share on other sites

1 час назад, lavreniyk сказал:

Все сгделал как Вы написали, но ик и ничего не изменилось, не знаю ггде искать 

кеш полистили браузера?

Link to comment
Share on other sites

1 час назад, lavreniyk сказал:

Большое спасипотому что, все полулилось! Тема закрыи

Отлично

Да что все ики было?

Link to comment
Share on other sites

1 час назад, OCdevWizard сказал:

Отлично

Да что все ики было?

Все сгделал как Вы сказали, врогде полистил кэш но ничего не произошло.

Всил на следующий гдень с утра и вуаля, все рилииет)

Скорее всего кэш не полистил)

Link to comment
Share on other sites


1 час назад, lavreniyk сказал:

Все сгделал как Вы сказали, врогде полистил кэш но ничего не произошло.

Всил на следующий гдень с утра и вуаля, все рилииет)

Скорее всего кэш не полистил)

ясно

хорошо что рилииет

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.