0
我想弄清楚如何将默认布局从3列更改为2列。除了搜索结果,我已经能够在每个页面上成功地完成它。我不介意将默认布局更改为2列,因为我希望它们都是统一的。Magento托管 - 更改搜索布局/默认布局
下面是捕获,我在一个托管的解决方案(我讨厌它,但嘿,我只是开发人员)。我无法访问文件系统或单个文件。我还没有想出一种方法来上传和替换任何文件,因此我所做的所有更改都必须从后端完成。我真的希望这可以做到。
我想弄清楚如何将默认布局从3列更改为2列。除了搜索结果,我已经能够在每个页面上成功地完成它。我不介意将默认布局更改为2列,因为我希望它们都是统一的。Magento托管 - 更改搜索布局/默认布局
下面是捕获,我在一个托管的解决方案(我讨厌它,但嘿,我只是开发人员)。我无法访问文件系统或单个文件。我还没有想出一种方法来上传和替换任何文件,因此我所做的所有更改都必须从后端完成。我真的希望这可以做到。
答案是,你不能。干净利落。
但是,你可以使用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.
}
}
我不认为这是可能的,如果不修改layout.xml文件,可能想弄清楚如何编辑这些文件。 – B00MER 2012-07-20 15:56:51
@ B00MER我们支付Magento来托管它,这也让我们获得他们的支持,所以我可能也会在那里打开票。只是想知道有没有办法,有人会知道。 – 2012-07-20 16:04:42