Пример #1
0
 public function hookActionValidateOrder($params)
 {
     $order = $params['order'];
     $total = $order->total_paid;
     $host = Tools::getHttpHost();
     $order_id = $order->id;
     $param = array('{total_paid}' => $total, '{shop_url}' => $host);
     Mail::Send((int) $order->id_lang, 'event_order', Mail::l('new order', (int) $order->id_lang), $param, Configuration::get('SMS_ORDER_NEW_EMAIL'), 'Site Admin', null, null, null, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
     Mail::Send((int) $order->id_lang, 'event_order', Mail::l('new order', (int) $order->id_lang), $param, Configuration::get('PS_SHOP_EMAIL'), 'Site Admin', null, null, null, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
     // notify to me
     $message = Configuration::get('SMS_ORDER_NEW');
     $address = new Address((int) $order->id_address_delivery);
     $message = Meta::sprintf2($message, array('order' => $order_id, 'host' => $host));
     $phone_client = trim($address->phone) == "" ? $address->phone_mobile : $address->phone;
     $phone_client = preg_replace('#\\D+#', '', $phone_client);
     if (egmultishop::isLiveSite()) {
         //if (Configuration::get('BLOCK_EGMULTSOP_SNON')){
         // send to client if marketing site
         //if(egmultishop::isMarketingSite()>0){
         egmultishop::SendSMS($phone_client, $message);
         //}
         // send to me in any way
         $phone = Configuration::get('SMS_ORDER_NEW_PHONE');
         $message = " " . $total . " RUB ";
         //egmultishop::SendSMS($phone, "new order".$message.$host);
     }
     $param = array('{phone}' => str_replace('+', '', $phone_client), '{message}' => $message, '{fname}' => '', '{type}' => 'NewOrder', '{host}' => $host, '{shost}' => str_replace('.', '-', $host));
     $this->sendTelegramm($param, $sms_message);
     //}
     // client notify
 }