*/ class Mage_Rss_Block_Order_Status extends Mage_Core_Block_Template { protected function _construct() { /* * setting cache to save the rss for 10 minutes */ $this->setCacheKey('rss_order_status_'.$this->getRequest()->getParam('data')); $this->setCacheLifetime(600); } protected function _toHtml() { $rssObj = Mage::getModel('rss/rss'); $order = Mage::registry('current_order'); $title = Mage::helper('rss')->__('Order # %s Notification(s)',$order->getIncrementId()); $newurl = Mage::getUrl('sales/order/view',array('order_id' => $order->getId())); $data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8', ); $rssObj->_addHeader($data); $resourceModel = Mage::getResourceModel('rss/order'); $results = $resourceModel->getAllCommentCollection($order->getId()); if($results){ foreach($results as $result){ $urlAppend = 'view'; $type = $result['entity_type_code']; if($type && $type!='order'){ $urlAppend = $type; } $type = Mage::helper('rss')->__(ucwords($type)); $title = Mage::helper('rss')->__('Details for %s #%s', $type, $result['increment_id']); $description = '

'. Mage::helper('rss')->__('Notified Date: %s
',$this->formatDate($result['created_at'])). Mage::helper('rss')->__('Comment: %s
',$result['comment']). '

' ; $url = Mage::getUrl('sales/order/'.$urlAppend,array('order_id' => $order->getId())); $data = array( 'title' => $title, 'link' => $url, 'description' => $description, ); $rssObj->_addEntry($data); } } $title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt())); $url = Mage::getUrl('sales/order/view',array('order_id' => $order->getId())); $description = '

'. Mage::helper('rss')->__('Current Status: %s
',$order->getStatusLabel()). Mage::helper('rss')->__('Total: %s
',$order->formatPrice($order->getGrandTotal())). '

' ; $data = array( 'title' => $title, 'link' => $url, 'description' => $description, ); $rssObj->_addEntry($data); return $rssObj->createRssXml(); } }