/** * initialise models */ protected function initModels() { $this->conf = ecommerce_promotion::initConfiguration(); $this->Promotion = new ecommerce_promotion(); $this->Promotion->setCacheable(false); $this->Promotion_Code = new ecommerce_promotion_code(); $this->Promotion_Code->setCacheable(false); $this->Customer = new client_customer(); $this->Customer->setCacheable(false); }
/** * Send email after succesfull reward code allocation */ public function sendRewardEmail($invited_customer_id, $rewarded_customer_id, $code, $usage) { require_once 'models/common/common_email.php'; require_once 'models/client/client_customer.php'; $EmailForm = new common_email(); $Customer = new client_customer(); $Customer->setCacheable(false); $rewarded_customer = $Customer->getDetail($rewarded_customer_id); $invited_customer = $Customer->getDetail($invited_customer_id); $GLOBALS['common_email']['invited_customer'] = $invited_customer; $GLOBALS['common_email']['rewarded_customer'] = $rewarded_customer; $GLOBALS['common_email']['code'] = $code; $GLOBALS['common_email']['total_invited'] = $usage; $conf = ecommerce_promotion::initConfiguration(); $GLOBALS['common_email']['minimum_order_amount'] = $conf['minimum_order_amount']; $GLOBALS['common_email']['discount_value'] = $conf['discount_value']; $to_email = $rewarded_customer['email']; $to_name = $rewarded_customer['first_name'] . " " . $rewarded_customer['last_name']; $EmailForm->sendEmail('referral_reward', 'n/a', $to_email, $to_name); }