【问题标题】:Magento adding Cash on Delivery fee when user select paypal当用户选择贝宝时,Magento 添加货到付款费用
【发布时间】:2015-03-18 00:57:26
【问题描述】:

我在我的 Magento 社区版 1.8 商店中遇到了有时会出现的问题。问题是有时 Magento 会将货到付款费用添加到订单总额中,尽管用户选择了 Paypal 作为付款方式。仅当用户选择 Paypal 作为付款方式时才会发生这种情况并且很少发生。有时甚至通过 Paypal 和 Magento 购买的商品数量也不合规。联系 Paypal 支持没有帮助。

任何帮助将不胜感激 在此先感谢大家

亲切的问候 Steelwork 媒体解决方案

【问题讨论】:

    标签: magento


    【解决方案1】:

    如上所述,将字段设置为零非常有效。但是,它将以零费用在发票和订单中添加一行,这对客户来说可能听起来很奇怪。所以只需添加一个简单的 if 条件来检查所有 Totals.php 块文件中的费用是否为零。

    $amt = $this->getSource()->getServiceCharge();
    $nameAmt = $this->getSource()->getServiceChargeName();
        if ($amt && $amt!=0) {
            $this->addTotalBefore(new Varien_Object(array(
                'code'      => 'service_charge',
                'value'     => $amt,
                'base_value'=> $this->getSource()->getBaseServiceCharge(),
                'label'     => $nameAmt,
                    )), 'service_charge');
        }
    

    【讨论】:

      【解决方案2】:

      我觉得自己像个死灵海报,但我想分享一些关于解决这个问题的想法。

      最近我遇到了同样的问题:用户选择了 PayPal 作为付款方式,但被收取了货到付款的费用。经过一番调查,我发现货到付款模块本身就是罪魁祸首。

      The problem is in module's logic: it adds up COD fee when COD payment method is selected, but it DOES NOT clear that fee from quote, when payment method is changed to another one.因此,在创建订单时,将按原样复制带有 COD 费用的字段。客户无需支付任何费用。

      在这种情况下,最糟糕的是,您在结帐时看不到该费用。它仅按顺序弹出。

      例如,有一部分来自 MSP_CashOnDelivery 模块的代码:

      if (
      ($_helper->getQuote()->getPayment()->getMethod() == $_model->getCode()) &&
      ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
      ) {
          $address->setGrandTotal($address->getGrandTotal() + $amount);
          $address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseAmount);
      
          $address->setMspCashondelivery($amount);
          $address->setMspBaseCashondelivery($baseAmount);
          $address->setMspCashondeliveryInclTax($amountInclTax);
          $address->setMspBaseCashondeliveryInclTax($baseAmountInclTax);
          $quote->setMspCashondelivery($amount);
          $quote->setMspBaseCashondelivery($baseAmount);
          $quote->setMspCashondeliveryInclTax($amountInclTax);
          $quote->setMspBaseCashondeliveryInclTax($baseAmountInclTax);
      }
      

      要解决这个问题,你需要在下面添加以下代码:

      if ($_helper->getQuote()->getPayment()->getMethod() != $_model->getCode())
      {
          $address->setMspCashondelivery(0);
          $address->setMspBaseCashondelivery(0);
          $address->setMspCashondeliveryInclTax(0);
          $address->setMspBaseCashondeliveryInclTax(0);
          $quote->setMspCashondelivery(0);
          $quote->setMspBaseCashondelivery(0);
          $quote->setMspCashondeliveryInclTax(0);
          $quote->setMspBaseCashondeliveryInclTax(0);
      }
      

      【讨论】:

      • 我在使用标准 Magento Cashondeliver 和扩展支付方式时遇到了同样的问题,我认为是同样的问题。谢谢!
      猜你喜欢
      • 2011-07-25
      • 2018-09-01
      • 2019-10-12
      • 2012-04-07
      • 2014-08-15
      • 2011-07-18
      • 2014-04-22
      • 2016-06-17
      • 2013-06-10
      相关资源
      最近更新 更多