Created
September 12, 2017 16:21
-
-
Save rahuldadhich/7d0b4a974578221672a392f2f420b33c to your computer and use it in GitHub Desktop.
Magento Sale Products
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mage_Catalog_Block_Product_Mylist extends Mage_Catalog_Block_Product_List | |
{ | |
/** | |
* Retrieve loaded category collection | |
* | |
* @return Mage_Eav_Model_Entity_Collection_Abstract | |
*/ | |
protected function _getProductCollection() | |
{ | |
$collection = parent::_getProductCollection(); | |
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); | |
$collection->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate)) | |
->addAttributeToFilter('special_to_date', array('or'=> array( | |
0 => array('date' => true, 'from' => $todayDate), | |
1 => array('is' => new Zend_Db_Expr('null'))) | |
), 'left') | |
->addAttributeToSort('special_from_date', 'desc'); | |
return $collection; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment