Magento模板未加载

时间:2012-09-05 12:56:38

标签: php magento

我需要删除默认的Magento结帐并添加自定义one.Problem是自定义扩展模板未加载。日志没有显示任何错误。我附加了屏幕截图http://skit.ch/nwpi

代码在这里https://gist.github.com/3636029

这里有两个问题,

块没有呈现?

即使我取消设置"checkout.onepage"块,当我转储整个布局时,它会显示默认的结帐布局代码。这是正常行为吗?

1 个答案:

答案 0 :(得分:2)

问题出在你的控制器上:

$this->getLayout()->getBlock('content')->unsetChildren('checkout.onepage');

请参阅:

Mage_Core_Block_Abstract

/**
 * Unset all children blocks
 *
 * @return Mage_Core_Block_Abstract
 */
public function unsetChildren()
{
    $this->_children       = array();
    $this->_sortedChildren = array();
    return $this;
}

/**
 * Unset child block
 *
 * @param  string $alias
 * @return Mage_Core_Block_Abstract
 */
public function unsetChild($alias)
{
    if (isset($this->_children[$alias])) {
        unset($this->_children[$alias]);
    }

    if (!empty($this->_sortedChildren)) {
        $key = array_search($alias, $this->_sortedChildren);
        if ($key !== false) {
            unset($this->_sortedChildren[$key]);
        }
    }

    return $this;
}

所以你的代码应该是:

$this->getLayout()->getBlock('checkout.onepage')->unsetChildren();

$this->getLayout()->getBlock('content')->unsetChild('checkout.onepage');