0

我有一个在 Magento 中创建页面的模块。由于我无法在 CMS 页面中复制模块的功能,因此我想转换模块以生成使用 CMS 模型进行页面输出的页面。我正在查看控制器,这段代码看起来很有希望,但我不确定我会改变什么。谁能帮我?

        // Setup layout handles
    $this->getLayout()->getUpdate()
        ->addHandle('default')
        ->addHandle('custompage_map');

    $this->addActionLayoutHandles();

    $this->loadLayoutUpdates();
    $this->generateLayoutXml()->generateLayoutBlocks();

    foreach (array('catalog/session', 'checkout/session') as $class_name) {
        $storage = Mage::getSingleton($class_name);
        if ($storage) {
            $this->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
        }
    }

    // Render our layout
    $this->renderLayout();
}
4

1 回答 1

0

看一看 @

/app/code/core/Mage/Cms/controllers/IndexController.php

将您的控制器方法替换为

public function noRouteAction($coreRoute = null)
{
    $pageId = {cms page key};
    if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
        $this->_forward('defaultNoRoute');
    }
}
于 2013-11-13T19:03:50.023 回答