Step1) Create a statics block
Block Titl= Home Category,
Identifier =home_category
and Content=
{{block type="core/template" category_id="3" template="catalog/category/homcategory.phtml"}}
Step2) create a homcategory.phtml file in location app\design\frontend\base\default\template\catalog\category\homcategory.phtm
write a code:
<?php
$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
echo $this->getCategoryId();
$_category=Mage::getModel('catalog/category')->load($this->getCategoryId());
$thumburl = Mage::getBaseUrl('web').'media/catalog/category/'.$_category->getThumbnail();
?>
<ul>
<li class="item">
<div class="catimage"><a href="<?php echo $_helper->getCategoryUrl($_category) ?> ">
<img src="<?php echo $thumburl; ?>" alt="thumb" />
</a></div>
<h2 class="product-name"><a href="<?php echo $_helper->getCategoryUrl($_category) ?>" title="<?php echo html_entity_decode($_category->getName()) ?>"><?php echo html_entity_decode($_category->getName()) ?></a></h2>
<p class='read-more'><a href="<?php echo $_helper->getCategoryUrl($_category) ?>" title="<?php echo html_entity_decode($_category->getName()) ?>">Read More</a></p>
</li>
</ul>
Step3) call Static Block in homepage: CMS->Pages edit Home Page and add code in Content
{{block type="cms/block" block_id="home_category"}}
Block Titl= Home Category,
Identifier =home_category
and Content=
{{block type="core/template" category_id="3" template="catalog/category/homcategory.phtml"}}
Step2) create a homcategory.phtml file in location app\design\frontend\base\default\template\catalog\category\homcategory.phtm
write a code:
<?php
$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
echo $this->getCategoryId();
$_category=Mage::getModel('catalog/category')->load($this->getCategoryId());
$thumburl = Mage::getBaseUrl('web').'media/catalog/category/'.$_category->getThumbnail();
?>
<ul>
<li class="item">
<div class="catimage"><a href="<?php echo $_helper->getCategoryUrl($_category) ?> ">
<img src="<?php echo $thumburl; ?>" alt="thumb" />
</a></div>
<h2 class="product-name"><a href="<?php echo $_helper->getCategoryUrl($_category) ?>" title="<?php echo html_entity_decode($_category->getName()) ?>"><?php echo html_entity_decode($_category->getName()) ?></a></h2>
<p class='read-more'><a href="<?php echo $_helper->getCategoryUrl($_category) ?>" title="<?php echo html_entity_decode($_category->getName()) ?>">Read More</a></p>
</li>
</ul>
Step3) call Static Block in homepage: CMS->Pages edit Home Page and add code in Content
No comments:
Post a Comment