2013 August

Category Navigation Listings in Magento

<div id=”leftnav”><?php $helper = $this->helper(‘catalog/category’) ?><?php $categories = $this->getStoreCategories() ?><?php if (count($categories) > 0): ?><ul id=”leftnav-tree” class=”level0″><?php foreach($categories as $category):…

Get The Root Category In Magento

<?php$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();$_category = Mage::getModel(‘catalog/category’)         ->load($rootCategoryId);// You can then get all of the top level categories using:$_subcategories = $_category->getChildrenCategories();?>

Load Products by Category ID

<?php$_category = Mage::getModel(‘catalog/category’)->load(47);$_productCollection = $_category->getProductCollection();if($_productCollection->count()) { foreach( $_productCollection as $_product ): echo $_product->getProductUrl(); echo $this->getPriceHtml($_product, true); echo $this->htmlEscape($_product->getName()); endforeach;}?>

1 4 5 6 13