0

In my Customization , i have more than 100 categories under Default Category so I want to Display all the categories in multiple pages with images Homepage - Magento.

Im Using the below code :

   <div class="category-products">
   <ul class="products-grid">
   <?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
if ($categorycount == 0){
$class = "first";
}
elseif ($categorycount == 3){
$class = "last";
}
else{
$class = "";
}
 ?>
<li class="item <?=$class?>">
  <a href="<?php echo $_category->getURL() ?>" title="<?php echo   $this->htmlEscape($_category->getName()) ?>"><img src="<?php echo $_category->getImageUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" /></a>
   <h2><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
  </li>
 <?php
endif;
if($categorycount == 3){
$categorycount = 0;
echo "</ul>\n\n<ul class=\"products-grid\">";
}
else{
$categorycount++;
}
   endforeach;
   endif;
   ?>
  </ul>
    </div>      

In this code im just getting only product with images but not in proper manner (not aligned) please anyone query me how to Display all the categories in multiple pages with images Homepage .

Silviaa
  • 475
  • 8
  • 35

1 Answers1

0

To display in Multiple page you will need to use some pagination techniques ,

to display the product categories do refer

How to create Categories Grid (list) with images

epynic
  • 1,124
  • 2
  • 14
  • 26
  • Just now tried on a 1.8 installation with sample data works fine . Can you post the error or a SS – epynic Sep 27 '13 at 11:47
  • Browse Products getIsActive()): ?> Fatal error: Call to a member function getId() on a non-object in E:\xampp\htdocs\magento\app\design\frontend\base\default\template\catalog\navigation\subcategory_listing.phtml on line 9 – Silviaa Sep 27 '13 at 12:33
  • Im using Magento 1.7.0.2 – Silviaa Sep 27 '13 at 12:34
  • foreach ($_categories as $_category):?> if($_category->getIsActive()): ?> load($_category->getId()); ?> setCurrentCategory($cur_category); ?> if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?> – Silviaa Sep 27 '13 at 13:00