Esempio n. 1
0
 /**
  * get Tax rate (percent) for customer
  * 
  * @param Magestore_Affiliateplus_Model_Account $account
  * @param Mage_Core_Model_Store $store
  * @return float
  */
 public function getTaxRate($account = null, $store = null)
 {
     $store = Mage::app()->getStore($store);
     $taxClassId = Mage::getStoreConfig('affiliateplus/payment/tax_class', $store);
     if (!$taxClassId) {
         return 0;
     }
     $calculator = $this->getCalculator();
     $customer = $calculator->getCustomer();
     if (!$customer) {
         $customer = Mage::getModel('customer/customer')->load($account->getCustomerId());
         $calculator->setCustomer($customer);
     }
     $request = $calculator->getRateRequest(null, null, null, $store);
     $percent = $calculator->getRate($request->setProductClassId($taxClassId));
     return (double) $percent;
 }
Esempio n. 2
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;
 }