问题就出在你的控制器:
$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');
愚蠢的问题:你的模块是否启用? – Kalpesh
布局文件onepagecheckout.xml的放置位置?你能显示文件路径吗? – ceckoslab
@ceckoslab我已经更新了代码。 – blakcaps