cancel
Showing results for 
Search instead for 
Did you mean: 

Clicking products sends me to 404 page, while not on backend default website.

Clicking products sends me to 404 page, while not on backend default website.

I've downloaded and used the Codnitive sidebar navigation plugin to populate my left navigation with my products and it worked fine.

A client wanted to have a landing page/home page that allowed you select what store they wanted to view. So I have 3 images which are links. Clicking on these links sends the user to a phtml file that sets a session variable to 1,2 or 3, based on which image you click.

In my header.php, I get the Session variable and use it as an argument and I set the current store view. I do this using: Mage::app()->setCurrentStore($_sessionVariable);

This works fine. When I click on the image, I get sent to the stores homepage which has the appropriate category appearing in the sidebar navigation, ie, clicking on Medical link will send user to the Medical homepage which has the Medical sites default category in the side navigation bar.

So the site switching was working fine up until now. My issue arises when I'm on a website which isn't the one set as default in the magento backend.

For example, if I have set the Medical site to be the default site in System > Manage Stores and I click on the Medical image to go to the Medical website, the correct categories are shown in the side navigation menu and when I click on a product, I get sent to the products page.

But, If for example the Products website is set to default side in System > Manage Stores and I click on the Medical image on the landing page and get sent to the Medical home page, I will have the Medical sites categories in the sidebar, but if I click on a product, I get sent to a 404 page.

So my code is changing the currentStore correctly, but there's an issue with me clicking on products in the sidenavigation, when I'm not on the site that's set to default site in the backend.

Has anyone else has this sort of issue or have any idea what could be causing this issue?