Magento Forum

   
catagory_id ignored when multiple catalog/product_list block elements on same CMS page
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

I used this handy approach for adding products from different categories to my store home page. The problem is that the 2nd block element shows the same products although the category_id is different.

{{block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"}} 
{{block type
="catalog/product_list" category_id="9" template="catalog/product/list.phtml"}}
Although the 2nd block has category_id set to 9 it shows the products from category_id 8.

Might this be a bug in the CMS module or a caching issue? I actually disabled all caching in the whole store.

Any pointers as to what I might be missing here would be very much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

As you have discovered, the method in the wiki only works for one block. I have added a note about it to the wiki page.

To get several blocks of products on the homepage, one way is to create your own custom block classes that loads products from specific categories.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

Thanks for the pointer, Anders.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

I finally figured out how to use multiple blocks on the same page with different category IDs and updated the Wiki entry accordingly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Good work, Nick. Simple and easy solution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreladocruz
Guru
 
Total Posts:  322
Joined:  2008-05-07
Brazil
 

friends,

after upgrading to 1.2.0.1 this code is not function anymore.

any help In how to solve it?

regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
istvan
Jr. Member
 
Total Posts:  2
Joined:  2009-01-14
 

I’d really like to know if someone has a solution to making this work in 1.2.0.1 as well!

Would this method be the one to use instead to create a featured products list/block?

http://www.magentocommerce.com/wiki/how_to_create_a_featured_product

 
Magento Community Magento Community
Magento Community
Magento Community
 
istvan
Jr. Member
 
Total Posts:  2
Joined:  2009-01-14
 

I’ve managed to get this working in 1.2.0.1

For some reason setting the category_id as an attribute for the block does not work. Just as a guess I did it this way, and it worked:

<block type="catalog/product_list" name="product_featured" as="product_featured" template="catalog/product/featured.phtml">
<
action method="setCategoryId"><category_id>18</category_id></action
</
block>

Note: This goes into the Layout Update XML field under the Custom Design tab of the CMS page.

The other criteria turned out be that the category had to be in the root category. I can not be a root category itself.

This is a bummer, as it means it’s showing up in my category nav. I’m not sure how to stop it from showing in the admin area, so for now I’m going to add an exclusion for this category ID in my category navigation template file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mattmac
Jr. Member
 
Total Posts:  1
Joined:  2008-04-10
 

I just updated to 1.2.1 and was able to get this working without any code changes.  I did have to move my Featured category inside my root category.  But I left it as inactive so it doesn’t show up in the list.  All worked well.

-Matt

<a href="http://www.ourpromiserings.com/">Our Promise Rings</a>

 
Magento Community Magento Community
Magento Community
Magento Community
 
niknik
Member
 
Total Posts:  32
Joined:  2008-10-17
 

Can anyone help me understand why using a single:
{{block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"}}

The product list doesn’t actually match the products in that category?

For example:
if select cat_id ‘8’ in the magento website through the drop-down menus, it shows me a list/grid view of 50 products.
but, if I do it on a custom blank page with that “product_list” block, it shows just 45 products.

(if I go to the admin section->manage categories each category shows the right products...)

I have 3 category levels; but even for categories in the same level, some of them show most of the produts, while others show just a few, and others show no products at all.
Can’t find a reason why - can anyone suggest any ideas to debug this (of fix it?)

(Using Magento 1.1.8)

 
Magento Community Magento Community
Magento Community
Magento Community
 
highrockmedia
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-11-25
Boston
 
niknik - 01 April 2009 07:32 AM

Can anyone help me understand why using a single:
{{block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"}}

The product list doesn’t actually match the products in that category?

I seem to be having a similar issue, I just created a post here:
http://www.magentocommerce.com/boards/viewthread/55072/

 
Magento Community Magento Community
Magento Community
Magento Community
 
brtsos
Jr. Member
 
Total Posts:  5
Joined:  2011-04-13
 

Hi !

This is my code in page.xml :

<block type="catalog/product_list" name="recommended" template="catalog/product/list.phtml">
            <
action method="setCategoryId"><category_id>9</category_id></action>
            <
action method="setColumnCount"><columns>4</columns></action>
</
block>

It’s ok in all page without product view page. I get error 404.

Help me please.

regards
Bartek

 
Magento Community Magento Community
Magento Community
Magento Community
 
timsco
Jr. Member
 
Total Posts:  1
Joined:  2010-06-14
 

I used the following html in my page and got it to work in Magento ver. 1.5.0.1, but I transferred it to my clients page which uses Magento ver. 1.4.2.0 and now it only displays the first category twice.  I guess there’s a difference in how this block is handled in the different versions or something.  Any suggestions?

<div class="home_prods">{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}</div>
</div>
<div class="home_prods">{{block type="catalog/product_list" category_id="6" template="catalog/product/list.phtml"}}</div>
</div>

 
Magento Community Magento Community
Magento Community
Magento Community
 
gregbron
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2011-07-13
 

Here is the solution:

Products Listing Widget is a powerful Magento Widget which allows limitless publishing product blocks in any place of your Website. Advanced user can adjust the widget\’s design.
Products can be inserted into cms pages using blocks, but also can be inserted to any place of the website using xml files.

There is Software-Smart-Solutions.com where you will get the solution for this problem and for some other problems with magento.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AJytzler
Sr. Member
 
Avatar
Total Posts:  138
Joined:  2011-08-28
 

How do i show a list with all the categories??

//Anders J.

 
Magento Community Magento Community
Magento Community
Magento Community
 
qubaish
Jr. Member
 
Total Posts:  1
Joined:  2012-05-29
 

hi every one........
i want to give multiple category id only in one block type ?????
how it is possible ??
plzz some one help to me ...... thnx

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top