Magento – Add product link to the Main Menu

cmsmenuproducturl-rewrite

I followed this tutorial to create a main menu link to a CMS page and everything worked great – this is the Download link.
http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar

I tried to do that same but link to a product page but I get a 404.

Here's what the URL redirects look like:

enter image description here

The first 2 URL redirects are for the download CMS page and work correctly. In this case the ID Path is the URL Key of the download page.

The 2nd two URL redirects are for the product link. Given that we don't have a CMS page to link to I tried setting the ID Path the following, but all resulted in a 404 – (The product id is 19)

  • product/19
  • catalog/product/view/id/19

Is it the ID Path that's causing the problem? What should it be set to?

Best Answer

A rewrite is not a permanent redirect. Rewrites are done at the server, redirects tell the browser to go elsewhere.

For a product URL to work, use the following:

id_path: product/$product_id
options: empty (NULL)
target_path: catalog/product/view/id/$product_id

You can see examples from your own core_url_rewrite table:

SELECT request_path, id_path, target_path
FROM core_url_rewrite
WHERE product_id IS NOT NULL
AND options IS NULL
LIMIT 10;