0

We are using 1.9.3.1 with follwing fedex settings

Product Weight : 0.5 kg
Service type : International Priority
Shipping Origin : UAE
Shipping Destination : USA

Our Shipping Fedex account is opened in Dubai. So all the amount is calculated in AED.

The problem is system base currency is setup as EURO and according to current fedex behaviour shipping amount is calculated based on shipping account origin.

So we are getting response in AED which Magento assumes as base currency (EURO) which results wrong calculation.

One solution I got from other resources is to set the base currency of Magento to AED but its a Multistore Website with different currency setup and its live.

Is there any other solution for this or I have to override Fedex Modal and covert the base currency(EURO) to AED on request and AED to base currency(EURO) on response object.

2 Answers 2

1

Changing the base currency seems to be the best solution but unfortunately we cant do it.

So I changed the request price from Euro to AED and then again in response object changed AED to EURO.

This is the file that I overide in local app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php.

So Basically in this file _formRateRequest method sends the rate request to fedex for fetching the shipping price and sends some params like

[DropoffType] => REQUEST_COURIER
[PackagingType] => YOUR_PACKAGING
[ServiceType] => STANDARD_OVERNIGHT
[TotalInsuredValue] => Array
(
   [Amount] => 2200 // Convert this to EURO to AED
   [Currency] => DHS // Convert this to DHS
)

And then _prepareRateResponse this method where I changes the price for shipping rate response back to Euro from AED.

    /* customization */
      $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
      $price = $this->convertCurrencyToBase($baseCurrencyCode,self::LOCAL_COUNTRY_CODE_ORIGINAL,$price);
   /* customization */
    $rate = Mage::getModel('shipping/rate_result_method');
    ....

We can get code of convertCurrencyToBase from anywhere.

And at last I also set same price in _parseXmlResponse method which prepares shipping rate after payment.

1

Its better if we override the modal class of modules.

You can get the tutorials of module override here

https://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/

In your sceneraio

app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php

should be overided.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.