id

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:

{{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

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)

?>

About Author:

Kalpesh Chavada

Kalpesh Chavada is Our Founder & CEO of Akshar Group Technologies. He is serving with 11+ years of experience in different technologies like Magento, WordPress, Laravel, jQuery, Shopify, Branding, and Digital Marketing. He is very good with creative logic and always ready to take on challenges.

Kalpesh Author