*/ class Mage_Rss_Helper_Order extends Mage_Core_Helper_Abstract { /** * Check whether status notification is allowed * * @return bool */ public function isStatusNotificationAllow() { if (Mage::getStoreConfig('rss/order/status_notified')) { return true; } return false; } /** * Retrieve order status history url * * @param Mage_Sales_Model_Order $order * @return string */ public function getStatusHistoryRssUrl($order) { return $this->_getUrl('rss/order/status', array('_secure' => true, '_query' => array('data' => $this->getStatusUrlKey($order))) ); } /** * Retrieve order status url key * * @param Mage_Sales_Model_Order $order * @return string */ public function getStatusUrlKey($order) { $data = array( 'order_id' => $order->getId(), 'increment_id' => $order->getIncrementId(), 'customer_id' => $order->getCustomerId() ); return base64_encode(json_encode($data)); } /** * Retrieve order instance by specified status url key * * @param string $key * @return Mage_Sales_Model_Order|null */ public function getOrderByStatusUrlKey($key) { $data = json_decode(base64_decode($key), true); if (!is_array($data) || !isset($data['order_id']) || !isset($data['increment_id']) || !isset($data['customer_id']) ) { return null; } $orderId = intval($data['order_id']); $incrementId = intval($data['increment_id']); $customerId = intval($data['customer_id']); /** @var $order Mage_Sales_Model_Order */ $order = Mage::getModel('sales/order')->load($orderId); if (!is_null($order->getId()) && intval($order->getIncrementId()) === $incrementId && intval($order->getCustomerId()) === $customerId ) { return $order; } return null; } }