Last week, I was working with Magento and trying to set up different store views. Basically, the client needs to set up an individual store view for each country with a different base URL. For example, if your main store’s base URL is www.domain.com, and you have one store view for the USA, its base URL would be www.domain.com/us/.

Everything was going fine, but I encountered an issue with the checkout process. If you go to the US store, add some products to the cart, and then try to check out, you may encounter an issue where the page redirects back to the shopping cart page, either before or after entering the billing information. If you try to check out again, the same process will repeat. Actually, Magento sends the billing information request to the server using Ajax, and sometimes you cannot see the error. However, you can see the error in your exception log file or system log. Unfortunately, while I was testing the issue, I could not see any error message in the exception log or system log, so I did some debugging through the Prototype Ajax function, which communicates with the server for billing information requests.

open opcheckout.js and find below code:

var request = new Ajax.Request(

this.saveUrl,

{

method: ‘post’,

onComplete: this.onComplete,

onSuccess: this.onSave,

onFailure: checkout.ajaxFailure.bind(checkout),

parameters: Form.serialize(this.form)

}

);

and make following changes, so this alert the failure message

var request = new Ajax.Request(

this.saveUrl,

{

method: ‘post’,

onComplete: this.onComplete,

onSuccess: this.onSave,

onFailure: function(transport){alert(transport.responseText)},

parameters: Form.serialize(this.form)

}

);

So, if there is any error, you will see an alert message: “Unable to load the Royal Mail price data csv for ‘$file’. Ensure that the app/ directory is in your include path.”

Actually, the problem I found (in my case, it might be something else for you) is that the Meanbee Royal Mail extension stores the shipping price in a CSV file inside the app/code/community/Meanbee/Royalmail/data folder. When we try to check out from a different store view, and perhaps the base URL is different (here it was something like www.domain.com/us/), the Meanbee function _loadCsv($file) in the Abstract.php class always looks for the file inside the base URL folder. So, it will encounter an invalid file path request error. If you make the following changes in the _loadCsv function, you can fix this error.

$filename = “/app/code/community/Meanbee/Royalmail/data/{$file}.csv”;

//replace above line with

$filename = Mage::getBaseDir(‘app’) . “/code/community/Meanbee/Royalmail/data/{$file}.csv”;

//it will always look from base directory

I cannot able to give any guarantee this will work 100% perfect for you, however this is fixed my issue.