2

Im trying to show a few products on my homepage

I got pretty far using this code:

{{block type="catalog/product_list" name="product_list" category_id="74" column_count="5" num_products="24" mode="grid" template="catalog/product/list.phtml"}}

I also added a display: none; to the css to remove the option and filter thing from the product vieuw block. to let it look more natrual on the homepage

<style><!--
.cms-home .pager, .cms-home .sorter, .toolbar, .pager {
    display: none;
}
--></style>

But my problem is: i can't get more products on it as my average 12.

I already tried:

1>> I tried to let the catolog page use an diffrent "show amount" so instead of 12 i changed it to use 36 with the custom xml bellow. this worked on the catolog path (wich is now offline) but does not work with my block on the homepage (also tried to add this custom xml to the homepage)

<reference name="product_list_toolbar">
 <action method="setDefaultGridPerPage">
<limit>36</limit></action></reference>

2>> I tried alot of extra block options but none of them seems to take effect. few of them are bellow: (there are a few more as this but i cant find them anymore, aslo tried it on amount 36)

products_per_page="50" products_count="50" count="9" limit="9" num_products="24"

3>> edit also tried the following blocks

<p>{{block type="catalog/product_list" name="product_list" category_id="74" column_count="5" count="24" limit="24" mode="grid" template="catalog/product/list.phtml"}}</p>
<p>{{block type="catalog/product_list" name="product_list" category_id="74" column_count="6" count="6" limit="4" mode="grid" template="catalog/product/list.phtml"}}</p>
<p>{{block type="catalog/product_list" name="product_list" alias="products_homepage" category_id="74" template="catalog/product/list.phtml"}}</p>
<p>{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="74" column_count="6" products_per_page="50" products_count="50" count="9" limit="9" num_products="24" template="catalog/product/list.phtml"}}</p>
<p>{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="9" template="catalog/product/list.phtml"}}</p>

4>> edit Tried the following custom xml code:

<reference name="content">
    <!-- Overwrite the view template -->
    <block type="catalog/product_list" template="catalog/product/list.phtml">
      <action method="setLimit">36</action>
 </block>

5>> edit Products per page on grid allowed values. I got 12,24,36 because i need column=3 on my product page with 4 bellow each other.

question: Does anyone knows how to get more as 12 products with this block? or get around it on a different way.

bumped to the homepage by Community 15 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • try this {{block type="catalog/product_list" name="product_list" category_id="3" column_count="6" count="6" limit="4" mode="grid" template="catalog/product/list.phtml"}} – Klettseb May 6 '16 at 8:19
  • hello klettseb, i tried your block and it shows 2 rows of 6 (so still 12 in total and not the 19 as are in the category_id at this moment). I also tried to change some of it in this: column_count="5" count="24" limit="24" but still only showing 12 in total. – Marco de Wit May 6 '16 at 8:32
  • What if you dont use a number in there? like this {{block type="catalog/product_list" name="product_list" alias="products_homepage" category_id="9" template="catalog/product/list.phtml"}} – Klettseb May 6 '16 at 8:35
  • hello Klettseb, just tried your last block and it shows my normal catogory page (without the top part ofcorse becasue of my custom css on the homepage) so it shows 3 X 4 so still 12 total. – Marco de Wit May 6 '16 at 8:39
  • in System > configuration > catalogue > Front End > Products per Page on Grid Allowed Values what values do you have? – Ahmed Elawadi May 6 '16 at 10:58
0

Go to the homepage in the CMS -> Manage pages and add the following code snippet into the editor there

You could also use the same code to drill down into a specific category, by adding the category variable, e.g. be aware that here you have list_custom.phtml so you need to copy this there and just copy the list.phtml.

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="9" template="catalog/product/list_custom.phtml"}}

1) app\design\frontend\default\<your theme>\template\catalog\product copy list.phtml and save as list_custom.phtml

2) Now open list_custom.phtml and search for the following snippet. I have edited the $_columnCount = 4 as I want 4 products in one row and I have 4 products to show in the line if($i == 4) break;. So for you you will need the columntcount you want and then 36 as a break.

<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php //$_columnCount = $this->getColumnCount(); ?>
<?php $_columnCount = 4; ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php 
$_productId = $_product->getId();?>
<?php if($i == 4) break; ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid row">
  • Hello @Klettseb, thankyou for your answer. I tried both the layout update and the block. The block showed 3 x 4 products (as is defauld) and the layout update showed 3 x 4 with an bigger layout, this was also with random products. After that i tried your block with all the extra options as I got on ""2>>"" but still only 12 products and not 19 as are curently in catogory 74. Do you have an other solution? – Marco de Wit May 11 '16 at 12:02
  • My last known option, the other ones used to work for me – Klettseb May 11 '16 at 12:09
  • hello @klettseb, i like to try out your code but i am not that good in php can you please let me on what line nr. i have to put the code? i tried to find if endings but there are atleast 6 of them on the php. (already tried some but only got synax errors on my homepage) i quickly uploaded my list.phtml to: verwarmland.nl/media/wysiwyg/list.phtml for you to see how mine looks – Marco de Wit May 12 '16 at 10:58
  • where you have this line right now <?php /*if ($i++%$_columnCount==0): ?> – Klettseb May 12 '16 at 11:00
0

Follow the below steps:

Step 1: Call below code on cms homepage

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

Step 2: Goto system >> permission >> Blocks >> add block name >> allowed to Yes >> save.

Step 3: Goto System >> Configuration >> Catalog >> Frontend >> add products per page on grid default value "24"(by default 24 products will be display in grid rather than 12 products).

step 4: add limit in your phtml to display fix number of products. Add below code before start

  • tag.

    add below code after end

  • tag

    <?php endif // for 24 product?>
    

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.