在Magento Enterprise中,购物车中的“删除礼品卡”链接位于total.phtml文件中。我想把这段代码移到block.phtml文件中,这样我就可以使它成为基于我们修改后的购物车布局的文本链接。如果我按原样移动代码,我会得到以下错误:
Fatal error: Call to a member function getGiftCards() on a non-object 问题所在的行是
$_cards = $this->getTotal()->getGiftCards();我知道问题在于无法识别对象调用的getTotal()部分。如果我把它带到
$_cards = $this->getGiftCards();页面将加载,没有错误,但礼品卡代码没有通过。我应该在这里调用哪个适当的对象来让getGiftCard()工作,或者有没有不同的方法可以让我获得附加到block.phtml文件中的报价的所有礼品卡?只是为了澄清,这是Magento企业礼品卡模块,而不是unirgy礼品卡模块。
发布于 2012-02-09 03:24:51
你用过getCards()帮助器类吗?
$cards = Mage::helper('enterprise_giftcardaccount')->getCards($this->getOrder());发布于 2012-02-09 03:16:51
试试这个:
$_cards = Mage::getModel('enterprise_giftcardaccount/giftcardaccount')->getGiftCards();https://stackoverflow.com/questions/9199588
复制相似问题