Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

How to get the product url for a specific category? 
Total Posts:  41
Joined:  2008-04-17

I am customizing catalog/product/list.phtml to add a lightbox instead of going to the product page.

So I have used css to strip the page template away if the product is loaded from the “lightbox” category.

So now all I need to do is get the url to the product in the lightbox category instead of the one in the current list category. ie. that would be $_product->getProductUrl()

So say my product url key is “abc123”, then I want “” returned.

In the API I can see that there is a function that maybe I should be calling.. $_product->getUrlPath($category)
But how do I get the $category object to be the “Default Category/Lightbox” category?

Also am I on the right track with the getUrlPath function? If I could just get the url key from the $_product I think it would be much better on performance (ie. no database, no object instantiation, etc..) and I will just hard code the url.

Help, I am a so close it is not funny! tongue laugh (just my PHP newbie status is holding me back)

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