/** * 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'))); }
/** * 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.')); } } } }