以下为标准支付的方法:
第一:打开
app\code\core\Mage\Paypal\Model\Standard.php 约124行
->setCurrencyCode($order->getBaseCurrencyCode())
修改为:
->setCurrencyCode($order->getOrderCurrencyCode())
//把基础货币转换购物车的币种。
第二:打开
app\code\core\Mage\Paypal\Model\Cart.php
修改位置1:约280-284行
将
self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(),
self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(),
self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(),
self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()),
修改为:
self::TOTAL_SUBTOTAL => $this->_salesEntity->getSubtotal(),
self::TOTAL_TAX => $this->_salesEntity->getTaxAmount(),
self::TOTAL_SHIPPING => $this->_salesEntity->getShippingAmount(),
self::TOTAL_DISCOUNT => abs($this->_salesEntity->getDiscountAmount()),
修改位置2:约290-294行
将:
self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(),
self::TOTAL_TAX => $address->getBaseTaxAmount(),
self::TOTAL_SHIPPING => $address->getBaseShippingAmount(),
self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()),
修改为:
self::TOTAL_SUBTOTAL => $this->_salesEntity->getSubtotal(),
self::TOTAL_TAX => $address->getTaxAmount(),
self::TOTAL_SHIPPING => $address->getShippingAmount(),
self::TOTAL_DISCOUNT => abs($address->getDiscountAmount()),
//其实可以看的出来,这里修改的就是取消掉Base的基准方式
//magento的对货币的获取方式为 getBase**** 基准方式
对于免运费的,还需要修改
protected function _validate()
{
……
$referenceAmount = $this->_salesEntity->getBaseGrandTotal();
//修改成: $referenceAmount = $this->_salesEntity->getGrandTotal();
……
}
/*
如果不修改的话,使用免运费跳转到paypal,货币种类是变了,可是价格仍然是基准货币的数字
比如一个商品美元是100,英镑通过汇率转换大约为58.
客户用英镑购买,到了paypal的时候,显示的为100英镑
*/
第三:打开
app\core\Mage\Sales\Model\Order\Payment.php
这是修改从paypal返回到网站的IPN验证。否则即使付款通过返回到网站时会报错。
protected function _isCaptureFinal($amountToCapture)
{
$amountToCapture = $this->_formatAmount($amountToCapture, true);
$orderGrandTotal = $this->_formatAmount($this->getOrder()->getBaseGrandTotal(), true);/修改getBaseGrandTotal()为getGrandTotal()
if ($orderGrandTotal == $this->_formatAmount($this->getBaseAmountPaid(), true) + $amountToCapture)
//—修改getBaseAmountPaid()为getAmountPaid()
{
if (false !== $this->getShouldCloseParentTransaction())
{
$this->setShouldCloseParentTransaction(true);
}
return true;
}
return false;
}
然后登陆后台
选择:系统-》工具-》编译-》运行编译过程。(记得打开编译哦,编译后关了,否则安装插件会报错)
暂时完毕。
不过缺点也这说下,如果有方法修改附加上:
缺点1:
下订单时传递到paypal的物品数量永远为:1(即不管是否购买多件商品)
缺点2:
显示的数量为1,名称为网站名称。不显示详细的商品名称
不会列出多个商品名称。
关于作者