Ads

Tuesday, June 22, 2010

Get category name and url from product

$product->getCategoryIds() gives array of category
ids which the product is associated to. We can loop through
this array and load each category to get the category name
and url.

getCategoryIds();
/**
* looping through the array of category ids
*/
foreach($categoryIds as $categoryId) {
$category =
Mage::getModel('catalog/category')->load($categoryId);
?>
Category: getCategoryUrl() ?>">getName() ?>


No comments:

Post a Comment