2013-10-24 64 views
0

我已经加入这个:如何在自定义页面中调用magento模块?

echo $this->getLayout()->createBlock('core/template')->setTemplate('sales/order/history.phtml')->toHtml(); 

到mypage.phtml,但它给

Fatal error: Call to a member function getSize() on a non-object in C:\xampp\htdocs\puckerimages_cvs\app\design\frontend\default\pucker\template\sales\order\history.phtml on line 41 

谁能告诉我如何调用核心模块控制器中的自定义页面

+0

似乎还有下居住功能的getSize() history.phtml和你定义的块,即“核心/模板”无法找到它的定义。这就是错误发生的原因。请分配其相关的块。 – aforankur

回答

0

试试这个

,而不是 “核心/模板” 使用 “销售/ order_history

<?php echo $this->getLayout()->createBlock('sales/order_history')->setTemplate('sales/order/history.phtml')->toHtml();?> 

希望这有助于你

+0

它的作品!万分感谢 !! (y)的 –

2

我不知道正是你试图做的..控制器是什么,但你的网段。 如果你想摆脱地址控制器使用下面的代码,

Mage::app()->getRequest()->getControllerName(); 

Mage::app()->getRequest()->getActionName(); 

Mage::app()->getRequest()->getRouteName(); 

Mage::app()->getRequest()->getModuleName(); 

如果你想从你的模块使用下面的代码数据的收集,

Mage::getModel('groupname/classname'); 

Mage::getSingleton('groupname/classname'); 

示例

$collection = Mage::getModel('module/model_name')->getCollection() 
    ->addAttributeToSort('order', 'ASC') 
    ->addAttributeToSort('last_name', 'ASC') 
    ->addAttributeToSort('first_name', 'ASC') 
; 
+0

我想在我的自定义页面中调用history.phtml。但是当它接到电话时它会给出致命的错误。你能否建议我如何将history.phtml调用到其他phtml文件,以便我们可以使用history.phtml页面的核心功能? –

+0

请参阅此链接.... http://alanstorm.com/layouts_blocks_and_templates – Elavarasan

相关问题