Magento. 如何改变搜索结果页面上的列数
March 7, 2016
本教程将向您展示如何在Magento中更改搜索结果页面上的列数.
Magento. 如何改变搜索结果页面上的列数-
Connect to your FTP 或访问您的网站文件通过 Cpanel and navigate to app/design/frontend/ / tm / productlistgallery tm_themes / themexxx /模板,其中xxx是你的主题. In this directory locate list.phtml file. 你可以把它编辑进去 cpanel 或者下载它并使用任何文本进行编辑 editor,例如Sublime或notepad++;
-
In list.phtml 文件定位以下代码(第155行左右):
getColumnCount(); ?>
现在将其替换为:
getColumnCount(); ?>
It will comment out 默认的3列 layout 并启用自定义选项.
-
将以下代码添加到刚才在list中替换的代码下面.在php中,代码将设置3列 layout 对于所有页面,其中不是搜索结果页面,搜索结果页面4列:
if($this->getRequest()->getControllerName()=='result' || $this->getRequest()->getControllerName()=='advanced') { 美元col_class =“col-sm-3”; } else { 美元col_class =“col-sm-4”; } ?>
现在定位到列表中.php(大约第163行):
-
And replace col-sm-4 with:
它将加载您在本步骤前面的" if "语句中指定的动态类.
-
修改完成后,保存文件和 update it on your server. Now navigate to app/design/frontend/ tm_themes / themexxxx /layout/,其中xxx是你的主题. In this directory locate tm_productlistgallery.xml 文件,并以与前一个文件相同的方式开始编辑它:
在第37-57行找到以下代码:
tm/productlistgallery/list.phtml tm/productlistgallery/list.phtml 将其替换为:
tm/productlistgallery/list.phtml 4 tm/productlistgallery/list.phtml 4 它将允许搜索页面上的列分为4个,每个包含4个项目.
现在搜索结果将显示在4列中. 您还可以清除或禁用Magento cache,如果结果仍然显示在4列中.
感谢您查看我们的教程. 现在您知道了如何在Magento中更改搜索结果页面的列数.
请随时查看下面的详细视频教程:
Magento. 如何改变搜索结果页面上的列数