Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento Multi-language Store - Paypal Base currency problem
 
PuxaTino
Jr. Member
 
Total Posts:  27
Joined:  2010-08-16
 

Hi, you all!! I need that Magento, on checkout, passes to Paypal the display currency, instead of the Base currency…

I found the function that gathers all that info before sending to Paypal:
app/code/core/Mage/Paypal/Model/Express/Checkout.php
---------------------------------------------------------------------------------------------------------------------------------------
public function start($returnUrl, $cancelUrl)
{
$this->_quote->collectTotals();

if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) {
Mage::throwException(Mage::helper(’paypal’)->__(’PayPal does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process.’));
}

$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())

->setCurrencyCode($this->_quote->getBaseCurrencyCode())

->setInvNum($this->_quote->getReservedOrderId())
->setReturnUrl($returnUrl)
->setCancelUrl($cancelUrl)
->setSolutionType($this->_config->solutionType)
->setPaymentAction($this->_config->paymentAction)
;
--------------------------------------------------------------------------------------------------------------------------------------------------------

Whithout success, I tried to replace that for different variations:
->setCurrencyCode($this->_quote->getOrderCurrencyCode())
->setCurrencyCode($this->_order->getOrderCurrencyCode())
->setCurrencyCode($currencyCode)

Can anybody guide me here? I´m so close, but so far at the same time… I cant get it to work…

Thanx guys

 
Magento Community Magento Community
Magento Community
Magento Community
 
PuxaTino
Jr. Member
 
Total Posts:  27
Joined:  2010-08-16
 

Any ideas?  I´m stuck here guys!!  Pleaseeeeeeeeeeeeeee

 
Magento Community Magento Community
Magento Community
Magento Community
 
sofiane_php
Jr. Member
 
Total Posts:  8
Joined:  2010-10-19
 

Dear PuxaTino

I found the solution and its 100% working

Like you said go here : app/code/core/Mage/Paypal/Model/Express/Checkout.php

LINE >268<

quote this line : (using //)

//->setCurrencyCode($this->_quote->getBaseCurrencyCode())

and put in the line below this :

->setCurrencyCode($this->_quote->getQuoteCurrencyCode())

Sure it will work enjoy mate.. let me know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PuxaTino
Jr. Member
 
Total Posts:  27
Joined:  2010-08-16
 

Hi sofiane_php, you are a star. I just had tried every possible combination I could come up with and no luck!!
Thank you, it does passes the display currency as I wanted, only problem is that it keeps doing the convertion…
Say that the base currency code is in pounds but the store view currency display is euros so:
If a products costs 50 EUR , then in Paypal shows as 45 EUR.
Do I explain myself? 

This is a real pain, isnt it?… why do not the Paypal API allows you to choose the currency on a StoreView level!!  Most common for a MultiLanguage store is to have more than one currency!! and client wants to pay on that currency he is looking at!

Anyway, that solution does what I wanted it to do, but still stuck with that conversion problem… iI´d appreciate any other idea.

Thanx again

Tino

 
Magento Community Magento Community
Magento Community
Magento Community
 
sofiane_php
Jr. Member
 
Total Posts:  8
Joined:  2010-10-19
 

Hi,, try to set the cyrrency rate under System->manage currency rate to 1 for all currencies.

Regards

 
Magento Community Magento Community
Magento Community
Magento Community
 
PuxaTino
Jr. Member
 
Total Posts:  27
Joined:  2010-08-16
 

thanx again, I thought of that… but I need that currency table properly filled, because it is used in other websites on the same Magento installation.

God this is an endless thing. We figured how to change the currency, but now the problem is on the line right above:
->setAmount($this->_quote->getBaseGrandTotal())

it´s taken whatever amount is on the shopping cart and make the convertion to the Base currency:

I tried to change it to “->setAmount($this->_quote->getGrandTotal())”, but then I get this error saying that the amount on the shoping cart doesnt match the amount that passes, and it doesnt even redirects to Paypal site.

Starting to go mental with this… so complicated to fix, so many things that look at each other!! This should be way way more simple… like allowing you picking the currency you want.

 
Magento Community Magento Community
Magento Community
Magento Community
 
vancouverwill
Jr. Member
 
Total Posts:  11
Joined:  2009-12-02
 

anyone have any luck with this. I have the currency converted to the store currency but the amount is still passed as the base currency. I have tried setAmount() and $result[\\\’amount\\\’] and neither are making any difference.

any help would be much appreciated, thanks

Will

UPDATE:

I have now passed the correct amount over using

$result $api->getStandardCheckoutRequest();

foreach (
$items as $item)
        
{
            $j 
++;
            
$result['amount_'.$j] round($item->getData('price_incl_tax'), 2);    
         
}

$result[
'amount'round($order->getGrandTotal(), 2);
note I did this after getStandardCheckoutRequest, but and this is a big but is IPN is now sending back the displayed currency but Magento is comparing this to the base currency in the IPN module so it sees the wrong amount and thinks it is a fraud attempt
 
Magento Community Magento Community
Magento Community
Magento Community
 
mayo
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2012-02-21
 

Hi,

I copy the file on \app\code\local\Mage\Paypal\Model\standard.php and copy in my local directory, and I replace the code on getStandardCheckoutFormFields() function to be like this:

public function getStandardCheckoutFormFields()
    
{
        $orderIncrementId 
$this->getCheckout()->getLastRealOrderId();
        
$order Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
        
$api Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
        
$api->setOrderId($orderIncrementId)
            ->
setCurrencyCode($order->getOrderCurrencyCode())
            
//->setCurrencyCode($order->getBaseCurrencyCode())
            //$order->getBaseCurrencyCode()
            //->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)
        ;
        
        if (!
$this->_config->lineItemsEnabled{
            $api
->setCartSummary($this->_getAggregatedCartSummary());
        
}
        
//$api->setCartSummary($this->_getAggregatedCartSummary());

        
$result $api->getStandardCheckoutRequest();
        
        
$result['amount'round($order->getGrandTotal(), 2);
        
$result['shipping'round($order->getShippingAmount(), 2);
        
$result['tax'round($order->getTaxAmount(), 2);
        
$j 0;
        
$items $order->getAllItems();
 
        foreach (
$items as $itemId => $item)
        
{
            $j 
++;
 
            
$result['amount_'.$j] round($item->getPrice(), 2);
        
}
 
        $result[
'country'$order->getBillingAddress()->getCountryId();
        
        return 
$result;
    
}

Great! It works for the item prices, but it didn’t work for tax and shipping, they still on base currency.. anybody know how to resolve this problem? :(

sorry for the bad english.. thx before smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
mayo
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2012-02-21
 

Sorry I mean, I copy file from \app\code\core\Mage\Paypal\Model\standard.php

 
Magento Community Magento Community
Magento Community
Magento Community
 
rafitaa
Jr. Member
 
Total Posts:  2
Joined:  2012-09-19
 

PuxaTino, Were you able to resolve this, I am pursuing the same goal as yours, however I am stcuk.

Any ideas for paypal express checkout??

Thank you,

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top