Pasta
Pasta

Reputation: 2491

Magento - Store Views and multiple currencies - Checkout using base currency always

I have a magento website

My problem is that the display currencies work well. Each store view has it's own individual price (no automatic conversion). Everything seems to be working and in order. However, on the final payment emails and actual connection with payment providers (PayPal/Sage). The base currency is always used. Although the display appears in the currency for each store view.

My question is why are the store view currencies not used with PayPal, emails, etc. Although the amounts, display currency, etc work fine?

Upvotes: 2

Views: 3425

Answers (3)

Pasta
Pasta

Reputation: 2491

It turns out that Base Currency can be set on each Store View. However, this option was not presented on the admin side. I had to change the system.xml

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

<label>Base Currency</label>

I have to set the appropriate to change from 0 to 1

<show_in_store>1</show_in_store>

Once this was done, I could see Base Currency under "Currency Options" even within a store view. This now works well and everything seems to be working fine.

No PHP code changes or any additional plugins required.

Upvotes: 1

Alex Ivanov
Alex Ivanov

Reputation: 436

Here it is some solutions. You might custom some codes If you are using 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;
}

Upvotes: 0

Vince
Vince

Reputation: 406

When I had run into this issue with a rather large Magento store, this quick fix worked pretty well for me: Magento knowledge-base paypal base currency tweak

Just note that, that fix probably won't work out of the box but it'll take some tweaking

Upvotes: 0

Related Questions