magento小部件不显示
我有一个模块 Shop_All.xmlmagento小部件不显示,magento,widget,Magento,Widget,我有一个模块 Shop_All.xml <?xml version="1.0"?> <config> <modules> <Shop_Productlists> <active>true</active> <codePool>local</codePool> </Shop_Productlists>
<?xml version="1.0"?>
<config>
<modules>
<Shop_Productlists>
<active>true</active>
<codePool>local</codePool>
</Shop_Productlists>
</modules>
</config>
真的
地方的
widget.xml
<?xml version="1.0"?>
<widgets>
<productlists_suggestion type="productlists/suggestion">
<name>Suggestions</name>
<description type="desc">Shows a product Grid</description>
</productlists_suggestion>
</widgets>
建议
显示产品网格
Suggestion.php
<?php
class Shop_Productlists_Block_Suggestion extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface
{
protected function _beforeToHtml()
{
$this->_prepareData();
return parent::_beforeToHtml();
}
protected function _prepareData()
{
$collection = Mage::getModel("catalog/product")->getCollection();
$collection->setPageSize(3);
$this->getChild("suggestion_notoolbarlist")->setCollection($collection);
}
protected function _toHtml()
{
$html = '...';
return $html;
}
}
确定找到了问题
在my widget.xml中,前面有一个空格
<?xml version="1.0"?>
所以它没有被解析。我认为解析器应该显示一个错误。但他没有