0

We need min. and max. price from specific category products,

we have tried this query,

$productColl_1 = Mage::getModel('catalog/product')->getCollection()
                        ->addCategoryFilter($categoryModel)
                        ->addAttributeToSort('final_price', 'desc')
                        ->setPageSize(1)
                        ->load();
         echo $max_price = $productColl_1->getFirstItem()->getPrice();

Issue is in this its giving only base on base price but not considering special price for getting minimum price.

3

Try this:

<?php
  $productColl_1 = Mage::getModel('catalog/product')->getCollection()
    ->addCategoryFilter($categoryModel)
    ->addAttributeToSort('price', 'desc')
    ->setPageSize(1)
    ->load();

    echo $maxPrice = $productColl_1->getFirstItem()->getPrice();
    echo $minPrice = $productColl_1->getFirstItem()->getMinimalPrice();
         //OR
    echo $minPrice = $productColl_1->getFirstItem()->getSpecialPrice();
?>

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.