Magento Forum

   
How to add a default route for products
 
danpowered
Jr. Member
 
Total Posts:  9
Joined:  2008-05-01
 

Id like to know how i could add a default route for all products, such ass

http://domain.com/products/sku

(the sku part is obviously replaced by a sku here).

If the product exists it goes straight to the product details page, if not, it goes to an error page.

I read about the zend framework routing, i found the classes and everything, but i have not figured out how to add this route yet.  Maybe someone already did that.

I need it to be automatic for all products, so using the “url rewriting management” is pretty much out of the question, unless i didnt see some option.. I have far too many products to do them all one by one.

Thanks a lot!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TechNWeb LLC
Member
 
Avatar
Total Posts:  44
Joined:  2008-10-29
Austin, TX
 

Is there a way to do this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

url rewrite is pretty much an option,

<global>
<rewrite>
<sku_rewrite>
<from><![CDATA[#^/products/(.+)#]]></from>
<to>/catalog/product/view/sku/$1</to>
<complete>1</complete>
</sku_rewrite>
</rewrite>
</global>

and of course you will have to rewrite the controller to load product by sku code

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top