当我尝试在控制器中加载我的块时出现此错误
致命错误:在...中的非对象上调用成员函数 toHtml() 在线...
这是我的 config.xml
<blocks>
<auction>
<class>Custom_Auction_Block</class>
</auction>
</blocks>
我在控制器中使用以下代码调用我的块:
$this->loadLayout();
$autoupdate= $this->getLayout()->getBlock('auction.auto.update')->toHtml();
Mage::register('referrer_url', $this->_getRefererUrl());
$response['autoupdate'] = $autoupdate;
我在拍卖/块/产品/autoupdate.php 中创建块
class Custom_Auction_Block_Product_Autoupdate extends Mage_Core_Block_Template{
}
这是我的布局
<block type="auction/product_view" name="auction_view" template="auction/catalog/product/view.phtml">
<block type="auction/product_autoupdate" name="auction.auto.update" as="auction_autoupdate" template="auction/catalog/product/autoupdate.phtml"/>
</block>
我也尝试在我的块中添加“受保护的函数_toHtml()”。但它不起作用。
任何人都可以帮助我吗?仅供参考,我提前使用 magento 1.6.2.0 Thx :)