Mage_Rss_Block_Order_New Class Reference

Inheritance diagram for Mage_Rss_Block_Order_New:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 addNewOrderXmlCallback ($args)

Protected Member Functions

 _construct ()
 _toHtml ()


Detailed Description

Definition at line 34 of file New.php.


Member Function Documentation

_construct (  )  [protected]

Internal constructor, that is called from real constructor

Please override this one instead of overriding real __construct constructor

Please override this one instead of overriding real __construct constructor

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 36 of file New.php.

00037     {
00038         /*
00039         * setting cache to save the rss for 10 minutes
00040         */
00041         $this->setCacheKey('rss_order_new');
00042         $this->setCacheLifetime(600);
00043     }

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 45 of file New.php.

00046     {
00047         $order = Mage::getModel('sales/order');
00048         $passDate = $order->getResource()->formatDate(mktime(0,0,0,date('m'),date('d')-7));
00049 
00050         $newurl = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order', array('_secure' => true, '_nosecret' => true));
00051         $title = Mage::helper('rss')->__('New Orders');
00052 
00053         $rssObj = Mage::getModel('rss/rss');
00054         $data = array('title' => $title,
00055                 'description' => $title,
00056                 'link'        => $newurl,
00057                 'charset'     => 'UTF-8',
00058                 );
00059         $rssObj->_addHeader($data);
00060 
00061         $collection = $order->getCollection()
00062             ->addAttributeToFilter('created_at', array('date'=>true, 'from'=> $passDate))
00063             ->addAttributeToSort('created_at','desc')
00064         ;
00065 
00066         $detailBlock = Mage::getBlockSingleton('rss/order_details');
00067         Mage::getSingleton('core/resource_iterator')
00068             ->walk($collection->getSelect(), array(array($this, 'addNewOrderXmlCallback')), array('rssObj'=> $rssObj, 'order'=>$order , 'detailBlock' => $detailBlock));
00069 
00070         return $rssObj->createRssXml();
00071     }

addNewOrderXmlCallback ( args  ) 

Definition at line 73 of file New.php.

00074     {
00075         $rssObj = $args['rssObj'];
00076         $order = $args['order'];
00077         $detailBlock = $args['detailBlock'];
00078         $order->unsetData()->load($args['row']['entity_id']);
00079         if ($order && $order->getId()) {
00080             $title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
00081             $url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('_secure' => true, 'order_id' => $order->getId(), '_nosecret' => true));
00082             $detailBlock->setOrder($order);
00083             $data = array(
00084                     'title'         => $title,
00085                     'link'          => $url,
00086                     'description'   => $detailBlock->toHtml()
00087                     );
00088             $rssObj->_addEntry($data);
00089         }
00090     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:39 2009 for Magento by  doxygen 1.5.8