[CODE] Get New Product on Magento

Posted on Posted in Programming, PHP

Below is code for get collection data that contain product with new SKU based on created data..

$catalogCol= Mage::getModel('catalog/product')->getCollection();
//get data that new SKU product
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
->addAttributeToFilter('created_at', array('date' => true, 'from' => $todayDate,'to' => $date));

We can select what attribute that we need to be shown and then if we want to filter based on another attribute, we can use “addAttributeToFilter“.

Hopefully can help you, thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *