Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento托管-更改搜索布局/默认布局_Magento - Fatal编程技术网

Magento托管-更改搜索布局/默认布局

Magento托管-更改搜索布局/默认布局,magento,Magento,我正在试图找出如何将默认布局从3列更改为2列。除了搜索结果,我已经能够在每个页面上成功地完成它。我不介意将默认布局更改为2列,因为我希望所有布局都是统一的 这里有一个陷阱,我使用的是托管解决方案(我讨厌它,但嘿,我只是开发人员)。我无法访问文件系统或单个文件。我还没有找到上传和替换任何文件的方法,所以我所做的所有更改都必须从后端完成。我真的希望能做到这一点。答案是,你不能。简单明了 但是,您可以使用jQuery将其破解并使其正常工作。以下是我使用的代码: //Check for 3 col la

我正在试图找出如何将默认布局从3列更改为2列。除了搜索结果,我已经能够在每个页面上成功地完成它。我不介意将默认布局更改为2列,因为我希望所有布局都是统一的


这里有一个陷阱,我使用的是托管解决方案(我讨厌它,但嘿,我只是开发人员)。我无法访问文件系统或单个文件。我还没有找到上传和替换任何文件的方法,所以我所做的所有更改都必须从后端完成。我真的希望能做到这一点。

答案是,你不能。简单明了

但是,您可以使用jQuery将其破解并使其正常工作。以下是我使用的代码:

//Check for 3 col layout.
if($j('.col3-layout').length>0){
    //swap the 3 col layout for the 2 col layout
    $j('.col3-layout').addClass('col2-left-layout').removeClass('col3-layout');
    //grab all the code in the wapper, and place it in the main
    var html=$j('.col-wrapper').html();
    $j('.main').html(html);
    //If products are shown as a grid, reorder them.  If it is a list, leave it alone.
    if(!$j('.grid').attr('href')){
        //Grab all items in the list, push them into an array, and then remove all the data.
        var items=new Array();
        $j('.products-grid .item').each(function(){
            items.push($j(this).html());
        });
        $j('.products-grid').remove();
        //build your output
        var html='';
        var gridsize=4; //items per row
        for(var i=0;i<items.length;i++){
            if(i%gridsize==0){//start a new row
                html+='<ul class="products-grid '
                if(i/gridsize==0)//very first row
                    html+='first ';
                else if(i==items.length-gridsize)//last row
                    html+='last '
                if(i/gridsize%2==0)//even class
                    html+='even">';
                else
                    html+='odd">';//odd class
                html+='<li class="item first">'+items[i]+"</li>";
            }else if(i%gridsize==gridsize-1){//very item in row
                html+='<li class="item last">'+items[i]+"</li></ul>";
            }else
                html+='<li class="item">'+items[i]+"</li>";
        }
        $j('.category-products').html(html);  //populate the data.
    }
}
//检查3列布局。
如果($j('.col3布局')。长度>0){
//将3列布局替换为2列布局
$j('.col3-layout').addClass('col2-left-layout').removeClass('col3-layout');
//抓取wapper中的所有代码,并将其放在main中
var html=$j('.col wrapper').html();
$j('.main').html(html);
//如果产品显示为网格,则对其重新排序。如果是列表,则不必理会它。
if(!$j('.grid').attr('href')){
//抓取列表中的所有项目,将它们放入数组中,然后删除所有数据。
var items=新数组();
$j('.products grid.item')。每个(函数(){
push($j(this.html());
});
$j('.products grid').remove();
//建立你的输出
var html='';
var gridsize=4;//每行项目数

对于(var i=0;我认为如果不修改layout.xml文件,这是不可能的。我可能想知道如何编辑这些文件。@B00MER我们正在向Magento支付托管费,这也让我们能够获得他们的支持,所以我可能也会在那里开一张罚单。我想如果有办法,有人会知道的。