Created
February 26, 2014 12:07
-
-
Save cristianstan/9228402 to your computer and use it in GitHub Desktop.
Magento: Limit number of products shown on homepage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Magento: Limit number of products shown on homepage, list.phtml ?> | |
1) app\design\frontend\default\<your theme>\template\catalog\product | |
copy list.phtml and save as list_new.phtml | |
2) <?php //Now open list_new.phtml and search '' after ending the if loop insert this code ?> | |
<?php if($i<=4): // for 4 product?> | |
3) <?php //Now open list_new.phtml and search '' after ending the if loop insert this code ?> | |
<?php endif // for 4 product?> | |
<?php // The code will look like this ?> | |
<?php if ($i++%$_columnCount==0): ?> | |
<ul class="products-grid"> | |
<?php endif ?> | |
<?php if($i<=4): // for 4 product?> | |
<li class="item<?php if(($i-1)%$_columnCount==0): ?>"> | |
// some code here | |
</li> | |
<?php endif // for 4 product?> | |
2) Now go to CMS>Pages>select home page >content> and copy this code (change your categy id here) | |
{{block type="catalog/product_list" name="product_list" category_id="<category id>" column_count="4"mode="grid" template="catalog/product/list_new.phtml"}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not working in magento 1.9.1 can you suggest an alternative method?