From 18d3d0f1d4343b578fc8a765189d9f674776379b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 24 Apr 2018 13:17:33 +0000 Subject: [PATCH] wip #1927 @1.5 --- fluidbook/services/remarkableorder.html | 143 +++++++++++++++++++++++ inc/ws/Controlleur/class.ws.services.php | 51 +++++++- 2 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 fluidbook/services/remarkableorder.html diff --git a/fluidbook/services/remarkableorder.html b/fluidbook/services/remarkableorder.html new file mode 100644 index 000000000..c5882a8f3 --- /dev/null +++ b/fluidbook/services/remarkableorder.html @@ -0,0 +1,143 @@ + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Remarkable vous remercie pour votre commande.
Votre colis est en préparation + et vous serez livré sous 72h.
+
+ Détails de la commande +
+ + + + + + + + + $lignes + $fraisport + + + + + +
RéférenceProduitPrix unitaireQuantitéPrix total HT
Total à payer TTC$totalttc
+
+ Livraison en jours ouvrés par transporteur. +
+ + Règlement : + facture à l'intérieur du colis (pas de règlement au transporteur) + + +
+ + Par chèque à l'adresse REMARKABLE - CS20030 - 34748 VENDARGUES Cedex
+ Par virement : IBAN FR76 1293 9000 9040 0010 4732 564 BDUPFR2S
+
+
+ + + + + + + + + +
+ ADRESSE DE LIVRAISON + + ADRESSE DE FACTURATION +
+
$shipping_address

+
+
$billing_address

+
+
+ Remarkable SARL Les Sources - ZAC Via Domitia - 406 Avenie des Razeteurs - 34160 CASTRIES
+ tél : 04 67 59 12 81 - + contact@remarkable.fr - SIREN 430 142 687
+
+
+
+ + \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index b614f47de..b9e7c49e8 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -1114,16 +1114,61 @@ class wsServices extends cubeFlashGateway public function orderRemarkable() { + try { + $html = file_get_contents(WS_FILES . '/services/remarkableorder.html'); + $billing_address = $_POST['details']['firstname'] . ' ' . $_POST['details']['lastname'] . '

' . $_POST['details']['billing_company'] . "
" . $_POST['details']['billing_address'] . '
' . $_POST['details']['billing_zip'] . ' ' . $_POST['details']['billing_city']; + + $params = array('company', 'address', 'zip', 'city'); + foreach ($params as $param) { + if (trim($_POST['details']['shipping_' . $param]) == '') { + $_POST['details']['shipping_' . $param] = $_POST['details']['billing_' . $param]; + } + } + $shipping_address = $_POST['details']['shipping_company'] . "
" . $_POST['details']['shipping_address'] . '
' . $_POST['details']['shipping_zip'] . ' ' . $_POST['details']['shipping_city']; + + if ($_POST['fpv'] == 'hidden') { + $fraisport = ''; + } else { + $fraisport = ''; + $fraisport .= 'Frais de livraison'; + $fraisport .= '' . $_POST['fpv'] . ''; + $fraisport .= ''; + } + + $lignes = []; + foreach ($_POST['items'] as $item) { + $ligne = ''; + $ligne .= '' . $item[0] . ''; + $ligne .= '' . $item[1] . ''; + $ligne .= '' . $item[2] . ''; + $ligne .= '' . $item[3] . ''; + $ligne .= '' . $item[4] . ''; + $ligne .= ''; + $lignes[] = $ligne; + } + + $lignes = implode('', $lignes); + $totalttc = $_POST['totalttc']; + + $replace = ['billing_address', 'shipping_address', 'totalttc', 'fraisport', 'lignes']; + foreach ($replace as $item) { + if (isset($$item)) { + $html = str_replace('$' . $item, str_replace('€', '€', $$item), $html); + } + } + $mail = new cubeMail(); $mail->type = "html"; - $mail->from = 'test@cubedesigners.com'; + $mail->from = 'contact@remarkable.fr'; + $mail->to = $_POST['details']['email']; + //$mail->bcc = 'contact@remarkable.fr'; $mail->bcc = 'test@cubedesigners.com'; $mail->subject = '[Remarkable] Votre commande'; - $mail->body = print_r($_POST, true); + $mail->body = $html; $mail->send(); } catch (Exception $e) { - + } } } -- 2.39.5