getRelay($id_pickup); if ($relay instanceof stdClass && $relay->identifiant) { $customer = new Customer($id_customer); $order = new Order($id_order); $invoice_address = new Address($order->id_address_invoice); $delivery_address = new Address($order->id_address_delivery); $so_delivery = new SoFlexibiliteDelivery(); $so_delivery->id_cart = (int)$id_cart; $so_delivery->id_customer = (int)$id_customer; $so_delivery->loadDelivery(); $so_delivery->id_order = $id_order; $so_delivery->type = $relay->typeDePoint; $so_delivery->id_point = $relay->identifiant; $so_delivery->libelle = $relay->nom; $so_delivery->firstname = $invoice_address->firstname; $so_delivery->address1 = $invoice_address->address1; $so_delivery->address2 = $invoice_address->address2; $so_delivery->address3 = ''; $so_delivery->company = $invoice_address->company; $so_delivery->indice = ''; $so_delivery->postcode = $invoice_address->postcode; $so_delivery->city = $invoice_address->city; $so_delivery->country = Country::getIsoById($invoice_address->id_country); $so_delivery->lieudit = ''; $status = $so_delivery->saveDelivery() ? true : false; // $delivery_address->company = $relay->nom; // $delivery_address->address1 = $relay->adresse1; // $delivery_address->address2 = $relay->adresse2; // $delivery_address->postcode = $relay->codePostal; // $delivery_address->city = $relay->localite; // $delivery_address->country = $relay->libellePays; // $delivery_address->id_country = Country::getByIso($relay->codePays); // // $status &= $delivery_address->save(); $json = array( 'output' => ob_get_clean(), 'status' => $status ); die(Tools::jsonEncode($json)); } $json = array( 'output' => ob_get_clean(), 'status' => false ); die(Tools::jsonEncode($json));