Sometime you may want to get the child categories from a specified category Id. There is a way to do that
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
| public function getItems() { $categoryId = 3; $category = Mage::getModel('catalog/category')->load($categoryId); $children = $category->getChildrenCategories(); $items = array(); foreach ($children as $child) { $item = new stdClass(); $item->name = $child->getName(); $item->link = $child->getUrl(); $items[] = $item; } return $items;} |
No comments:
Post a Comment