Archive for the ‘Zend Framework’ Category


We can easily display different table values as a column in grid in adminend of magento.

For eg:
I have to add one field for displaying ‘rule_id’, ‘status’, ‘send_date’ field as a columns in customer grid.
//Customer grid collection
$collection = Mage::getResourceModel('customer/customer_collection')

/***From here we can left join with ‘giftcard’ table, join criteria is ‘gf.customer_id = e.entity_id’ and in array we can specifie the ‘rule_id’ as index in column and its values are from table giftcard. i.e ‘gf.rule_id’ and i have grouped with customer primary key i.e ‘e.entity_id’ ***/

'gf.customer_id = e.entity_id',
'rule_id'=> 'gf.rule_id',
'status' => 'IF(gf.status IS NULL,"Unsend","Send")',
'send_date' => 'gf.created_time'

//To add column
Add below

$this->addColumn('created_time', array(
'header' => Mage::helper('giftcard')->__('Coupon Send Date'),
'align' => 'left',
'index' => 'send_date',
'type' => 'datetime',
'gmtoffset' => true

I hope this will help you..
If this post is help you than please do reply,..

Bijal Bhavsar 🙂


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

–Bijal Bhavsar 🙂