Magento: Add categories with images on homepage
Follows the below steps to displaying all categories with images on homepage:
Step1 : Add the code below to your homepage content from admin cms-> pages.
Step1 : Add the code below to your homepage content from admin cms-> pages.
{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list.phtml"}}
Step2:Create a list.phtml file under “/app/design/frontend/yourpackage/yourtheme/template/catalog/category/list.phtml” and add the below given code :
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php $open = $this->isCategoryActive($_category); ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if ($immagine = $this->getCurrentCategory()->getImageUrl()):
?>
<div style="float: left; padding-right: 30px; text-align: center;">
<div class="linkimage">
<p>
<a href="<?php echo $this->getCategoryUrl($_category)?>">
<img src="<?php echo $immagine ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="135" height="135" />
<?php echo $_category->getName()?>
</a>
</p>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
Step3: Clear Cache.
Step4: Done.
Magento: Add categories with images on homepage
Reviewed by Web Technology Funda
on
12:36:00 AM
Rating:
excellent piece of information, I had come to know about your website from my friend kishore, pune,i have read atleast 8 posts of yours by now, and let me tell you, your site gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a lot once again, Regards, all Indian govt jobs, notifications, jobs, results, exam dates, bank jobs, ibps notifications
ReplyDeleteThank you so much Malli... Your site is also Rocking. Good information about Govt. jobs!!!
DeleteThis comment has been removed by the author.
ReplyDelete