【问题标题】:Magento - Store Views and multiple currencies - Checkout using base currency alwaysMagento - 商店视图和多种货币 - 始终使用基础货币结帐
【发布时间】:2015-02-18 13:00:16
【问题描述】:

我有一个magento网站

  • 我们有一家商店
  • 在一家商店中,我们有多个商店视图(美国、欧盟和英国)
  • 每个商店视图都有自己的货币等。
  • 在默认配置(主要)下,基础货币是英镑

我的问题是显示货币运作良好。每个商店视图都有自己的单独价格(没有自动转换)。一切似乎都在工作并且井井有条。但是,在最终付款电子邮件和与付款提供商 (PayPal/Sage) 的实际联系中。始终使用基础货币。尽管对于每个商店视图都以货币显示。

我的问题是为什么商店视图货币不与 PayPal、电子邮件等一起使用。尽管金额、显示货币等工作正常?

【问题讨论】:

  • 你用的是什么版本? Magento 版本

标签: php magento paypal currency


【解决方案1】:

事实证明,可以在每个商店视图上设置基础货币。但是,此选项未在管理端显示。我不得不更改 system.xml

app/code/core/Mage/Directory/etc/system.xml

<label>Base Currency</label>

我必须设置适当的从 0 更改为 1

<show_in_store>1</show_in_store>

完成此操作后,即使在商店视图中,我也可以在“货币选项”下看到基础货币。这现在运行良好,一切似乎都运行良好。

无需更改 PHP 代码或任何其他插件。

【讨论】:

    【解决方案2】:

    当我在一家相当大的 Magento 商店遇到这个问题时,这个快速修复对我来说效果很好:Magento knowledge-base paypal base currency tweak

    请注意,该修复可能无法开箱即用,但需要进行一些调整

    【讨论】:

    • 您确定这是必需的吗?感觉像是某种必须在 Magento 设置中的东西。
    • Magento 有很多怪癖。他们无法开箱即用地正确处理国际货币,这很荒谬,但这是我能找到解决问题的唯一方法。
    【解决方案3】:

    这里有一些解决方案。 您可能会自定义一些代码 如果您使用的是 Paypal Express, \app\code\core\Mage\Paypal\Model\Express.php

    protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
    {
        $order = $payment->getOrder();
    
        // prepare api call
        $token = $payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
        $api = $this->_pro->getApi()
            ->setToken($token)
            ->setPayerId($payment->
                getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID))
            ->setAmount($amount)
            ->setPaymentAction($this->_pro->getConfig()->paymentAction)
            ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
            ->setInvNum($order->getIncrementId())
            **->setCurrencyCode($order->getOrderCurrencyCode())** // should be used getOrderCurrencyCode();
            ->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
            ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)
        ;
        if ($order->getIsVirtual()) {
            $api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
        } else {
            $api->setAddress($order->getShippingAddress());
            $api->setBillingAddress($order->getBillingAddress());
        }
    
        // call api and get details from it
        $api->callDoExpressCheckoutPayment();
    
        $this->_importToPayment($api, $payment);
        return $this;
    }
    

    \app\code\core\Mage\Paypal\Model\Standard.php

    public function getStandardCheckoutFormFields()
    {
        $orderIncrementId = $this->getCheckout()->getLastRealOrderId();
        $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
        /* @var $api Mage_Paypal_Model_Api_Standard */
        $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
        $api->setOrderId($orderIncrementId)
            **->setCurrencyCode($order->getOrderCurrencyCode())** // should be used getOrderCurrencyCode();
            //->setPaymentAction()
            ->setOrder($order)
            ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
            ->setReturnUrl(Mage::getUrl('paypal/standard/success'))
            ->setCancelUrl(Mage::getUrl('paypal/standard/cancel'));
    
        // export address
        $isOrderVirtual = $order->getIsVirtual();
        $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
        if ($isOrderVirtual) {
            $api->setNoShipping(true);
        } elseif ($address->validate()) {
            $api->setAddress($address);
        }
    
        // add cart totals and line items
        $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
            ->setIsLineItemsEnabled($this->_config->lineItemsEnabled)
        ;
        $api->setCartSummary($this->_getAggregatedCartSummary());
        $api->setLocale($api->getLocaleCode());
        $result = $api->getStandardCheckoutRequest();
        return $result;
    }
    

    【讨论】:

      猜你喜欢
      • 2014-08-11
      • 1970-01-01
      • 1970-01-01
      • 2014-10-16
      • 2012-07-17
      • 2015-06-14
      • 2016-02-26
      • 1970-01-01
      • 2023-03-25
      相关资源
      最近更新 更多