Skip to content

Instantly share code, notes, and snippets.

@ho-nl
Created September 9, 2010 22:11
Show Gist options
  • Save ho-nl/572695 to your computer and use it in GitHub Desktop.
Save ho-nl/572695 to your computer and use it in GitHub Desktop.
$dateToday = date('m/d/y');
$tomorrow = mktime(0, 0, 0, date('m'), date('d')+1, date('y'));
$dateTomorrow = date('m/d/y', $tomorrow);
$this->_productCollection
->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $dateToday))
->addAttributeToFilter('special_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $dateTomorrow),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left');
$this->_productCollection
->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $dateToday))
->addAttributeToFilter('special_to_date', array('date' => true, 'from' => $dateTomorrow));
$this->_productCollection = $layer->getProductCollection();
class Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_Abstract
<reference name="content">
<block type="catalog/product_specials" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><categoryid>2</categoryid></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager">
</block>
</block>
</block></reference>
class Mage_Catalog_Block_Product_Specials extends Mage_Catalog_Block_Product_Abstract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment