Magento site with multiple store setup, different root category for each store, yet all products are visible from anywhere within the same website. Product url rewrites are enabled.

Say I'm browing a store in my Magento site, and I navigate to a category page:

example.com/furniture/living-room.html

Say I bookmark this link for later, or to share on social networks. Then I switch stores and go to Electronics. I look at some items and then go away. My session saves the last store I visited. I then come back by click the url on Facebook, or by going to the bookmark. I get a 404 Error because the category page for Furniture / Living-room doesn't exist in Electronics. The router doesn't find any categories of that name in that store so it redirects to noroute. If I switch back to the first store manually (through the store switcher) and try the link again it works just fine.

How can I switch to the appropiate store so that the category page will display correctly? My guess is it would have to be before the url is passed to the routers but I don't know whether that's possible.

With products it is not the case; I can still view the product but I stay in the different store (electronics) so I would also like to be able to switch the store automatically.

Just by looking at the url http://example.com/furniture/living-room.html I cannot tell if it's a product url or a category url from the code. If I knew what I was trying to look at, I could find the appropiate store from the root category and switch to it programmatically.

Note: I do know how to switch stores programmatically. I just need to figure out how to do it from a rewriten url.

有帮助吗?

解决方案

Sounds like you want System > Config > Web > Add Store Code to URLs. This should track the site you are on in the URL query string.

许可以下: CC-BY-SA归因
scroll top