In Magento 1.9, I Have a custom admin grid.

I have product id in my custom collection. I need to add product name to that collection. How to achieve it?

I am using the following code.

$productTable = Mage::getSingleton('core/resource')->getTableName('catalog/product');
$orders->getSelect()->join( array('product_data'=> $productTable),
'product_data.entity_id = main_table.product_id',

1 Answer 1


You can try this code:

// Get Attribute Id for name attribute
$entityTypeId = 
$prodNameAttrId = Mage::getModel('eav/entity_attribute')
->loadByCode($entityTypeId, 'name')->getAttributeId();

* Join Product SKU and Name into the OrderCollection - Change
collection as per your need

->join(array('prod' => 'catalog_product_entity'),
'prod.entity_id = main_table.product_id',array('sku'))
 ('cpev' => 'catalog_product_entity_varchar'), 
 'cpev.entity_id=prod.entity_id AND 
  cpev.attribute_id='.$prodNameAttrId.'',array('name' => 'value'));

Refer this link


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.