Example #1
0
 /**
  * send email notification to 
  * 
  * @param Magestore_Affiliateplus_Model_Payment $payment
  * @param Magestore_Affiliateplus_Model_Account $account
  * @param mixed $store
  * @return type
  */
 public function sendEmailToAccount($payment, $account, $store = null)
 {
     //Changed By Adam 28/07/2014
     if (!Mage::helper('affiliateplus')->isAffiliateModuleEnabled()) {
         return;
     }
     $translate = Mage::getSingleton('core/translate');
     $translate->setTranslateInline(false);
     $store = Mage::app()->getStore($store);
     $template = Mage::getStoreConfig('affiliateplus_payment/recurring/account_template', $store);
     $sender = Mage::helper('affiliateplus')->getSenderContact();
     $status = array(1 => Mage::helper('affiliateplus')->__('Pending'), 2 => Mage::helper('affiliateplus')->__('Processing'), 3 => Mage::helper('affiliateplus')->__('Complete'), 4 => Mage::helper('affiliateplus')->__('Canceled'));
     Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $store->getId()))->sendTransactional($template, $sender, $account->getEmail(), $account->getName(), array('sender_name' => $sender['name'], 'store' => $store, 'account' => $account, 'payment' => $payment, 'request_time' => Mage::helper('core')->formatDate($payment->getRequestTime(), 'medium'), 'email_label' => ucfirst($payment->getData('payment_method')), 'email_address' => $account->getData($payment->getData('payment_method') . '_email'), 'pay_amount' => Mage::helper('core')->currency($payment->getAmount()), 'pay_fee' => Mage::helper('core')->currency($payment->getFee()), 'pay_status' => $status[$payment->getStatus()], 'account_balance' => Mage::helper('core')->currency($account->getBalance())));
     $translate->setTranslateInline(true);
     return true;
 }
 /**
  * override load function for frontend view
  * 
  * @param type $id
  * @param type $field
  * @return Magestore_AffiliateplusTrash_Model_Payment
  */
 public function load($id, $field = null)
 {
     parent::load($id, $field);
     if (!Mage::app()->getStore()->isAdmin() && $this->canRestore()) {
         $this->setData(array());
     }
     return $this;
 }