0

I a website setup in magento with 2 store views. 1 store view is the main website with normal product prices 2nd store view is set with country specific products

I want to make sure that anyone who visitied the country specific site is automatically redirected to the main website when they next visit. Even if they saved the specific URL to the country specific store, it would still redirect them to main store. The only condition where they would not be redirected is if they have landed on the site from google shopping.

Is it possible to setup on magento, for it to check the arriving location of the user... If from google* then it would take user to country specific store view else if any other location or URL entered directly in browser or from bookmark, then the user would be redirected to the store view 1 which is main store.

Any help would be much appreciated.

2 Answers 2

0

you can get the referrer url from the request. That's the url where the user comes from.

given that, you could implement an Observer listening for example to the event controller_action_predispatch and set the store when the referrer url matches a specific pattern

0

In index.php you need to add code instead of Mage::run($mageRunCode, $mageRunType);

if(isset($_SERVER["HTTP_REFERER"]) && $_SERVER["HTTP_REFERER"] == "your-link" ){
    Mage::run('country-specific-store-code', 'store');
}else{ 
   Mage::run('your-redirect-store-code', 'store');
}

Your Answer

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

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