I am looping through each sub-category and spitting out its name,url,image etc.

But I also want to show a "From £XX" for each sub category I show.

What is the best/cleanest method for doing this? My current code is below:

$currentCat = Mage::getModel('catalog/category')->load('4');
$subCategories = $currentCat->getChildrenCategories();

foreach ( $subCategories as $subCategory )
        echo'<h3><a href="'.$subCategory->getUrl().'">'.$subCategory->getName().'</a></h3>';
          echo'<a href="'.$subCategory->getUrl().'">';
          echo'<img src="'.Mage::getBaseUrl('media').'catalog/category/'.$subCategory->load($subCategory->getId())->getImage().'" alt="Budget Stove" />';
          echo'<div class="pl_prod_price">From <span>&pound;00.00</span></div>';


3 Answers 3


Try using the below code to get lowest price in subcategory

$product = Mage::getModel('catalog/category')->load($subCategory->getId())
 ->setOrder('price', 'ASC') //sets the order by price 

echo $product->getFinalPrice();

This is an old post but I also want to answer to flag some issues.

The first issue with @Narayan's answer is that he has sorted by price and not by finalprice which is wrong.

The issue with @AmitBera's answer is that he has taken the product collection instead of the category collection, also $collection->getFirst(); is wrong this should be $collection->getFirstItem();.

So here is your final answer

$collection = Mage::getModel('catalog/category')->load($yourcategory_id)
$collection->getSelect()->order("price_index.final_price ASC") // Sort Collection by ASC price
->limit(1) ;
$LowestPricedproduct= $collection->getFirstItem(); 
echo Mage::helper('core')->currency( $LowestPricedproduct->getFinalPrice() , true, false); 


First thing need to understand that Price is an attribute of product and not an attribute of catgory.

If want to get lowest of price,then you

  • should call product collection of that category
  • and get lowest price from that collection
  • Sort that Collection by final_price.

$collection = Mage::getResourceModel('catalog/product_collection'); $collection->addMinimalPrice()->addFinalPrice() ->addTaxPercents(); $collection->getSelect() ->order("price_index.final_price ASC") // Sort COllection by ASC
->limit(1) $LowestPricedproduct= $collection->getFirst(); $LowestPricedproduct->getFinalPrice();

  • "an attribute of product and not an attribute of product" so what is it then? Jun 7, 2016 at 13:50
  • @AndreFerraz,thank for notice .. it should be an attribute of product and not an attribute of category". Typo mistake
    – Amit Bera
    Jun 7, 2016 at 14:15
  • Hi @AmitBera your answer help me, but there are few errors if you allow me then I would like to update your answer . Apr 17, 2017 at 11:55

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.