Magento 模块中的getChild方法不';t似乎指的是一个孩子(?)

Magento 模块中的getChild方法不';t似乎指的是一个孩子(?),magento,module,Magento,Module,我正在我的项目中使用Meanbee模块。我有它的正常工作类别的产品清单。但现在我正试图让它在我定制的模块上激活 然而,我被Script.php中的68行难住了: 66 return ( 67 $block !== false && 68 $block->getChild('toolbar') !== false && // <-- This line 69 $this-&g

我正在我的项目中使用Meanbee模块。我有它的正常工作类别的产品清单。但现在我正试图让它在我定制的模块上激活

然而,我被
Script.php
中的
68
行难住了:

 66       return (
 67           $block !== false &&
 68           $block->getChild('toolbar') !== false && // <-- This line
 69           $this->_getPagerBlock() !== false &&
 70           $this->_getPagerBlock()->getCollection()
 71       );
核心XML(与无限滚动模块一起使用)是:


空的
一栏五
两列左4
两列右4
三列
产品列表工具栏
正如您所看到的,两个XML块都没有具有
工具栏
属性
name
的元素。唯一的区别是行
1


非常感谢您的帮助。

Mage\u Catalog\u Block\u Product\u列表中::\u beforeToHtml()
方法中,使用
setToolbarBlockName
操作指示的名称从布局中检索工具栏块,然后使用
工具栏
别名将其设置为产品列表的子块


在您的例子中,问题可能是,
$block
还没有用
toHtml()
输出,因此它还不知道它的
工具栏子项,或者类似的东西(很难说,因为扩展是商业性的)。

感谢指针,但是如果我要更改的只是XML的第一行,
$block->getChild('toolbar')
不应该返回true吗?刚刚完成了我的回答
        <block type="mynamespace/mymodule" name="mymodule.view" template="mynamespace/mymodule/view.phtml">
            <block type="catalog/product_list" name="product_list" template="toxicfox/giftfinder/list.phtml">
                <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>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>    
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.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">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>