[CODE] Get Product That Have “Expired” Special Price on Magento

Posted on Posted in Programming, Magento, PHP

$catalogCol= Mage::getModel('catalog/product')->getCollection();

//get data for special price that expired
->addAttributeToFilter(‘status’, array(‘eq’ => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
->addAttributeToFilter(‘special_price’, array(‘gt’ => 0))
->addAttributeToFilter(‘special_to_date’, array(‘date’ => true, ‘from’ => $todayDate, ‘to’ => $todayDate));

We can select what attribute that we need to be shown and then if we want to filter based on another attribute, we can use “addAttributeToFilter”.

Leave a Reply

Your email address will not be published. Required fields are marked *