如何在自定义页面中调用magento模块?

如何在自定义页面中调用magento模块?,magento,controller,Magento,Controller,我补充说: 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\

我补充说:

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

有人能告诉我如何在自定义页面中调用核心模块控制器吗?

我不知道您到底想做什么..控制器只是您的url段。 如果要从Url获取控制器,请使用以下代码

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

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

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

Mage::app()->getRequest()->getModuleName();
如果要从模块中获取数据收集,请使用以下代码:

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

范例

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

使用“销售/订单历史记录”代替“核心/模板”



希望这对您有所帮助

我想在我的自定义页面中调用history.phtml。但当它接到电话时,就会出现致命错误。您能建议我如何调用history.phtml到其他phtml文件,以便我们可以使用history.phtml页面的核心功能吗?似乎history.phtml下有一个函数getSize(),您定义的块即“core/template”无法找到其定义。这就是错误发生的原因。请分配相应的块。它可以工作!!非常感谢!!(y)
$collection = Mage::getModel('module/model_name')->getCollection()
    ->addAttributeToSort('order', 'ASC')
    ->addAttributeToSort('last_name', 'ASC')
    ->addAttributeToSort('first_name', 'ASC')
;
<?php echo $this->getLayout()->createBlock('sales/order_history')->setTemplate('sales/order/history.phtml')->toHtml();?>