View Random Products from a store

0
11
views
Advertisement

Create new PHTML file random_product.phtml at

appdesignfrontendperfinodefaulttemplatecatalogproduct

$_parent_category =  Mage::app()->getStore()->getRootCategoryId();
$storeId = Mage::app()->getStore()->getStoreId();

$_productCollection = Mage::getResourceModel(‘catalog/product_collection’)->addStoreFilter($storeId)->load();
$_items = $_productCollection->getItems();
$_collectionSize = $_productCollection->count();
shuffle($_items); ?>

<?php foreach ($_items as $_Product):

$_product = Mage::getModel(‘catalog/product’)->load($_Product->getId());

// put your listing coding here

<?php endforeach;?>

Now you can put block to call thatfile

{{block type=”catalog/product” template=”catalog/product/random_product.phtml”}}

–Mayank Zalavadia