在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礼品卡模块。
CLoser,但现在我得到这个错误:调用一个成员函数getGiftCards()在应用程序/代码/核心/企业/ GiftCardAccount /帮助/ Data.php上的非对象在线37 – 2012-02-08 21:29:24
你应该调用“getCards”也许? – ShaunOReilly 2012-02-08 23:23:19
我不这么认为,因为这行被拉出了GetCards类。我的感觉是,我需要对getTotals()进行等效的Mage :: helper调用。 – 2012-02-09 14:38:07