0
votes

Im using Magento CE 1.6.2..

I am displaying products from THREE different categories on a static page. i have created a copy of list.phtml, removed toolbar from it and renamed it listHome_noToolbar.phtml

I am achieving this by using the following code:

{{block type="catalog/product_list" name="home.catalog.product.listHome_noToolbar" alias="products_by_category" category_id="37" num_products="4" column_count="4" template="catalog/product/listHome_noToolbar.phtml"}}

{{block type="catalog/product_list" name="home.catalog.product.listHome_noToolbar" alias="products_by_category" category_id="38" num_products="4" column_count="4" template="catalog/product/listHome_noToolbar.phtml"}}

{{block type="catalog/product_list" name="home.catalog.product.listHome_noToolbar" alias="products_by_category" category_id="39" num_products="4" column_count="4" template="catalog/product/listHome_noToolbar.phtml"}}

I know the category id and so im using it for displaying the products in a grid.

Now, i want advice and inputs about the following:

1. I want to find out and display the number of products in the category id=37, just before the display of the products. This display will have to be on the static page/ cms page only. What code can i use and how to make this happen?

2. I am calling 3 separate category product grids on this static page. I have been trying to LIMIT product displayed in each grid to 4 only using num_products="4", but this is somehow not working out. How can i achieve this?? i always thought num_products worked !!!!

I have looked at many solutions offered but somehow there appears to be no talk about limiting number of products displayed in a custom list or grid.

This somehow didnt work... was getting a fatal error... Magento Limit Number of Products in Home page

I DO NOT WANT TO ALTER number of products from Magento backend... as this would affect other GRIDs which display all products.

Any help and guidance will be appreciated....

1

1 Answers

5
votes

Found the answer to Qs.1 "Find out and display the number of products in the category id=37"

Thought would share it here:

Add the following lines of code in the listHome_noToolbar.phtml file, at the point where the number of products is required to be displayed..

Note: You can add the following code in your list.phtml file, wherever you want the number of products to be visible..

<?php $_productCollection = $this->getLoadedProductCollection(); 
$count = $_productCollection->getSize(); 
echo $count; ?> 

hope this helps anybody :-)