0
votes

I need to display all the Products assigned to Categories on Home Page of my website like below.

Category A      Category B      Category C          
----------      -----------     ----------              
Product A       Product B       Product C

In CMS > Home Page > Content section I have included the block

{{block type="catalog/product_list" name="homeproduct_list" template="catalog/product/list.phtml"}}

Here catalog/product/list.phtml is the default Magento list.phtml without any modifications.

My products are displayed on Home Page only if I assign any product to a Category as well as Default Category (Root Category)

For ex: Product A is assigned to Default Category (Root) and Categopry A as well

If I assign the product only to a Category (which I want) then it does not show any products on Home Page.

The issue here is not this one How to display ALL PRODUCTS in the homepage? but why is that I have to assign product to Default Category (Root) also in order to display it on home page.

Thanks.

1

1 Answers

0
votes

Because when you have look into database table catalog_category_entity it will store all category id like first must be root category/subcategory/subcategory[if] and when you fetch so,you have to first must assign root category then its subcategory

$product->getCategoryIds() it will get all category id please check image

Image