Last week I have been working with Magento and trying to setting up different store view. Basically the client need to setup individual store view for each country with different base url. For example your main store base URL is www.domain.com and you have one store view for USA and its base URL will be www.domain.com/us/.

Everything goes fine but found an issue with checkout process. If you go to US store and add to cart some products and then try to checkout you may encounter an issue ((before or after entering the billing information) the page redirecting back to shopping cart page. Again if you try to checkout the same process will repeat. Actually magento sending billing info request to the server using Ajax sometime you cannot see the error. However you can see the error from your exception log file or from system log. Unfortunately while I was testing the issue I cannot see any error in message in exception log or system log, so I did some debug through prototype Ajax function which communicate with server for billing info request.

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 can see in 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, may be its something else for you) is Meanbee royal mailextension is storing the shipping price in a CSV file inside appcodecommunityMeanbeeRoyalmaildata folder. When we trying to checkout from deferent store view and may be base url will be different. Here it was something like www.domain.com/us/. So the Meanbeen function _loadCsv($file) in Abstract.php class is always look the file inside the base url folder. So it will come across invalid file pathe request error. If you make the following changes in _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.

Written By

Prajosh

Leave a Reply

Your email address will not be published. Required fields are marked *