********************************
get product max and min price by current category (product Filter ) magento
*********************************
<?php
$max_price=Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMaxPrice();
$minPrice=Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMinPrice();
?>
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT max(price) as max_price ,min(price)as min_price FROM catalog_product_index_price ORDER BY customer_group_id');
$rows = $result->fetch();
$max_price = $rows['max_price'];
$min_price = $rows['min_price'];
get product max and min price by current category (product Filter ) magento
*********************************
<?php
$max_price=Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMaxPrice();
$minPrice=Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMinPrice();
?>
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT max(price) as max_price ,min(price)as min_price FROM catalog_product_index_price ORDER BY customer_group_id');
$rows = $result->fetch();
$max_price = $rows['max_price'];
$min_price = $rows['min_price'];
No comments:
Post a Comment