Beispiel #1
0
 /**
  * Set various template variables
  */
 protected function _prepareTemplateData()
 {
     if ($this->_actionInstance) {
         $this->addData(array('reward_points' => $this->_rewardInstance->estimateRewardPoints($this->_actionInstance), 'landing_page_url' => Mage::helper('enterprise_reward')->getLandingPageUrl()));
         if ($this->_rewardInstance->getId()) {
             // estimate qty limitations (actually can be used without customer reward record)
             $qtyLimit = $this->_actionInstance->estimateRewardsQtyLimit();
             if (null !== $qtyLimit) {
                 $this->setData('qty_limit', $qtyLimit);
             }
             if ($this->hasGuestNote()) {
                 $this->unsGuestNote();
             }
             $this->addData(array('points_balance' => $this->_rewardInstance->getPointsBalance(), 'currency_balance' => $this->_rewardInstance->getCurrencyAmount()));
             // estimate monetary reward
             $amount = $this->_rewardInstance->estimateRewardAmount($this->_actionInstance);
             if (null !== $amount) {
                 $this->setData('reward_amount', $amount);
             }
         } else {
             if ($this->hasIsGuestNote() && !$this->hasGuestNote()) {
                 $this->setGuestNote(Mage::helper('enterprise_reward')->__('Applies only to registered customers, may vary when logged in.'));
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Perform Row-level data update
  *
  * @param Enterprise_Reward_Model_Reward $object
  * @param array $data New data
  * @return Enterprise_Reward_Model_Resource_Reward
  */
 public function updateRewardRow(Enterprise_Reward_Model_Reward $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;
 }
Beispiel #3
0
 /**
  * Set various variables requested by template
  */
 protected function _prepareTemplateData()
 {
     $maxBalance = (int) Mage::helper('enterprise_reward')->getGeneralConfig('max_points_balance');
     $minBalance = (int) Mage::helper('enterprise_reward')->getGeneralConfig('min_points_balance');
     $balance = $this->_rewardInstance->getPointsBalance();
     $this->addData(array('points_balance' => $balance, 'currency_balance' => $this->_rewardInstance->getCurrencyAmount(), 'pts_to_amount_rate_pts' => $this->_rewardInstance->getRateToCurrency()->getPoints(true), 'pts_to_amount_rate_amount' => $this->_rewardInstance->getRateToCurrency()->getCurrencyAmount(), 'amount_to_pts_rate_amount' => $this->_rewardInstance->getRateToPoints()->getCurrencyAmount(), 'amount_to_pts_rate_pts' => $this->_rewardInstance->getRateToPoints()->getPoints(true), 'max_balance' => $maxBalance, 'is_max_balance_reached' => $balance >= $maxBalance, 'min_balance' => $minBalance, 'is_min_balance_reached' => $balance >= $minBalance, 'expire_in' => (int) Mage::helper('enterprise_reward')->getGeneralConfig('expiration_days'), 'is_history_published' => (int) Mage::helper('enterprise_reward')->getGeneralConfig('publish_history')));
 }
 /**
  * Internal constructor
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_init('enterprise_reward/reward');
     self::$_actionModelClasses = self::$_actionModelClasses + array(self::REWARD_ACTION_ADMIN => 'enterprise_reward/action_admin', self::REWARD_ACTION_ORDER => 'enterprise_reward/action_order', self::REWARD_ACTION_REGISTER => 'enterprise_reward/action_register', self::REWARD_ACTION_NEWSLETTER => 'enterprise_reward/action_newsletter', self::REWARD_ACTION_INVITATION_CUSTOMER => 'enterprise_reward/action_invitationCustomer', self::REWARD_ACTION_INVITATION_ORDER => 'enterprise_reward/action_invitationOrder', self::REWARD_ACTION_REVIEW => 'enterprise_reward/action_review', self::REWARD_ACTION_TAG => 'enterprise_reward/action_tag', self::REWARD_ACTION_ORDER_EXTRA => 'enterprise_reward/action_orderExtra', self::REWARD_ACTION_CREDITMEMO => 'enterprise_reward/action_creditmemo', self::REWARD_ACTION_SALESRULE => 'enterprise_reward/action_salesrule', self::REWARD_ACTION_REVERT => 'enterprise_reward/action_orderRevert', self::REWARD_ACTION_CREDITMEMO_VOID => 'enterprise_reward/action_creditmemoVoid');
 }