Magento – Special Price From Date and To Date

magento-1.14pricespecial-price

I'd like to directly query sku, special price, special price from date, special price to date from database.

We are offering special sale every week with different items. Sale items are supposed to have from date and to date. Unfortunately many of them are missed to date. We haven't cleared old/previous sale information for a long time. So I don't know how many items are on sale now.

Please advise me.

Best Answer

You may use following code

$collection=Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('sku')
            ->addAttributeToSelect('special_price')
            ->addAttributeToSelect('price');
$collection->addAttributeToFilter('special_from_date',array(array('from' => Mage::getModel('core/date')->gmtDate()),
                                 array('special_from_date', 'null'=>true)));
$collection->addAttributeToFilter('special_to_date',array(array('to' => Mage::getModel('core/date')->gmtDate()),
                                 array('special_to_date', 'null'=>true)));
Related Topic