工具栏自定义位置



在将magento从1.7更新到1.9后,我遇到了一个问题。自定义工具栏无法显示。我有一个自定义的工具栏位置,它应该出现在面包屑块中。local.xml 代码

<catalog_category_layered>
<reference name="breadcrumbs">
<block type="catalog/product_list" name="toolbar_only" template="catalog/product/list/toolbar_only.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"></block>    
<action method="setToolbarBlockName">
<name>product_list_toolbar</name>
</action>
</block>            
</reference>
</catalog_category_layered>
<catalog_category_default>
<reference name="breadcrumbs">
<block type="catalog/product_list" name="toolbar_only" template="catalog/product/list/toolbar_only.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"></block>    
<action method="setToolbarBlockName">
<name>product_list_toolbar</name>
</action>
</block>            
</reference>
</catalog_category_default>

在breadcrumbs.html中<?php echo $this->getChildHtml('toolbar_only'); ?>在工具栏_only.phtml getToolbarHtml()中?>var_dump返回空字符串。我尝试了另一种方法来输出工具栏块

<?php 
// lets get the toolbar block
$toolbar = $this->getChild('product_list')->getToolbarBlock();
// add the product collection
$toolbar->setCollection($this->getChild('product_list')->getLoadedProductCollection());
$toolbar->toHtml();
?>

但它也返回空字符串。在自定义位置输出工具栏的正确方法是什么?谢谢

主要问题是在扩展Sugarcode_Bestsellersort中,所以在xml中禁用了它,我得到了快乐。现在完全工作的答案。

local.xml

<catalog_category_layered>
<reference name="breadcrumbs">
<block type="catalog/product_list" name="toolbar_only" template="catalog/product/list/toolbar_only.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"></block>
<action method="setToolbarBlockName">
<name>product_list_toolbar</name>
</action>
</block>
</reference>
</catalog_category_layered>
<catalog_category_default>
<reference name="breadcrumbs">
<block type="catalog/product_list" name="toolbar_only" template="catalog/product/list/toolbar_only.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"></block>
<action method="setToolbarBlockName">
<name>product_list_toolbar</name>
</action>
</block>
</reference>
</catalog_category_default>

工具栏(_only.phtml)

<?php echo $this->getToolbarHtml() ?>

breadcrumbs.html

<?php echo $this->getChildHtml('toolbar_only'); ?>

最新更新