How to create a page which show only subcategory or how to show all category on one page in magento?


Go to the admin
Now follow the step
CMS->PAGES->Add new page
Insert these data in the form

Step 1:- insert in Page Information tab

Titile-> categories
URL Key *-> categories
Status *->Enabled

Step 2:- insert in Content

Content Heading->anything according to you

and paste this code in the textarea box

{{block type="catalog/navigation" name="catalog.categories" template="catalog/navigation/category_listing.phtml"}}

Step 3:- select in Page Layout

Layout *->select  2 columns with right bar

After this save the page

Now add new page and in this directories

App/design/frontend/base/default/templates/catalog/navigation/ category_listing.phtml

And add this code in this page

<?php
$_category  = $this->getCurrentCategory(); 
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper     = Mage::helper('catalog/category');
?>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php 
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();  
?>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()" width="120"/>
<cite><?php echo $cat->getName();?></cite>
</a>

<?php endif?><br/>
<?php endforeach;?>

Comments