Just another WordPress.com weblog

Create new PHTML file random_product.phtml at


$_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”}}

–Vishal Surani


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: