/** * Sends any order and pending messages to the display * @param TBT_Rewards_Model_Sales_Order $order */ protected function _dispatchTransferMsgs($order) { $earned_points_string = Mage::getModel('rewards/points')->set($order->getTotalEarnedPoints()); $redeemed_points_string = Mage::getModel('rewards/points')->set($order->getTotalSpentPoints()); if ($order->hasPointsEarning()) { if ($this->_getRewardsSession()->isAdminMode()) { Mage::getSingleton('core/session')->addSuccess(Mage::helper('rewards')->__('%s were approved for the order.', $earned_points_string)); } } return $this; }
/** * Sends any order and pending messages to the display * @param TBT_Rewards_Model_Sales_Order $order */ protected function _processAdminPendingMsgs($order) { $earned_points_string = Mage::getModel('rewards/points')->set($order->getTotalEarnedPoints()); $redeemed_points_string = Mage::getModel('rewards/points')->set($order->getTotalSpentPoints()); if (!$this->_getRewardsSession()->isAdminMode()) { return $this; } if ($order->hasPointsEarning() && !$order->hasPointsSpending()) { $this->_dispatchSuccess(Mage::helper('rewards')->__('The customer was credited %s for the order.', $earned_points_string)); } elseif (!$order->hasPointsEarning() && $order->hasPointsSpending()) { $this->_dispatchSuccess(Mage::helper('rewards')->__('The customer was deducted %s for the order.', $redeemed_points_string)); } elseif ($order->hasPointsEarning() && $order->hasPointsSpending()) { $this->_dispatchSuccess(Mage::helper('rewards')->__('The customer was credited %s and deducted %s for the order.', $earned_points_string, $redeemed_points_string)); } else { // no points earned or spent } if ($order->isInitialTransferStatus(TBT_Rewards_Model_Transfer_Status::STATUS_PENDING_EVENT)) { $this->_dispatchSuccess(Mage::helper('rewards')->__("The customer's earned points are currently pending the completion of the order. They will be able to spend their points after order process is complete.")); } elseif ($order->isInitialTransferStatus(TBT_Rewards_Model_Transfer_Status::STATUS_PENDING_APPROVAL)) { $this->_dispatchSuccess(Mage::helper('rewards')->__("The customer's earned points are currently on hold. The customer will not be able to spend their points until an administator approves the transaction(s).")); } else { // points were likely approved, so no extra message is needed. } return $this; }