Magento Forum

   
Page 2 of 3
Home page products using layout XML
 
seudo
Guru
 
Avatar
Total Posts:  344
Joined:  2008-04-21
 

Anyone get this to work?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott
Guru
 
Avatar
Total Posts:  333
Joined:  2007-08-31
Northwest Ohio
 

I’d suggest just adding the following line inside your HTML section of the CMS page:

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

Where category_id="3” contains your category id in place of the number 3.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hugoto
Member
 
Avatar
Total Posts:  33
Joined:  2008-08-11
 
Scott - 12 August 2008 01:09 AM

I’d suggest just adding the following line inside your HTML section of the CMS page:

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

Where category_id="3” contains your category id in place of the number 3.

Thank you that works fine, but what about layered navigation? I think would be great if we can put layered navigation on home page, but putting that block in the XML update file throw an ugly error:

Fatal errorCall to a member function getProductCollection() on a non-object in C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Catalog\Model\Layer.php on line 41

using this block:

<reference name="left">
    <
block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</
reference>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott
Guru
 
Avatar
Total Posts:  333
Joined:  2007-08-31
Northwest Ohio
 

That’s a much, much bigger fish to fry… One I will probably fry eventually, but haven’t yet.

cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  177
Joined:  2008-04-16
Cologne, Germany
 

Here’s the Layout Update XML that I’m using to display a category product listing on the home page in Magento 1.4 RC1:

<reference name="content">
    <
block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
        <
action method="setCategoryId"><category_id>[category id here]</category_id></action>
    </
block>
</
reference>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ross
Guru
 
Avatar
Total Posts:  336
Joined:  2007-08-31
Scarborough, North Yorkshire, UK
 

@david - that layout update works on Magento ver. 1.3.2.4 as well, cheers.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SEM Truth
Jr. Member
 
Total Posts:  26
Joined:  2010-04-30
 
BrightEyesDavid - 04 February 2010 11:04 PM

Here’s the Layout Update XML that I’m using to display a category product listing on the home page in Magento 1.4 RC1:

<reference name="content">
    <
block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
        <
action method="setCategoryId"><category_id>[category id here]</category_id></action>
    </
block>
</
reference>

But how would you go about specifying the exact layout or placement within the homepage for the product list in calling it this way?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SEM Truth
Jr. Member
 
Total Posts:  26
Joined:  2010-04-30
 
BrightEyesDavid - 04 February 2010 11:04 PM

Here’s the Layout Update XML that I’m using to display a category product listing on the home page in Magento 1.4 RC1:

<reference name="content">
    <
block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
        <
action method="setCategoryId"><category_id>[category id here]</category_id></action>
    </
block>
</
reference>

Is there a way to then designate where you want this block to display within the homepage layout though?

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  177
Joined:  2008-04-16
Cologne, Germany
 

If you mean placing it within the CMS section of the homepage, I dont think you can. Youd use the method described by Scott above.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SEM Truth
Jr. Member
 
Total Posts:  26
Joined:  2010-04-30
 

What I am trying to overcome is the issue of calling a category list within a CMS block

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

As the above code does not include the pager portion of the toolbar. I.E. page 1, 2, 3, ...

Mainly what I try to accomplish with this method of featuring a product list is having more control over the content layout. I.E. being able to include content above and below the product list.

However when using the blog product list as mentioned, the pagination does not display. Any solutions to what I am trying to accomplish?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nellee
Jr. Member
 
Total Posts:  14
Joined:  2010-04-03
 

guys stumbled across this thread and im not sure if its related to problems im having, running a template that runs flash calling some XML, worked fine in the older version of magento, now upgraded and it just will not work at all, no matter what i do with the flash buttons i get an “undefined” error, could it be anything in magento tripping it up..??? its doing my nut in...!!!!! just makes no sense....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mage Guru
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-07
 

Has anyone had any luck getting pagination working for this?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
SEM Truth
Jr. Member
 
Total Posts:  26
Joined:  2010-04-30
 

In Magento 1.4 which includes the ability to add product descriptions I was able to add content within the category description. I was able to then add an introductory paragraph to the top of each category.

Footer Content
I then updated the Category Layout. Normally when you update a Categories Display Settings to include a CMS Block as well as the Product listing it also displays before the product listing. I simply updated where the CMS Block was showing up so it is now being called under the product listings. which allows me to be able to add content to the footer of the site.

PM me for a quote or follow the tutorial here:
http://www.semtruth.com/customize-the-content-layout-on-magento-category-pages/

 
Magento Community Magento Community
Magento Community
Magento Community
 
pumba
Jr. Member
 
Total Posts:  28
Joined:  2008-05-14
 
BrightEyesDavid - 04 February 2010 11:04 PM

Here’s the Layout Update XML that I’m using to display a category product listing on the home page in Magento 1.4 RC1:

<reference name="content">
    <
block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
        <
action method="setCategoryId"><category_id>[category id here]</category_id></action>
    </
block>
</
reference>

So which .xml file should this layout go to?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ross
Guru
 
Avatar
Total Posts:  336
Joined:  2007-08-31
Scarborough, North Yorkshire, UK
 
pumba - 20 August 2010 09:32 AM

So which .xml file should this layout go to?

@pumba - this doesn’t go in an xml file as such files are usually for more generic layout directives. Just add it in to the “Layout Update XML” field for any CMS page (go to CMS->Manage Pages, edit a page, select Custom Design tab).

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 3