Jump to content
Gavimse

changer la liste des produits en liste par défaut au lieu de grille

Recommended Posts

Bonjour à tous,

Sur mon presta1.6, je souhaite afficher par défaut mes produits en liste et non en grille.

J'ai vu sur le forum que certains avaient déjà cette problématique mais sur le thème par défaut.

Voici la partie de mon code montheme/js/global.js qui gère ça :


function view_as() {
    var viewGrid = $(".view-grid"),
        viewList = $(".view-list"),
        productList = $(".products-list");
    viewGrid.click(function (e) {        
        productList.removeClass("products-list-in-row");
        productList.addClass("products-list-in-column");
        $(this).addClass('active');
        viewList.removeClass("active");
        e.preventDefault()
    });
    viewList.click(function (e) {        
        productList.removeClass("products-list-in-column");
        productList.addClass("products-list-in-row");
        viewGrid.removeClass("active");
        $(this).addClass('active');        
        e.preventDefault()
    })
}
jQuery(function ($) {
    "use strict";
    view_as();
});
jQuery(function ($) {
    "use strict";
    $.initQuantity = function ($control) {
        $control.each(function () {
            var $this = $(this),
                data = $this.data("inited-control"),
                $plus = $(".input-group-addon:last", $this),
                $minus = $(".input-group-addon:first", $this),
                $value = $(".form-control", $this);
            if (!data) {
                $control.attr("unselectable", "on").css({
                    "-moz-user-select": "none",
                    "-o-user-select": "none",
                    "-khtml-user-select": "none",
                    "-webkit-user-select": "none",
                    "-ms-user-select": "none",
                    "user-select": "none"
                }).bind("selectstart", function () {
                    return false
                });
                $plus.click(function () {
                    var val =
                        parseInt($value.val()) + 1;
                    $value.val(val);
                    return false
                });
                $minus.click(function () {
                    var val = parseInt($value.val()) - 1;
                    $value.val(val > 0 ? val : 1);
                    return false
                });
                $value.blur(function () {
                    var val = parseInt($value.val());
                    $value.val(val > 0 ? val : 1)
                })
            }
        })
    };
    $.initQuantity($(".quantity-control"));
    $.initSelect = function ($select) {
        $select.each(function () {
            var $this = $(this),
                data = $this.data("inited-select"),
                $value = $(".value", $this),
                $hidden = $(".input-hidden", $this),
                $items = $(".dropdown-menu li > a", $this);
            if (!data) {
                $items.click(function (e) {
                    if ($(this).closest(".sort-isotope").length >
                        0) e.preventDefault();
                    var data = $(this).attr("data-value"),
                        dataHTML = $(this).html();
                    $this.trigger("change", {
                        value: data,
                        html: dataHTML
                    });
                    $value.html(dataHTML);
                    if ($hidden.length) $hidden.val(data)
                });
                $this.data("inited-select", true)
            }
        })
    };
    $.initSelect($(".btn-select"))
});
jQuery(function ($) {
    "use strict";
    $("#off-canvas-menu-toggle").bind("click", function (e) {
        $("body").toggleClass("off-canvas-menu-open");        
        $("html, body").animate({
            scrollTop: 0
        }, "300");
        e.preventDefault()
    });
    $("#off-canvas-menu-close").bind("click", function (e) {
        $("body").removeClass("off-canvas-menu-open");        
    });    
});

jQuery(document).ready(function() {
    jQuery('.owl-item').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInUp', // Class to add to the elements when they are visible
        offset: 30    
    });   
    jQuery('.service-box').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInUp', // Class to add to the elements when they are visible
        offset: 30    
    });
    jQuery('.jms-blog').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInUp', // Class to add to the elements when they are visible
        offset: 30    
    });
    jQuery('.jms_testimonials').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInUp', // Class to add to the elements when they are visible
        offset: 30    
    });
    jQuery('.intro_special_product').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInLeft', // Class to add to the elements when they are visible
        offset: 30    
    });
    jQuery('.deal_home').addClass("a-hidden").viewportChecker({
        classToAdd: 'a-visible animated fadeInRight', // Class to add to the elements when they are visible
        offset: 30    
    });
    
    
});  

jQuery(function ($) {
    "use strict";
    $(window).scroll(function () {
        if ($(window).scrollTop() >= 50) {    
            $(".header-bar").addClass("navbar-fixed-top");
            $("#back-to-top").stop().fadeIn(300);
        } else if ($(window).scrollTop() < 200) {
            $("#back-to-top").stop().fadeOut(300);
            $(".header-bar").removeClass("navbar-fixed-top");
        }
    });
});
jQuery(function ($) {
    "use strict";
    $(".search-box > a").click(function (e) {
        $('#jms_ajax_search').toggleClass('jms_search');
        e.stopPropagation();
        return false;
    })
});

function quick_view() {
    $(document).on('click', '.quick-view:visible', function(e)
    {
        e.preventDefault();        
        var url = this.rel;        
        if (url.indexOf('?') != -1)
            url += '&';
        else
            url += '?';

        if (!!$.prototype.fancybox)
            $.fancybox({
                'padding':  0,
                'width':    900,
                'height':   450,
                'type':     'iframe',
                'href':     url + 'content_only=1'
            });
    });
}
function back_to_top() {      
    $('.back-to-top').click(function(event) {
        event.preventDefault();
        $('html, body').animate({scrollTop: 0}, 500);
        return false;
    })
}

var initialLoad = true;
$(document).ready(function() {
    if(initialLoad){
        $(".loader").fadeOut("slow");
        initialLoad = false;
    }
});
$(window).load(function () {          
    $('.dropdown-menu input, .dropdown-menu label').click(function(e) {
        e.stopPropagation();
    });     
    quick_view();
    back_to_top();
    $(".view-grid").addClass('active');
    
});

Edited by Gavimse (see edit history)

Share this post


Link to post
Share on other sites

Bonjour à tous,

Je ne trouve pas la solution, quelqu'un peut m'aider?

Merci

Share this post


Link to post
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

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More