Php Magento-将工具栏移动到左侧块
将产品列表工具栏从内容块移动到左侧块时遇到问题 我只想显示“排序依据”选项,这可以通过设置自定义工具栏模板文件toolbar\u custom.html轻松完成。但是我通过输出得到一个错误 到目前为止,我在Php Magento-将工具栏移动到左侧块,php,magento-1.6,Php,Magento 1.6,将产品列表工具栏从内容块移动到左侧块时遇到问题 我只想显示“排序依据”选项,这可以通过设置自定义工具栏模板文件toolbar\u custom.html轻松完成。但是我通过输出得到一个错误 到目前为止,我在layout/catalog.xml中添加了这几行: 目录类别(非锚定) 产品列表工具栏 在导航/left.phtml中: 这是我的自定义工具栏模板-toolbar\u custom.phtml: 在layout/catalog.xml文件下,对默认部分进行更改 <bloc
layout/catalog.xml
中添加了这几行:
目录类别(非锚定)
产品列表工具栏
在
导航/left.phtml
中:
这是我的自定义工具栏模板-
toolbar\u custom.phtml
:
在layout/catalog.xml文件下,对默认部分进行更改
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
将上述代码包含在此参考零件中
<reference name="left">
<block type="catalog/navigation" name="catalog.categorymenu" before="cart_sidebar" template="catalog/navigation/left_catalog.phtml"/>
</reference>
您可以在块中使用自己的toolbar.phtml文件我也遇到了同样的问题。这对我很有用:
在
块的layout/catalog.xml中,插入:
然后,在需要工具栏的left.phtml中:
<?php
$toolbar = $this->getChild('catalog_product_list')->getToolbarBlock();
$toolbar->setCollection($this->getChild('catalog_product_list')->getLoadedProductCollection());
echo $toolbar->toHtml();
?>
只需像这样重命名块:
<block type="catalog/product_list_toolbar" name="product_list_toolbar_custom" template="catalog/product/list/toolbar_custom.phtml"/>
<action method="setToolbarBlockName"><name>product_list_toolbar_custom</name></action>
产品列表工具栏自定义
将此添加到布局中:
<catalog_category_layered translate="label">
<reference name="left">
<!-- Adds the toolbar to the left column -->
<block type="catalog/category_view" name="category.page.toolbar" template="catalog/category/sidetoolbar.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml" />
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
<!-- We use the original toolbar - you could also write your own -->
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
</reference>
</catalog_category_layered>
此解决方案显示工具栏,但对排序顺序应用类别限制,即
<?php
// lets get the toolbar block
$toolbar = $this->getChild('product_list')->getToolbarBlock();
// add the product collection
$toolbar->setCollection($this->getChild('product_list')->getLoadedProductCollection());
?>