Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Group
- Fruit
- Apple
- Mango
- Banana
- protected function _getItemsData() {
- $key = $this->getLayer()->getStateKey() . '_SUBCATEGORIES';
- $data = $this->getLayer()->getAggregator()->getCacheData($key);
- if ($data === null) {
- $categoty = $this->getCategory();
- /** @var $categoty Mage_Catalog_Model_Categeory */
- $categories = $categoty->getChildrenCategories();
- $this->getLayer()->getProductCollection()
- ->addCountToCategories($categories);
- $data = array();
- foreach ($categories as $category) {
- $subcategories = $category->getChildrenCategories();
- foreach ($subcategories as $subcategory) {
- if ($subcategory->getIsActive() && $subcategory->getProductCount()) {
- $data[] = array(
- 'label' => Mage::helper('core')->escapeHtml($subcategory->getName()),
- 'value' => $subcategory->getId(),
- 'count' => $subcategory->getProductCount(),
- 'parent' => $category->getName(),
- );
- }
- }
- }
- //exit;
- $tags = $this->getLayer()->getStateTags();
- $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
- }
- return $data;
- }
- www.demo.com/fruit.html?cat=5 //5 is Apple category id
- www.demo.com/fruit.html?cat=3 //3 is Fruit category id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement