2012-02-08 62 views
0

在Magento Enterprise中,购物车中的“删除礼品卡”链接位于total.phtml文件中。我想将此代码移至block.phtml文件,以便根据我们修改的购物车布局将其设置为文本链接。如果我搬过来的代码,是我收到以下错误:在结账之外查找礼品卡代码totals.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礼品卡模块。

回答

0

你使用getCards()辅助类?

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

CLoser,但现在我得到这个错误:调用一个成员函数getGiftCards()在应用程序/代码/核心/企业/ GiftCardAccount /帮助/ Data.php上的非对象在线37 – 2012-02-08 21:29:24

+0

你应该调用“getCards”也许? – ShaunOReilly 2012-02-08 23:23:19

+0

我不这么认为,因为这行被拉出了GetCards类。我的感觉是,我需要对getTotals()进行等效的Mage :: helper调用。 – 2012-02-09 14:38:07

0

试试这个:

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

是否相同$ _cards = $这 - > getGiftCards();没有错误,但没有结果。 – 2012-02-08 19:34:11

+0

尝试下面的OğuzÇelikdemir的代码。 – seanbreeden 2012-02-08 20:48:06