5
votes

I'm supporting a magento web site. The problem is that product view urls e.g. [link] http://localhost/magento/catalog/product/view/id/23 always return 404.

The category view url e.g. [link] http://localhost/magento/catalog/category/view/id/4 is working fine.

Should I investigate something in code? or in database?

Thanks

4
You are dealing with the Zend-like "router/controller/action" URLs and not the SEO-friendly rewritten URLs so it is almost certainly not a database problem. Perhaps start by looking at Mage/Catalog/controllers/ProductController.php.clockworkgeek

4 Answers

5
votes

1) Try re-indexing data:-

  • Login to admin panel
  • Go to System -> Index Management
  • Select All
  • Reindex

2) Edit the product and see if the following settings are done:-

  • General -> Status = Enabled
  • General -> Visibility = "Catalog, Search" or "Catalog"
  • Inventory -> Stock Availability = In Stock
  • Websites -> "Main Website" is checked

3) Refresh the Cache (System -> Cache Management)

1
votes

I had a similar problem after having the "reports" tables in database emptied of their data.

I found a solution on this page, which worked for me: Magento - 404 error in public product page

The SQL that person provided, fixed the problem in my case:

INSERT INTO report_event_types(event_type_id,event_name,customer_login) VALUES 
(1, 'catalog_product_view', 1), (2, 'sendfriend_product', 1), (3, 'catalog_product_compare_add_product', 1), (4, 'checkout_cart_add_product', 1), (5, 'wishlist_add_product', 1), (6, 'wishlist_share', 1);
0
votes

One thing to check when this is happening is whether the visibility setting for product 23 is set to include "Catalog". It should be either "Catalog" or "Catalog,Search". Otherwise, even if product 23 does indeed exist, you can't use

http://localhost/magento/catalog/product/view/id/23

to get to it.

Visibility for products is set on the Admin->Products->Catalog->edit product screen.

-1
votes

For category products : http://localhost/magento/index.php/catalog/category/view/id/4

For Product View Page : http://localhost/magento/index.php/catalog/product/view/id/23

I hope it'll helpful.