且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Opencart 2.x的类别视图中连续更改产品数量

更新时间:2023-11-30 09:30:52

所以我找到了解决方案:必须在//产品网格处更改商品目录/视图/javascript/common.js:

So i found the solution: must change catalog/view/javascript/common.js at // Product Grid:

// Product Grid
    $('#grid-view').click(function() {
        $('#content .product-layout > .clearfix').remove();

        // What a shame bootstrap does not take into account dynamically loaded columns
        cols = $('#column-right, #column-left').length;

        if (cols == 2) {
            $('#content .product-layout').attr('class', 'product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-6');
        } else if (cols == 1) {
            $('#content .product-layout').attr('class', 'product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-6');
        } else {
            $('#content .product-layout').attr('class', 'product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-6');
        }

         localStorage.setItem('display', 'grid');
    });

还有common.js中的clearfix:

And also clearfix in common.js:

//添加清除修订 cols1 = $('#column-right,#column-left').length;

// Adding the clear Fix cols1 = $('#column-right, #column-left').length;

if (cols1 == 2) {
    $('#content .product-layout:nth-child(2n+2)').after('<div class="clearfix visible-md visible-sm"></div>');
} else if (cols1 == 1) {
    $('#content .product-layout:nth-child(4n+4)').after('<div class="clearfix visible-lg"></div>'); /*3n+3*/
} else {
    $('#content .product-layout:nth-child(4n+4)').after('<div class="clearfix"></div>');