Home > PHP, Programming > [CODE] Get New Product on Magento

[CODE] Get New Product on Magento

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
$catalogCol->addAttributeToSelect('name')
->addAttributeToSelect('price')
->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.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: