public function load()
 {
     $newslettersManager = NewslettersManager::getInstance($this->config, $this->args);
     $selected_email_accounts_ids = $_REQUEST['selected_email_accounts_ids'];
     $emailAccountsManager = EmailAccountsManager::getInstance($this->config, $this->args);
     $allEmailAccounts = $emailAccountsManager->selectAll();
     $emailAccountsNameIdMap = array();
     foreach ($allEmailAccounts as $dto) {
         $emailAccountsNameIdMap[$dto->getid()] = $dto->getLogin();
     }
     $this->addParam('email_accounts_logins', $emailAccountsNameIdMap);
     $this->addParam('selected_email_accounts_ids', explode(',', $selected_email_accounts_ids));
     $include_all_active_users = $_REQUEST['include_all_active_users'];
     $this->addParam('include_all_active_users', $include_all_active_users);
 }
예제 #2
0
 private function emailOrderDetails($orderId)
 {
     $emailSenderManager = new EmailSenderManager('gmail');
     $customer = $this->getCustomer();
     $userManager = UserManager::getInstance($this->config, $this->args);
     $customerEmail = $userManager->getRealEmailAddressByUserDto($customer);
     $emailAccountsManager = EmailAccountsManager::getInstance($this->config, $this->args);
     $infoEmailAddress = $emailAccountsManager->getEmailAddressById('info');
     $recipients = array($customerEmail, $infoEmailAddress);
     $lname = $customer->getLastName();
     $userName = $customer->getName();
     if (isset($lname)) {
         $userName .= ' ' . $lname;
     }
     $orderJoinedDetailsDtos = $this->ordersManager->getOrderJoinedWithDetails($orderId);
     $goupedOrderJoinedDetailsDtos = $this->groupBundlesInOrderJoinedDetailsDtos($orderJoinedDetailsDtos);
     $paymentType = $orderJoinedDetailsDtos[0]->getPaymentType();
     $payment_option_values = explode(',', $this->getCmsVar('payment_option_values'));
     $payment_options_display_names_ids = explode(',', $this->getCmsVar('payment_options_display_names_ids'));
     $index = array_search($paymentType, $payment_option_values);
     $paymentTypeDisplayNameId = $payment_options_display_names_ids[$index];
     $subject = $this->getPhrase(299);
     if ($paymentType == 'credit') {
         $template = "customer_credit_order";
     } else {
         $template = "customer_cash_order";
     }
     $params = array("user_name" => $userName, "dtos" => $goupedOrderJoinedDetailsDtos, "itemManager" => $this->itemManager, "support_phone" => $this->getCmsVar('pcstore_support_phone_number'), 'paymentTypeDisplayNameId' => $paymentTypeDisplayNameId);
     if ($paymentType == 'credit') {
         $creditSuppliersManager = CreditSuppliersManager::getInstance($this->config, $this->args);
         $csid = $orderJoinedDetailsDtos[0]->getCreditOrdersCreditSupplierId();
         $creditSupplierDto = $creditSuppliersManager->selectByPK($csid);
         $commission = $creditSupplierDto->getCommission();
         $grandTotalAMD = intval($orderJoinedDetailsDtos[0]->getOrderTotalAmd());
         $grandTotalAmdWithCommission = intval($grandTotalAMD / (1 - $commission / 100));
         $params['grandTotalAmdWithCommission'] = $grandTotalAmdWithCommission;
     }
     $emailSenderManager->sendEmail('orders', $recipients, $subject, $template, $params, '', '', true, false);
 }
예제 #3
0
 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($server)
 {
     $this->sentEmailsManager = SentEmailsManager::getInstance(null, null);
     $this->emailAccountsManager = EmailAccountsManager::getInstance(null, null);
     $this->initPHPMailer($server);
 }