Create a new CMS Block with content set to CMS Block, by going to CMS > Static Blocks, which we will name it as Specials. In the Content tab of that Page, paste the below line of code:
code
{{block type="catalog/product" template="catalog/product/yourfile.phtml"}}
create file app/design/frontend/default/YOUR_THEME/template/catalog/product/yourfile.phtml and past following code.php
<scirpt>
getCurrentCategory()->getId();
$category = Mage::getModel('catalog/category')->load($categoryid);
$collection = $category->getProductCollection();
$todayDate = date('m/d/y');
$tomorrow = mktime(0, 0, 0, date('m'), date('d')+1, date('y'));
$tomorrowDate = date('m/d/y', $tomorrow);
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
$collection->addAttributeToSort('created_at', 'desc');
$collection->addStoreFilter();
$collection->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))
->addAttributeToFilter('special_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $tomorrowDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left');
//$_productCollection->printLogQuery(true)
?>
</script>Share this playbook
