Monday, 6 August 2012

Display Category with image

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list_category.phtml"}}
 
And also you need to create a list.phtml file under 
“/app/design/frontend/default/default/template/catalog/category/list_category.phtml”

and add the below given code to it: 



  1. foreach ($this->getStoreCategories() as $_category): ?>
  2.  $open = $this->isCategoryActive($_category); ?>
  3. $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
  4. $layer = Mage::getSingleton('catalog/layer');
  5. $layer->setCurrentCategory($cur_category);
  6. if ($immagine = $this->getCurrentCategory()->getImageUrl()):
  7. ?>
  8.  echo $this->getCategoryUrl($_category)?>">
  9.  echo $immagine ?>" alt=" echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="135" height="135" />
  10. echo $_category->getName()?>
  • endif; ?>
  • endforeach; ?>
  • No comments: