Hi I new to magento so this may be obvious to most experienced devs
How do i find get all the categories that a product is in. Do i need to use collections?
I have a product model which am using like $product = Mage::getModel('catalog/product')->load() and giving the product id as parameter to load()
Now i need the category objects a product is in
please help
asked Jul 29, 2012 at 10:13
user1560805
1 Answer 1
You are correct in assuming the use of collections. Luckily for you, the product model exposes a convenient method precisely for this: getCategoryCollection()
You would use as follows:
$categoryCollection = $product->getCategoryCollection();
answered Jul 29, 2012 at 10:19
Drew Hunter
10.1k2 gold badges42 silver badges49 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default