简体   繁体   English

magento自定义扩展错误

[英]magento custom extension error

i am creating a custom magento rma extension for client. 我正在为客户端创建自定义的magento rma扩展。 In my controller file when i try to access $this->renderLayout(); 当我尝试访问$this->renderLayout();时,在我的控制器文件中$this->renderLayout(); on a function following error occurred. 在函数上发生以下错误。

Attempt to add an invalid object

#0 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(263): Mage::exception('Mage_Eav', 'Attempt to add ...')
#1 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(1057): Mage_Eav_Model_Entity_Collection_Abstract->addItem(Object(sengar_Rma_Model_Item))
#2 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#3 D:\wamp\www\magentotest\lib\Varien\Data\Collection.php(741): Mage_Eav_Model_Entity_Collection_Abstract->load()
#4 D:\wamp\www\magentotest\app\design\frontend\base\default\template\rma\return\view.phtml(182): Varien_Data_Collection->getIterator()
#5 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\mag...')
#6 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('frontend\base\d...')
#7 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#8 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#9 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#10 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(522): Mage_Core_Block_Abstract->_getChildHtml('rma.return.hist...', true)
#11 D:\wamp\www\magentotest\app\code\core\Mage\Page\Block\Html\Wrapper.php(52): Mage_Core_Block_Abstract->getChildHtml('', true, true)
#12 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Page_Block_Html_Wrapper->_toHtml()
#13 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#14 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#15 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#16 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#17 D:\wamp\www\magentotest\app\design\frontend\base\default\template\page\2columns-left.phtml(48): Mage_Core_Block_Abstract->getChildHtml('content')
#18 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\mag...')
#19 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('frontend\base\d...')
#20 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#21 D:\wamp\www\magentotest\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#22 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#23 D:\wamp\www\magentotest\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput()
#24 D:\wamp\www\magentotest\app\code\local\Sengar\Rma\controllers\ReturnController.php(227): Mage_Core_Controller_Varien_Action->renderLayout()
#25 D:\wamp\www\magentotest\app\code\core\Mage\Core\Controller\Varien\Action.php(419): sengar_Rma_ReturnController->viewAction()
#26 D:\wamp\www\magentotest\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#27 D:\wamp\www\magentotest\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#28 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\App.php(354enter code here): Mage_Core_Controller_Varien_Front->dispatch()
#29 D:\wamp\www\magentotest\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#30 D:\wamp\www\magentotest\index.php(87): Mage::run('', 'store')
#31 {main}

The function currently looks like: 该函数当前看起来像:

$this->loadLayout(); 
$this->_initLayoutMessages('catalog/session'); 
$this->getLayout() ->getBlock('head') ->setTitle(Mage::helper('sengar_rma')->__('RMA #%s', Mage::registry('current_rma')->getIncrementId())); 
$this->renderLayout();

On file: frontend\\base\\default\\template\\rma\\return\\view.phtml, line 182 you're creating collection, which causes error - it have nothing to do with renderLayout(), cause error is thrown by app\\code\\core\\Mage\\Eav\\Model\\Entity\\Collection\\Abstract.php:263. 在文件上:frontend \\ base \\ default \\ template \\ rma \\ return \\ view.phtml,第182行正在创建集合,这会导致错误-与renderLayout()无关,导致错误由app \\ code \\引发core \\ Mage \\ Eav \\ Model \\ Entity \\ Collection \\ Abstract.php:263。 (Collection shouldn't be loaded in view btw., but in Block) - fix that line and collection getting. (不应在视图中加载集合,而应在块中加载)-修复该行和集合的获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM