Magento – Deleted Shop view causes Category 404

Photo of author
Written By Ryan Rana





Right, that is the best title I can come up with so that any poor soul who was struggling with what I’ve just been struggling with can hopefully find this and get some answers. There wasn’t much else out there on this that I could find.

Magento Website/Store Name/Store View issues. One of the biggest selling points of Magento is the ability to run what, from the outside, look like multiple e-commerce installations all from the same base installation. By this we mean different stores which can look totally different, possibly have different urls but can also potentially share a cart, share account details, promotional info, customer groups. All good stuff.

I’ve just completed a site that used a single website, but had two Store Names each with one Store View. The complexity of the backend code and the setup meant that, when another Magento job came along right after with an identical specification, I decided to replicate the site rather than rebuild it from scratch, and reskin the theme. This new site only had one Store Name and one Store View though – ‘Hey, no problem thought I – I can just delete any references to the second Store and delete it’.

Easy, right? Wrong, this is Magento we are dealing with. All went fine but from then on in the frontend the category views all gave 404s with no error or exception logging at all. Product pages were fine, CMS all fine. This is after indexing, re-indexing, hours playing around with categories and the System -> Configuration -> General -> Web -> URL options (turning the ‘Add store code to URL to ‘No’, it had been set to yes in the multi store – I did a post on that too).

Reloaded the database umpteen times, tried removing one store view, then the other, then I was in PHPMyAdmin messing around with the core_store_group and core_store tables. All to no avail. Finally found this post by Fabrizio Branca. Great post, link to his module, very informative and you look down at the comments and see it’s quite recent and…..hold on – there’s a comment from Vinai Kopp saying how good he thinks it is and he’s going to use it in his training. Sold!! That’s more than good enough for me. So I was about to install it when I tried one last thing which of course worked. So if you’ve not died of boredom by now here it is.

Create a completely new root category in your Catalogue -> Manage Categories. Add a new Store Name in the existing website view and then create a new Store View too. Then in the website view assign the new Store Name to be the default Shop (thanks for helping to muddy things with your inconsistent terminology Magento) for that site. Now delete the original two (or more) Store Names and their respective Views. Re-index. That works.

Leave a Comment