【问题标题】:Get cart total amount for recurring profile获取重复配置文件的购物车总金额
【发布时间】:2015-08-03 18:38:07
【问题描述】:

我只是花了几个小时试图获得这个简单的信息:如何获得包含重复配置产品的客户购物车的总数量?

客户刚刚在购物车中添加了一个经常性的配置文件产品,并且已经决定使用哪种运输方式。客户只需点击“下订单”和所有信息即可完成订单。付款方式是这个模块:http://www.magentocommerce.com/magento-connect/custom-payment-methods-1.html 我稍微改了一下,以支持经常性的档案产品。

我试图运行的代码是在我的课堂上实现Mage_Payment_Model_Recurring_Profile_MethodInterfacesubmitRecurringProfile()

我如何在创建订单之前获得总价值(经常性资料和运费)?

此代码简单返回“0”:

$total = Mage::getSingleton('checkout/session')->getQuote()->getTotals();

【问题讨论】:

  • 你在哪个文件上?您使用什么结帐系统?
  • @Claudiu 刚刚在问题中添加了更多详细信息。谢谢

标签: magento magento-1.9


【解决方案1】:

当你看时

interface Mage_Payment_Model_Recurring_Profile_MethodInterface

来自

app\code\core\Mage\Payment\Model\Recurring\Profile\MethodInterface.php

方法有two 参数

  1. Mage_Payment_Model_Recurring_Profile $profile
  2. Mage_Payment_Model_Info $paymentInfo

    public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)

{

$trialamount=$profile->getTrialBillingAmount(); //获取试用金额

$billamount=$profile->getBillingAmount(); // 获取账单金额

$initialamount= $profile->getInitAmount(); // 获取初始金额

$ShippingAmount= $profile->getShippingAmount() // 获取运费

$totalprice=$profile->getShippingAmount() + $profile->getBillingAmount(); // 获取总价

}

【讨论】:

  • Tx @keyur-shar ,但它还没有完成。我分别得到了 Null、订阅值、null。我也需要获取运费。
  • $profile->getShippingAmount() + $profile->getBillingAmount(); 给了我我正在寻找的价值!发送!请编辑您的答案,以便我将其检查为“答案”;)
  • 很高兴听到它可以帮助你@MatheusJardimB,我已经更新了我的答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-11
  • 2012-11-29
  • 2013-11-22
  • 2016-08-04
  • 2021-01-20
相关资源
最近更新 更多