Create a homcategory.phtml inside a
app/design/frontend/your_themes/default/template/catalog/category
copy this code in the .phtml file
<?php
$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
$i=1;
$_category=Mage::getModel('catalog/category')->load($this->getCategoryId());
$thumburl = Mage::getBaseUrl('web').'media/catalog/category/'.$_category->getThumbnail();
?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?> ">
<img src="<?php echo $thumburl; ?>" alt="thumb" height="125" width="115" />
<span class="thumb_title">
<?php echo html_entity_decode($_category->getName()) ?>
</span>
</a>
</li>
<?php if ($i==7):
break;
endif;
$i++;
?>
After doing this Login in magento admin,
Go to CMS > static block - and create a static block
Block Title : Your BLock Name (as you like)
Identifier : your_block_id (as you like)
Status : Enabled / Disbaled .
Click to Show/ hide Editor and copy and past this content in content block
<div class="product_category">
<ul id="style_block">
{{block type="core/template" category_id="3" template="catalog/category/homcategory.phtml"}}
{{block type="core/template" category_id="7" template="catalog/category/homcategory.phtml"}}
</ul>
<h4>Choose from a variety of shirt styles</h4>
</div>
Note :- ( category_id="3") as you show a category in your home page.
after that save block.
And go to the CMS > Pages select a Home Page
and select a Content Tab, Click to Show/ hide Editor
{{block type="cms/block" block_id="your_block_id"}}
and paste this code.
that Done!
Output Look like this...
Refresh your home page and you see the list Category by as your choose....
app/design/frontend/your_themes/default/template/catalog/category
copy this code in the .phtml file
<?php
$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
$i=1;
$_category=Mage::getModel('catalog/category')->load($this->getCategoryId());
$thumburl = Mage::getBaseUrl('web').'media/catalog/category/'.$_category->getThumbnail();
?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?> ">
<img src="<?php echo $thumburl; ?>" alt="thumb" height="125" width="115" />
<span class="thumb_title">
<?php echo html_entity_decode($_category->getName()) ?>
</span>
</a>
</li>
<?php if ($i==7):
break;
endif;
$i++;
?>
After doing this Login in magento admin,
Go to CMS > static block - and create a static block
Block Title : Your BLock Name (as you like)
Identifier : your_block_id (as you like)
Status : Enabled / Disbaled .
Click to Show/ hide Editor and copy and past this content in content block
<div class="product_category">
<ul id="style_block">
{{block type="core/template" category_id="3" template="catalog/category/homcategory.phtml"}}
{{block type="core/template" category_id="7" template="catalog/category/homcategory.phtml"}}
</ul>
<h4>Choose from a variety of shirt styles</h4>
</div>
Note :- ( category_id="3") as you show a category in your home page.
after that save block.
And go to the CMS > Pages select a Home Page
and select a Content Tab, Click to Show/ hide Editor
{{block type="cms/block" block_id="your_block_id"}}
and paste this code.
that Done!
Output Look like this...
Refresh your home page and you see the list Category by as your choose....
No comments:
Post a Comment