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?
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"}}
Related
I need to add the category banner below the Breadcrumbs.
I have tried by adding new reference
<?php echo $this->getChildHtml('category_banner') ?>
in the 2columns-left.phtml
and in local.xml
<catalog_category_view>
<reference name="category_banner">
<block type="core/template" name="topbanner" template="catalog/category/category-image.phtml" before="-"></block>
</reference>
</catalog_category_view>
<catalog_category_default translate="label">
<reference name="category_banner">
<block type="core/template" name="banner" template="catalog/category/category-image.phtml"></block>
</reference>
</catalog_category_default>
But output is not coming.
Added new line inside the all layout i.e 2columns-left.phtml etc.
<?php echo $this->getChildHtml('category_banner') ?>
added below line inside your xml
<catalog_category_view>
<reference name="root">
<block type="core/template" name="category_banner" template="catalog/category/category-image.phtml" before="-"></block>
</reference>
</catalog_category_view>
I'm attempting to rearrange some elements on a webpage and my code won't render it its new position.
The top of the page is handled in view.phtml and the bottom in list.phtml. I'm wanting to move form.phtml from view to list.
The xml looks like this:
<block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
<action method="disableGallery"/>
</block>
<block type="review/form" name="product.review.form" as="review_form" template="review/form.phtml"/>
the view.phtml contains this call:
<?php echo $this->getChildHtml('review_form') ?>
However, no dice. I'm very new to Magento, so any help would be great. I've looked into the following questions and more with no results:
Nested block within a reference not rendering when using ->getChildHtml()
Magento $this->getChildHtml('media') return blank
Call magento template via $this->getChildHtml()
Thanks!
As per as your description,review child block is call in under view then...
it should be
<block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
<action method="disableGallery"/>
</block>
<block type="review/form" name="product.review.form" as="review_form">
<block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
<label>Review Form Fields Before</label>
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
.........
I want to show a category product in a CMS page. For that process I have
to insert the product list of a particular category inside a CMS page, to do it from backend I add a static block like this
{{block type="catalog/product_list"
name="home.catalog.product.list"
alias="products_homepage" category_id="4"
template="catalog/product/list.phtml"}}
How can I do the same thing inside phtml?
To do the same from phtml file, use:
<?php echo $this->getLayout()->createBlock("catalog/product_list")
->setCategoryId(4)->setTemplate("catalog/product/list.phtml")->toHtml();?>
This can be easily achieved through xml
<reference name="content">
<block type="catalog/product_list" name="home" template="catalog/product/list.phtml">
<!-- Product List View -->
<action method="setCategoryId"><category_id>40</category_id></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
Just replace category id with your category id.
I'm a bit of a Magento noob. I have the following code in the Page Layout section of my home page:
<reference name="content">
<block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>8</category_id></action>
</block>
</reference>
How do I change what attribute the products in this block are ordered by?
The order of a product list is generally controlled by the toolbar block Mage_Catalog_Block_Product_List_Toolbar. But if you want to be able to influence the way the product collection is ordered from the layout, you can do the following:
Rewrite the block Mage_Catalog_Block_Product_List and add a function to it:
public function setOrder($attribute, $direction)
{
$collection = $this->_getProductCollection();
$collection->clear()->setOrder($attribute, $direction);
$this->_productCollection = $collection;
}
in the layout update add an action node, e.g.
<reference name="content">
<block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>8</category_id></action>
<action method="setOrder"><attribute>name</attribute><direction>desc</direction></action>
</block>
I am using magento go.
I have created a category and assign 8produts to it, i want to display 4 products in each row but it show 5-products.
Please give me solution.
Thanks
put this code in your category which you want to diplay 4 products, just open your category from admin and open custom design tab and put below code in custom layout update field.
<reference name="product_list">
<action method="setColumnCount"><columns>4</columns></action>
</reference>
Hope this will help you
Go to this path: magento_folder/app/design/frontend/mytheme(your_package)/neo(your_theme)/layout/catalog.xmlWrite this : <action method="setColumnCount"><count>4</count></action>
<catalog_category_default translate="label">
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setColumnCount"><count>4</count></action>
" "
" "
" "
</block>
And after that in the same catalog.xml file below add the same code (under :<catalog_category_layered translate="label"> tag) like this :
<catalog_category_layered translate="label">
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setColumnCount"><count>4</count></action>
" "
" "
" "
</block>
Hope this may help you