我需要删除默认的Magento签出并添加自定义签出。问题是没有加载自定义扩展模板。日志未显示任何错误。我附上了截图http://skit.ch/nwpi
代码在这里https://gist.github.com/3636029
这里有两个问题,
块没有渲染?
尽管我已经取消设置了"checkout.onepage"
块,但当我转储整个布局时,它会显示默认的签出布局代码。这是正常行为吗?
问题出在您的控制器上:
$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');