<?php
    // Old Code comment
    //$_todaysProductCollection = Mage::getResourceModel('catalog/product_collection')
    //->addAttributeToSelect('*')
    //->addCategoryFilter($_category)
    ////->addAttributeToSort('created_at','DESC')
    //->addAttributeToSort('position','ASC')
    //->addAttributeToFilter('status', 1)//enabled
    //->addAttributeToFilter('visibility', 4)
    //->addAttributeToSelect('is_active');
    //$_todaysProductCollection->load();
     
    //echo "date time :".date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
    $currentDateTime=date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
     
    $todayStartOfDayDate  = Mage::app()->getLocale()->date()
    ->setTime('00:00:00')
    ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     
    $todayEndOfDayDate  = Mage::app()->getLocale()->date()
    ->setTime('23:59:59')
    ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     
    /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
    $_todaysProductCollection = Mage::getResourceModel('catalog/product_collection');
    $_todaysProductCollection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
    $objNew= new Mage_Catalog_Block_Product_New();
    $_todaysProductCollection = $objNew->_addProductAttributesAndPrices($_todaysProductCollection)
    ->addStoreFilter()
    ->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $currentDateTime))
    ->addAttributeToFilter('news_to_date', array('or'=> array(
    0 => array('date' => true, 'from' => $currentDateTime),
    1 => array('is' => new Zend_Db_Expr('null')))
    ), 'left')
    ->addAttributeToSort('news_from_date', 'desc')
    ->setPageSize(9)
    ->setCurPage(1);
     
    $_columnCountToday = 3;
    $todayCnt=0;
    foreach($_todaysProductCollection as $_todayproduct)
    {
        $_todayproduct = Mage::getModel('catalog/product')->load($_todayproduct->getId());
        echo $_todayproduct->getId().'</br>';
    }
     
?>

Categories: Magento

1 Comment

Rathna Kumar · May 22, 2015 at 7:58 pm

Hai I have my Twillio api code that is

ACCOUNT SID:
AC561a6a9054e02ee833ff106e03355ccc
AUTH TOKEN:
cc960ca19d87a3e8ce2cdfd22a6057f0
How can i integrate with my magento store for order notification?
Please guide me i am new to magento.

Leave a Reply

Avatar placeholder

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