【问题标题】:Looking up Gift Card Codes in Checkout outside of totals.phtml在 totals.phtml 之外的 Checkout 中查找礼品卡代码
【发布时间】:2012-02-08 18:51:17
【问题描述】:

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

【问题讨论】:

    标签: magento magento-1.5


    【解决方案1】:

    你使用了getCards() Helper 类吗?

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

    【讨论】:

    • CLoser 但现在我收到此错误:在第 37 行的 app/code/core/Enterprise/GiftCardAccount/Helper/Data.php 中的非对象上调用成员函数 getGiftCards()跨度>
    • 你应该叫“getCards”吧?
    • 我不这么认为,因为这条线是从 GetCards 类中抽出来的。我的感觉是我需要对 getTotals() 进行等效的 Mage::helper 调用。
    【解决方案2】:

    试试这个:

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

    【讨论】:

    • 和 $_cards = $this->getGiftCards() 一样;没有错误,但也没有结果。
    猜你喜欢
    • 2011-01-06
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 2022-10-07
    • 2015-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多