Pages

Thursday, May 10, 2012

Display product list Randomly and limited numbers in Magento HomePage

Create new file product_list.phtml and copy content from list.phtml to product_list.phtml, log in to your magento admin go to cms -> pages -> home page
paste step1 to contact area. click save.

step 1.

{{block type="catalog/product_list_random"  category_id="4" template="catalog/product/product_list.phtml"}}

now open product_list.phtml use the code below to display 4 products at once

step 2.
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
    if ($_productCollection->count()):
    $_productCollection = $_productCollection->getItems();

    $i = 0;
             foreach ($_productCollection as $_product):
        if ($i < 4):
                             // Product Data With CSS
        endif;
    $i++;
     endforeach;
    endif;

?>
 Now you can show your index page product list randomly with 3 limited number products.

Comment it and share it.

No comments:

Post a Comment