CatID=-1 when click into product details

Dec 2, 2009 at 11:48 PM

Hi, I found the link to the product details has a catgoryid peremeter in it, but it's seems always to be -1. I would like to use product category module to display as a breadbrumb, and I noticed it reads the categoryid so can work correctly. So is there any way we can make product links always include correct categoryids?

btw, the link with categoryid = -1 only happens when I choose to display product from all categories

Dec 3, 2009 at 7:27 AM


This is because the products list category your clicking from is the "All Category" (-1)  category, or maybe the featured only category.   Because you can have a product in multiple categories it's only possible to pickup the CatID from the category the product was clicked from.  If you want catid to be passed to the detail page you'll have to make the product list default to a specific category not just the "All Categories".

Hope this make sounds confussing even for me!!



Dec 3, 2009 at 10:43 PM

Yeah, Thanks Dave, it makes perfect sense to me. Just wondering, if I want to get the catID for a product, is there a function I can use? e.g. get catID according to productID?

Dec 4, 2009 at 9:25 AM

No not really, because you've got the same problem of 1 product being in many categories...the only thing you could perhaps do is select all the categories a product belongs to.  (unless you use the tax category, then you get a 1 to 1 relationship)


Dec 7, 2009 at 1:36 AM

Yeah, No problem, I can use tax category for now. Thanks Dave.