コード例 #1
0
 /**
  * Send low Balance Warning Notification to customer if notification is enabled
  *
  * @param Enterprise_Reward_Model_Reward_History $item
  * @param int $websiteId
  * @return Enterprise_Reward_Model_Reward
  * @see Enterprise_Reward_Model_Mysql4_Reward_History_Collection::loadExpiredSoonPoints()
  */
 public function sendBalanceWarningNotification($item, $websiteId)
 {
     $mail = Mage::getModel('core/email_template');
     /* @var $mail Mage_Core_Model_Email_Template */
     $mail->setDesignConfig(array('area' => 'frontend', 'store' => $item->getStoreId()));
     $store = Mage::app()->getStore($item->getStoreId());
     $amount = Mage::helper('enterprise_reward')->getRateFromRatesArray($item->getPointsBalanceTotal(), $websiteId, $item->getCustomerGroupId());
     $action = Mage::getSingleton('enterprise_reward/reward')->getActionInstance($item->getAction());
     $templateVars = array('store' => $store, 'customer_name' => Mage::helper('customer')->getFullCustomerName($item), 'unsubscription_url' => Mage::helper('enterprise_reward/customer')->getUnsubscribeUrl('warning'), 'remaining_days' => $store->getConfig('enterprise_reward/notification/expiry_day_before'), 'points_balance' => $item->getPointsBalanceTotal(), 'points_expiring' => $item->getTotalExpired(), 'reward_amount_now' => Mage::helper('enterprise_reward')->formatAmount($amount, true, $item->getStoreId()), 'update_message' => $action !== null ? $action->getHistoryMessage($item->getAdditionalData()) : '');
     $mail->sendTransactional($store->getConfig(self::XML_PATH_BALANCE_WARNING_TEMPLATE), $store->getConfig(self::XML_PATH_EMAIL_IDENTITY), $item->getCustomerEmail(), null, $templateVars, $store->getId());
     return $this;
 }