Quantcast
Channel: » Tips and Snippets
Viewing all articles
Browse latest Browse all 8

Minimum Product Price in a Category

$
0
0
In this blog post, we will see the faster way to get minimum product price in category

Add this code to your category page where you want to display it.

$layer = Mage::getSingleton('catalog/layer');
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
                if ($category->getId()) {
                    $origCategory = $layer->getCurrentCategory();
                    $layer->setCurrentCategory($category);
                }
$collection = $layer->getProductCollection();
$collection->getSelect()->reset('order');
$collection->getSelect()->order('minimal_price','asc');
$collection->getSelect()->limit(1);

echo $collection->getFirstItem()->getMinimalPrice();

Viewing all articles
Browse latest Browse all 8

Trending Articles