/** * History item expiration date getter * * @param Enterprise_Reward_Model_Reward_History $item * @return string */ public function getExpirationDate(Enterprise_Reward_Model_Reward_History $item) { $expiresAt = $item->getExpiresAt(); if ($expiresAt) { return Mage::helper('core')->formatDate($expiresAt, 'short', true); } return ''; }
/** * Perform Row-level data update * * @param Enterprise_Reward_Model_Reward_History $object * @param array $data New data * @return Enterprise_Reward_Model_Resource_Reward_History */ public function updateHistoryRow(Enterprise_Reward_Model_Reward_History $object, $data) { if (!$object->getId() || !is_array($data)) { return $this; } $where = array($this->getIdFieldName() . '=?' => $object->getId()); $this->_getWriteAdapter()->update($this->getMainTable(), $data, $where); return $this; }
/** * 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; }