i want to knew how to Set default store view for country magento 1.9 so if i have 2 store views one for USA and other for UK if visitor from USA open the store it redirect them to USA Store and they also can switch to UK. Thanks.
1 Answers
Looking at your question I deduce you want to manage multiple stores/store-views based on customer's IP Address.
Well default Magento has no functionality like this right now & also not much of any free modules or custom codes out there, but here are a couple of modules to choose from, that can meet your requirements exactly.
http://www.magentocommerce.com/magento-connect/geo-ip-store-view-switcher.html http://www.fmeextensions.com/magento-geo-ip-default-store-view.html
If you're attempting to create a custom module for this, then you need to follow below steps as algorithm:
Fetch the ip address of the customer/visitor.
Determine the country name from the ip address using a webservice call:
Create stores/store-views with country names as their identifiers:
https://docs.nexcess.net/article/how-to-configure-multiple-magento-storefronts.html
Observe the "controller_front_init_before" event (as it is the first event when magento is beginning execution) to redirect your customers to their relevant stores according to their IP Addresses. And also provide link on "Header" section to change their stores just as "language switchers", for which you could override the default language switcher file(base/default) into your theme(themename/default).