获取定期配置文件的购物车总金额

Get cart total amount for recurring profile

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

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

我正在尝试 运行 的代码在我的 class 中,它在 submitRecurringProfile() 中实现了 Mage_Payment_Model_Recurring_Profile_MethodInterface

如何在创建订单之前获得总价值(经常性配置文件和运费)?

这段代码很简单returns '0':

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

当你看

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(); // 获取总价

}