Magento – Product pages displaying 404 page

404-pagece-1.5.0.1ce-1.7.0.2productupgrade

We've recently upgraded a site from CE 1.5.0.1 to CE 1.7.0.2, and now all product pages just resolve to a 404 page. This applies for direct links, with the product-url.html after the domain, and also full canonical links. It also applies when we try to access the product by using the full /catalog/product/view/id/1000 URL.

There is, and I imagine its related, an issue with indexing on the site. There are 72k products so indexing is slow at best, but I've still been unable to get all indexes to complete without errors, and currently the Catalog URL Rewrites index is stuck on Processing.

We've tried truncating the core_url_rewrites table, and obviously reindexing everything. We've also created simple plain test products which also don't work.

.htaccess file matches the live, working site, is there anything else we may have missed?


I've now discovered that the product object is still available for me on the 404 page – weird huh? I can access all of the product data using Mage::registry('current_product');, this led me to look at the product view controller, and I discovered that commenting out Mage::dispatchEvent('catalog_controller_product_view', array('product' => $product)); showed the product page.

So I can only think that something is hooked onto this event and causing the page to die – obviously leaving this line commented out isn't a solution as its causing other issues with the product, but should point us in the right direction?

Any ideas would be greatly appreciated, there are no custom modules that listen for this event.


Thanks.

Best Answer

I had a problem that responded well to commenting out the line you suggest too.:

Mage::dispatchEvent('catalog_controller_product_view', array('product' => $product));

so this got me thinking to look for anything using that event, so i did a grep on app/code for catalog_controller_product_view

my results:

not, much, considering the first one is just that which has the line we commented. then i see something in Reports, and that jogs my memory... i didnt think it was necessary but i had emptied the report_* tables during a database merge, this must have been it,

so after restoring those tables from a backup its working again even with the line uncommented... !