Wednesday, August 01, 2012

Magento Get product description from product Id

Magento: Get the product description in catalog/category list page


/**
* Get the resource model
*/
$resource = Mage::getSingleton('core/resource');

/**
* Retrieve the read connection
*/
$readConnection = $resource->getConnection('core_read');

/**
* Retrieve our table name
*/
$table   =   $resource->getTableName('catalog_product_entity_text');
$query  =   "SELECT value FROM {$table} WHERE entity_id = ". (int)$_product->getId();

//print_r(get_class_methods($readConnection));
/**
* Execute the query
*/
// $readConnection->query($query);
$results   =   $readConnection->fetchAll($query);

/* straight dump to screen without formatting */
//print_r($results);
$description = $results[0]['value'];
?>