name = 'soflexibilite'; $this->protocol = Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'; $this->url = $this->protocol.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/'.$this->name; $this->parser_url = $this->url.'/functions/parser.php'; $this->point_list_url = $this->url.'/functions/point_list.php'; $this->saveDelivery_url = $this->url.'/functions/saveDeliveryPoint.php'; $this->initSoflexibiliteEnv_url = $this->url.'/functions/initSoflexibiliteEnv.php'; $this->checkPointSelectedOPC_url = $this->url.'/functions/checkPointSelectedOPC.php'; $customerAddresses = $this->context->customer->getAddresses((int)$this->context->cookie->id_lang); $mobile = ''; $inputs = null; $id_delivery_address = (int)$this->context->cart->id_address_delivery; foreach ($customerAddresses as $address) { if ((int)$address['id_address'] === $id_delivery_address) { $inputs[] = array( 'id_address' => $address['id_address'], 'alias' => $address['alias'], 'company' => $address['company'], 'firstname' => $address['firstname'], 'lastname' => $address['lastname'], 'address1' => $address['address1'], 'address2' => $address['address2'], 'postcode' => $address['postcode'], 'city' => $address['city'], 'phone' => $address['phone_mobile'], 'country' => $address['country'], 'abdefault' => $address['id_address'] == $this->context->cart->id_address_delivery ? '1' : '0' ); if (isset($address['phone_mobile'])) { $tel = sprintf('%010s', preg_replace('[^\x30-\x39]', '', $address['phone_mobile'])); if (Tools::substr($tel, 1, 1) == 6 || Tools::substr($tel, 1, 1) == 7) $mobile = $tel; } } } $this->context->smarty->assign( array( 'soflexibilite_dom_id' => Configuration::get('SOFLEXIBILITE_DOM_ID'), 'soflexibilite_rdv_id' => Configuration::get('SOFLEXIBILITE_RDV_ID'), 'soflexibilite_bpr_id' => Configuration::get('SOFLEXIBILITE_BPR_ID'), 'soflexibilite_a2p_id' => Configuration::get('SOFLEXIBILITE_A2P_ID'), 'soflexibilite_cit_id' => Configuration::get('SOFLEXIBILITE_CIT_ID'), 'soflexibilite_cust_id' => $id_delivery_address, 'inputs' => $inputs, 'soflexibilite_mobile' => $mobile, 'soflexibilite_point_list_url' => $this->point_list_url, 'parser_url' => $this->parser_url, 'saveDeliveryPoint' => $this->saveDelivery_url, 'checkPointSelectedOPC' => $this->checkPointSelectedOPC_url, 'protocol' => $this->protocol, 'soflexibilite_cart_id' => $this->context->cookie->soflexibilite_cart_id ) ); $html = $this->context->smarty->fetch(dirname(__FILE__).'/../views/templates/hook/displayBeforeCarrierMobile.tpl'); $result = ob_get_clean(); if ($result) $output = $result; else $output = null; $json = array( 'output' => $output, 'status' => true, 'html' => $html ); die(Tools::jsonEncode($json)); } } $SoflexibiliteEnv = new InitSoflexibiliteEnv(); $SoflexibiliteEnv->initEnvSoflexibilite();