On the homepage i have categories with description and 2 latest added products from that specific category.

Now i have it working to display 2 products per category with image and productname but i can't get it working to show the product price also.

This is my code now:

    $_categoryId = explode(' ', $category['id']);

    $count = 0;

    $_productCollection = Mage::getModel('catalog/category')->load($_categoryId)
        ->setOrder('date_added', 'ASC');

    <?php foreach ($_productCollection as $_product): ?>

            $count++; // Note that first iteration is $count = 1 not 0 here.
            if($count <= 3) continue; // Skip the iteration unless 4th or above.

        <li class="category-row-list-item">

            <a class="product-name" href="<?php echo $_product->getProductUrl() ?>">
                <?php echo $this->htmlEscape($_product->getName()) ?>

            if($count == 6) break;
    <?php endforeach ?>

Add this code for price where you want to display it.

echo Mage::helper('checkout')->formatPrice($_product->getFinalPrice());


Hello You can show price by below code

echo Mage::helper('core')->currency($_product->getPrice);

Hope this will help you

  • Thank you for your answer, i've used the first answer on this question
    – n00bly
    Aug 3 '16 at 14:14
  • Should it be: $_product->getPrice()
    – johnsnails
    Apr 3 at 3:03
<?php echo $this->getPriceHtml($_product, true) ?> 

for price rendering price in case if your template uses Mage_Catalog_Block_Product block

If not you can use

 <?php echo Mage::app()->getLayout()->createBlock('catalog/product')->getPriceHtml($_product); ?>

Hope it will help you.

  • Thank you for your answer but this one doesn't work in my case, i've tried but it stays blank :(
    – n00bly
    Aug 3 '16 at 14:13

kindly add price attribute to your collection.


and then add


for show price with out formatting, And if you want to show it with currently you need to add code

<?php echo Mage::helper('core')->currency($_product->getPrice(), true, false);?>
  • Thank you for your answer, i've used the first answer on this question
    – n00bly
    Aug 3 '16 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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