Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
How do I list 2 different categories on homepage
 
Luc
Jr. Member
 
Total Posts:  15
Joined:  2007-08-31
 

Hello,

I was developping some code to be able to display products from different categories on home page.

I’ve have the following problem : only the first category is list even if correct category id is set.

So I check my code, but I was unable to find the problem. Then I tried ‘core code’ with the following blocks on home page :

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

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

The first block shows correct products of the category (id=5) but the second block show the products of the previous category (id=5) and not the products of the awaiting category (id=6).

I mention that no cache is used on our development plateform.

Any idea ?

Luc

 
Magento Community Magento Community
Magento Community
Magento Community
 
Luc
Jr. Member
 
Total Posts:  15
Joined:  2007-08-31
 

Hello,

Could someone try this code in the homepage CMS and confirm there is only one category listed instead of the four awaiting ?

{{block type="catalog/product_list" category_id="1" num_products="5" template="catalog/product/list.phtml"}}
{{block type
="catalog/product_list" category_id="2" num_products="5" template="catalog/product/list.phtml"}}
{{block type
="catalog/product_list" category_id="5" num_products="5" template="catalog/product/list.phtml"}}
{{block type
="catalog/product_list" category_id="6" num_products="5" template="catalog/product/list.phtml"}}

You have to configure the cotegory_id according to you catalog.

I would like to understand why the four blocks display the products of the first categroy_id.

Luc

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hey Luc,

That’s correct - I realized the same categories are showing over and over again.

Haven’t tested enough to see what works - but I confirm that what you’re finding is true.

An alternative would be this (until this “issue” gets addressed and fixed):
Create a new category, and add whatever products you want to that category (simply by going into the product’s settings and adding it to the category). Then, display the one, new category via:

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

(but change the “category_id” appropriately)

Thanks,
- Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ron Phillips
Member
 
Total Posts:  57
Joined:  2008-04-16
 

Creating an alternate category doesn’t seem like a useful solution especially if the design calls for categories to be separate on the homepage.

 
Magento Community Magento Community
Magento Community
Magento Community
 
double02
Jr. Member
 
Avatar
Total Posts:  28
Joined:  2007-12-08
Los Angeles, CA
 

I am having the same problem.

I am thinking using xml update instead would work.

Has anybody added more than one category to their frontpage using xml update?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Luc
Jr. Member
 
Total Posts:  15
Joined:  2007-08-31
 

Hi,

XML update won’t change the ‘strange’ beaviour.

I’ve asked magento but, for the moment, no answer.

I’ve tried to developp my own block but, same result, the following code returns a collection of products of the first categoryId used.

$layer Mage::getSingleton('catalog/layer');
            
            
$category Mage::getModel('catalog/category')->load($this->getCategoryId());
            
$layer->setCurrentCategory($category);
            
            
$productCollection $layer->getProductCollection();

Any Idea ?

Luc

 
Magento Community Magento Community
Magento Community
Magento Community
 
double02
Jr. Member
 
Avatar
Total Posts:  28
Joined:  2007-12-08
Los Angeles, CA
 
Luc - 15 May 2008 12:54 AM

XML update won’t change the ‘strange’ beaviour.

What code did you use for XML update?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Hi, Luc, we’re currently making catalog blocks more flexible so multiple blocks could be shown on same page.

This update will be available in next release.

If it will be possible easily to update existing version, we will post a patch.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Luc
Jr. Member
 
Total Posts:  15
Joined:  2007-08-31
 

Hi Moshe,

Thanks for your reply. I hope a patch will be available before the next release.

Luc

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdb
Sr. Member
 
Avatar
Total Posts:  223
Joined:  2007-11-13
coastal California, USA
 

that sounds like a pretty cool / useful feature, i’m glad its being worked on

 
Magento Community Magento Community
Magento Community
Magento Community
 
a0z0ra
Jr. Member
 
Total Posts:  8
Joined:  2008-05-14
 

Hi, is this feature available already?  Did anyone manage to get this working w/ Magento ver. 1.0.19870.1?

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 

Hi Moshe, Has this made it into 1.1?  or is this going to be in later releases?

Thanks
John

 
Magento Community Magento Community
Magento Community
Magento Community
 
brianpat
Member
 
Total Posts:  44
Joined:  2008-04-05
 

I also get the same problems. It doesn’t work even in new fresh latest 1.1.1 installation. Magento should look for a permanent fix

 
Magento Community Magento Community
Magento Community
Magento Community
 
skitpt
Jr. Member
 
Total Posts:  17
Joined:  2008-05-09
 

Same thing here, latest magento release. Isnt there a fix for this ? Is it that hard ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 

Hi - I have this sorted - Have a look at post : http://www.magentocommerce.com/boards/viewthread/11561/

This solved this for me.  I just overloaded the Model, Helper and Block.

Thanks
John

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

Well, if the M team is supposedly to have been working on this it should be available… but only one of them can say for sure. What’s the word?

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