Poltu
Poltu

Reputation: 137

Adding static block in home page of magento

I want to show 5 categories "mobile" "laptop" best selleing products","","" from my product listing page to home page..

How to call multiple static blocks in home page...

i have created a static block named mobile and in content i have written the code

{{block type="catalog/product_list" category_id="43"  template="catalog/product/list.phtml"}}

after that i called that block in template page...

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('mobile')->toHtml() ?>

i can only call 1 static block unable to display multiple static blocks....

How can i display?

Upvotes: 2

Views: 17687

Answers (1)

Asif hhh
Asif hhh

Reputation: 1552

just go to admin->cms->page->design-layout page, and update the layout

 <reference name="content">
   <block type="catalog/product_list" name="mobile" template="catalog/product/list.phtml">
    <action method="setCategoryId"><category_id>2</category_id></action>
</block>

  <block type="catalog/product_list" name="laptop" template="catalog/product/list.phtml">
    <action method="setCategoryId"><category_id>3</category_id></action>
</block>

</reference>

OR

write that code to admin->cms->page->content

 {{block type="catalog/product_list" category_id="3"  template="catalog/product/list.phtml"}}
 {{block type="catalog/product_list" category_id="4"  template="catalog/product/list.phtml"}}

Upvotes: 8

Related Questions