There are two unused product list blocks in Magento which can be very useful if you push a few buttons, edit few layouts ..
1. Promotion
Block located in app\code\core\Mage\Catalog\Block\Product\List\Promotion.php
This is basically built in featured product functionality. It reacts to “promotion” attribute which needs to be created, so let’s click
Catalog->Attributes->Manage Attributes->Create New Attribute
Attribute Code: promotion
Scope: Global
Catalog Input Type for Store Owner: Yes/No

Label: Promotion (second tab)
Other params can be left alone, but it’s up to you of course. I also labeled it Promotion just for this article.
Now we need to add created attribute to attribute set, so navigate to
Catalog->Attributes->Manage Attribute Sets
select attribute set you’re using and drag promotion to General group for example.

Now when you’re editing your products, there is new “Promotion” option under General tab.

Products on which you select Yes will be shown on promotion block which can be displayed through layouts with
<block type="catalog/product_list_promotion" name="product_promotion" template="catalog/product/list.phtml"/>
or as cms content with
{{block type='catalog/product_list_promotion' template='catalog/product/list.phtml'}}
This attribute should really be included in default attribute set or in Magento sample data.
2. Random
Block located in app\code\core\Mage\Catalog\Block\Product\List\Random.php
This block loads random product collection from current store.
The fastest way to display it would also be something like
<block type="catalog/product_list_random" name="product_random" template="catalog/product/list.phtml"/>
since it also extends product_list block, however, since it is random product listing, that toolbar has no purpose here, so create phtml that will suit your shop needs, based on catalog/product/list.phtml. For example, i’m using similar Random block to display random products in sidebar.
So long, take care, i’m off …



I use magento 1.5. and I want to show random products on home page. Could you please tell where on the home page information I have to put the code? on the “Custom Layout Update XML” or on the end of “Layout Update XML”?
Best regards
Emilio, in 1.5 you should put this
34
in Design / XML Layout
Hi! I want to set a promotional offer for customer’s depending on there “Date of Birth’s” how can i do that & in my magento its not displaying any of the condition with respect to the Customer. please help me for doing this……
Am a regular reader of your blog but am commenting for the 1st time..I want to add 10 random products from a specific category lets say “Popular” below my main product on the product view page..am struggling for the last three days…any help wud be greatly appreciated…am using latest Magento lite version that u released as an experiment before
@Shashank
catalog.xml
-Category default layout
u can create a new list.phtml and make it show only 10 products
as for the category use “category_id=”"
Thank you for the blog!
Probably following code will help someone to show products randomly from a particular category:
We need to write code for home cms like:
{{block type=”catalog/product_list” category_id=”50″ template=”catalog/product/list_home.phtml”}}
Code:
<?php $_productCollection=$this->getLoadedProductCollection(); $categoryID = $this->category_id; //$categoryID = $this->getCategoryId(); if($categoryID){ $category = new Mage_Catalog_Model_Category(); $category->load($categoryID); // this is category id $collection = $category->getProductCollection(); } else{ $collection = Mage::getResourceModel('catalog/product_collection'); } Mage::getModel('catalog/layer')->prepareProductCollection($collection); $collection->getSelect()->order('rand()'); $collection->addStoreFilter(); $numProducts = $this->getNumProducts() ? $this->getNumProducts() : 1; $collection->setPage(1, $numProducts)->load(); $_productCollection = $this->_productCollection = $collection; ?> <?php if(!$_productCollection->count()): ?> <div class="note-msg"> <?php echo $this->__('There are no products matching the selection. Please provide a category ID.') ?> </div> <?php else: ?> <ul> <?php $_collectionSize = $_productCollection->count() ?> <?php foreach ($_productCollection as $_product): ?> <li> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"> <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(105, 105); ?>" width="105" height="105" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /> </a> </li> <?php endforeach ?> </ul> <?php endif; ?>This code displays a single product.
Hi, promotion products is working fine but…
I have 4 stores and would love to show promotion products for each store specific. Right now its showing all products with the promotion atribute.
Can someone tell me how to do that?
Thanks
hi,
and for the new produts how i display them randomly??