当我加载产品页面时,它在系统日志文件中显示错误,如下所示..
2013-03-12T10:28:56+00:00 ERR (3): Recoverable Error: Method SM_Vendors_Model_Mysql4_Vendor_Collection::__toString() must return a string value in C:\xampp\htdocs\magento\app\code\local\SM\Vendors\Block\Adminhtml\Catalog\Product\Render\Vendor.php on line 21
我的代码就像..
app\code\local\SM\Vendors\Block\Adminhtml\Catalog\Product\Render\vendor.php
class SM_Vendors_Block_Adminhtml_Catalog_Product_Render_Vendor extends Varien_Data_Form_Element_Abstract
{
public function getElementHtml()
{
$vendorCollection = $this->getVendorCollection(); //line#21
}
public function getVendorCollection()
{
$collection = Mage::getResourceModel('smvendors/vendor_collection')->__toString();
return $collection;
}
}
app\code\local\SM\Vendors\Model\Mysql4\Vendor\Collection.php
class SM_Vendors_Model_Mysql4_Vendor_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('smvendors/vendor');
}
public function __toString()
{
return $this->_init('smvendors/vendor');
}
}
我想解决magento系统日志文件中这种类型的错误显示。如果您知道,请回复。