How to display featured product in magento



 $featuredproducts = array();
 $i = 0;
 try {
 $storeId = Mage::app()->getStore()->getId();
 $resource = Mage::getSingleton('core/resource');
 $read = $resource->getConnection('catalog_read');
 $categoryProductTable = $resource->getTableName('catalog/category_product');
 $productEntityIntTable = (string)Mage::getConfig()->getTablePrefix() . 'catalog_product_entity_int';
 $eavAttributeTable = $resource->getTableName('eav/attribute');

 $select = $read->select()
 ->join(array('pei'=>$productEntityIntTable), 'pei.entity_id=cp.product_id', array())
 ->where('ea.attribute_code="fooger_featured_product"'); //this is attribute code

 $featuredproducts = $read->fetchAll($select);
 } catch (Exception $e) {
 // Blank
 if(count($featuredproducts)) :
 foreach($featuredproducts as $data) :
 $prodInfo = Mage::getModel('catalog/product')->setStoreId($storeId)->load($data['product_id']);
 <a href="<?php echo $baseUrl.$prodInfo->url_path ?>" title="View <?php echo $prodInfo->name ?>" target="_blank">
 <img height="114" width="140" src="<?php echo $this->helper('catalog/image')->init($prodInfo, 'image');//->resize(82); ?>" />
 if($i == 3) return; // Total 3 feature products only
 <?php endforeach ?>
 <?php else :?>
 <div>No feature products</div>
 <?php endif ?>


for more magento tutorial visit:

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: