I want show Featured products on my store home page. I added all code but don't see anything on the home page.

Please see the image and help me to fix this

I followed the guides here to create 'featured product' attribute, https://kartikmaniyar.wordpress.com/

enter image description here

This is the template code:

<div id="home-featured">
<h3><?php echo $this->__('Featured products') ?></h3>

$_helper = $this->helper('catalog/output');
$storeId = Mage::app()->getStore()->getId();
$catalog = $this->getLayout()->createBlock('catalog/product_list')->setStoreId($storeId);

$collection = Mage::getModel('catalog/product')->getCollection();
->addAttributeToFilter(array(array('attribute' => 'featured_product', 'eq' => true)));

<?php if(!$collection->count()): ?>

<p><?php echo $this->__('There are no featured products at the moment.') ?></p>

<?php else : ?>

<?php $_collectionSize = $collection->count(); $_columnCount = 4; $i = 0; ?>
<?php foreach($collection as $_product): ?>

<?php $_product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($_product->getId()); ?>
<?php if ($i++%$_columnCount==0): ?>
<?php endif ?>
<a href="<?php echo getCategoryInProductUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<a href="<?php echo getCategoryInProductUrl($_product) ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $catalog->getAddToCartUrl($_product) ?>')">
<span><span><?php echo $this->__('Add to Cart') ?></span></span>
<?php else: ?>
<p><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist') ?></a>
<?php endif; ?>
<?php if($_compareUrl=$catalog->getAddToCompareUrl($_product)): ?>
<a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
<?php endif; ?>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
<?php endif ?>

<?php endforeach ?>
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>

<?php endif ?>


2 Answers 2


I'll assume that you cleared the cache and it is no caching issue.

Since there is no "There are no featured products at the moment" message show, the loaded collection obviously has some items. Except of the unnecessary additional product load there is nothing wrong with your loop as well.

But it is suspicous that I don't see any output below "Featured Products", no footer, etc. This looks like a PHP fatal error that stopped script execution. Check your error logs...

I guess it's because of getCategoryInProductUrl() - if you did not write a function with this name, this will break with an "undefined function" error. You probably meant $this->getCategoryInProductUrl()


You have to create the featured attribute, then assign it to the desired product and last but not least you have to tell the slider to show featured products. The last step can be done through the magento backend under the Joomlart menu item. When i needed to create featured products in the past i did by reading the following tutorial, you can check it out.

how to create featured products

  • no this also not working. how to do this?
    – Mohamed
    May 26, 2015 at 16:57
  • the last time i did it i did that way.
    – vasilisdmr
    May 26, 2015 at 20:14
  • There is no "Joomlart" menu item in Magento Sep 3, 2015 at 6:46

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.