在totals.phtml之外的结帐中查找礼品卡代码

时间:2012-02-08 18:51:18

标签: magento magento-1.5

在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 Enterprise礼品卡模块,而不是unirgy礼品卡模块。

2 个答案:

答案 0 :(得分:0)

试试这个:

    $_cards = Mage::getModel('enterprise_giftcardaccount/giftcardaccount')->getGiftCards();

答案 1 :(得分:0)

您使用过getCards()助手类吗?

$cards = Mage::helper('enterprise_giftcardaccount')->getCards($this->getOrder());