Join two table in 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..


how to select customer group on registration in magento

 <group_id><create>1</create></group_id> code into the customer account fieldset.

Before adding code:


Open the file template/customer/form/register.phtml and add the code  in the form
__('Group') ?>*
__('Group') ?>" class="validate-group required-entry input-text" /> getGroups()->toOptionArray(); ?> ">
save value datbase after this line $this->_successProcessRegistration($customer);     $customer->setGroupId($this->getRequest()->getPost('group_id'));

how to get skin folder path in magento

we can use in theme files

echo $this->getSkinUrl('images/logo.png');


get base url

getBaseUrl() => Get base url path e.g.
 Mage::getBaseUrl('media') => Get MEDIA folder path e.g.
 Mage::getBaseUrl('js') => Get JS folder path e.g.
 Mage::getBaseUrl('skin') => Get SKIN folder path e.g.

Get Current URL


Get Home Page URL


Create module your


Get secure URL
To get secure URL you just need to add one more parameter as bellow,


 Directory path Get

 //output : /var/www/html/magento
 //output : /var/www/html/magento/app
 //output : /var/www/html/magento/media

Same way you can get more directory path,
Mage::getBaseDir(‘design’) => Get design directory path
Mage::getBaseDir(‘code’) => Gives code directory file path
Mage::getBaseDir(‘lib’) => Gives lib directory file path
Mage::getBaseDir(‘skin’) => Gives skin directory file path
Mage::getBaseDir(‘var’) => Gives var directory file path
Mage::getBaseDir(‘cache’) => Gives cache directory file path
Mage::getBaseDir(‘log’) => Gives log directory file path

Get URL path in Static Block
Get Base URL

{{base url=''}}

Get Skin URL

{{skin url='images/skinimage.jpg'}}

Get Media URL

{{media url='/mediaimage.jpg'}}

Get Store URL

{{store url=''}}