From 4572379dfcbe00e117fc58880cbcf3548b4a78a6 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 22 Jun 2017 16:53:29 +0200 Subject: [PATCH 1/2] fix multi paiement and css --- modules/paybox/direct_paiement.php | 30 ++++++++-- themes/site/order-confirmation.tpl | 2 +- themes/site/order-payment.tpl | 73 +++++++++++++++-------- themes/site_mobile/order-confirmation.tpl | 6 +- themes/site_mobile/order-payment.tpl | 71 ++++++++++++++-------- 5 files changed, 124 insertions(+), 58 deletions(-) diff --git a/modules/paybox/direct_paiement.php b/modules/paybox/direct_paiement.php index 54b78178..80f8a483 100644 --- a/modules/paybox/direct_paiement.php +++ b/modules/paybox/direct_paiement.php @@ -11,6 +11,21 @@ $controller->preProcess(); if (!$cookie->isLogged()) Tools::redirect('authentication.php'); + +if ($id_order = (int)Order::getOrderByCartId($cart->id)) +{ + // log + $content = ''; + if (file_exists('logs.txt')) { + $content = file_get_contents('logs.txt'); + } + $line = 'SECONDE TENTATIVE ['.(int)$cart->id.'] '.date('Y-m-d H:i:s').': Redirect id_order='.$id_order."\n"; + $content .= $line; + file_put_contents('logs.txt', $content); + // end log + Tools::redirect('order-detail.php?id_order='.$id_order); +} + // verif if there's at least one order with this delivery address $orders_with_delivery_address = Db::getInstance()->getValue(' SELECT COUNT(`id_order`) @@ -161,11 +176,6 @@ foreach ($data as $d) { $pays = $d[1]; } } -// $num_trans = explode('NUMTRANS=', $data[0]); -// $num_appel = explode('NUMAPPEL=', $data[1]); -// $autorisation = explode('AUTORISATION=', $data[5]); -// $code_reponse = explode('CODEREPONSE=', $data[6]); -// $commentaire = explode('COMMENTAIRE=', $data[7]); $data[7] = utf8_encode($data[7]); @@ -208,7 +218,15 @@ if ($autorisation == 'XXXXXX' && $test_mode === 1) { if ($id_order = (int)Order::getOrderByCartId($cart->id)) { - $paybox->saveInformationPaiement($values); + // log + $content = ''; + if (file_exists('logs.txt')) { + $content = file_get_contents('logs.txt'); + } + $line = 'SECONDE RESPONSE ['.(int)$cart->id.']['.$num_question.'] '.date('Y-m-d H:i:s').': '.$response."\n"; + $content .= $line; + file_put_contents('logs.txt', $content); + // end log if (empty($error)) { diff --git a/themes/site/order-confirmation.tpl b/themes/site/order-confirmation.tpl index e24a3582..6ad84d0f 100755 --- a/themes/site/order-confirmation.tpl +++ b/themes/site/order-confirmation.tpl @@ -143,7 +143,7 @@ {l s='How make a return ?'} -
+
@@ -152,6 +176,7 @@ $(this).children('.input_radio').children('input[name="paiement-method"]').attr('checked', true); }); + // $('.submitPayment').live('click', function(e) { // e.preventDefault(); // // check if selected diff --git a/themes/site_mobile/order-confirmation.tpl b/themes/site_mobile/order-confirmation.tpl index fe76eb0d..c9b47c83 100755 --- a/themes/site_mobile/order-confirmation.tpl +++ b/themes/site_mobile/order-confirmation.tpl @@ -43,7 +43,7 @@

{l s='You can download your invoice in your account, on'} "{l s='Order History'}"

-
+

{l s='Details of your order'}

@@ -53,8 +53,8 @@

{$product.product_name}

-

{l s='Quantity'} {$product.product_quantity}

- {assign var='total' value=$product.product_price_wt * $product.product_quantity} +

{l s='Quantity'} {$product.product_quantity}

+ {assign var='total' value=$product.product_price_wt * $product.product_quantity}

{displayPrice price=$total}

{/foreach} diff --git a/themes/site_mobile/order-payment.tpl b/themes/site_mobile/order-payment.tpl index 0f27932d..b4038ad9 100755 --- a/themes/site_mobile/order-payment.tpl +++ b/themes/site_mobile/order-payment.tpl @@ -33,41 +33,64 @@ var currencyBlank = '{$currencyBlank|intval}'; var txtProduct = "{l s='product'}"; var txtProducts = "{l s='products'}"; + var payment_click = 0; // ]]> {literal} // Function to submit payment and send the information to GA - function submitPayment(){ + function submitPayment(payment_click){ $input = $('input[name="paiement-method"]:checked'); if(!$input.length) { alert(paiementErrorMessage); } - if ($input.val()) { - // LOADER POUR PAYBOX - if ($input.attr('data-module-name') == "paybox-direct"){ + $('.overlay_bbb').click(function(e){ + if(payment_click != 0) { + // prevent multi click $('.overlay_bbb').fadeIn(); - $('.box_paybox').fadeIn(); + + if ($input.val()) { + if ($input.attr('data-module-name') == "paybox-direct"){ + $('.box_paybox').fadeIn(); + } + if ($input.attr('data-module-name') == "paypal") { + $('.box_paypal').fadeIn(); + } + } + return false; } - if (window.ga && ga.create){ - // redirect by GA send event - onStepComplete(4, $input.attr('data-module-name') ,$input.val(),null); + }); + if(payment_click == 0) { + payment_click = payment_click+1; + if ($input.val()) { + // LOADER POUR PAYBOX + if ($input.attr('data-module-name') == "paybox-direct"){ + $('.overlay_bbb').fadeIn(); + $('.box_paybox').fadeIn(); + } + if (window.ga && ga.create){ + // redirect by GA send event + onStepComplete(4, $input.attr('data-module-name') ,$input.val(),null); + } else { + window.location = $input.val(); + } } else { - window.location = $input.val(); + $form = $input.parent().children('div.hidden').children('form'); + $name = $form.attr('data-module-name'); + // LOADER POUR PAYPAL + if ($input.attr('data-module-name') == "paypal") { + $('.overlay_bbb').fadeIn(); + $('.box_paypal').fadeIn(); + $name = 'paypal'; + } + if (window.ga && ga.create){ + // submit form by GA send event + onStepComplete(4, $name,null,$form); + } else { + $form.submit(); + } } } else { - $form = $input.parent().children('div.hidden').children('form'); - $name = $form.attr('data-module-name'); - // LOADER POUR PAYPAL - if ($input.attr('data-module-name') == "paypal") { - $('.overlay_bbb').fadeIn(); - $('.box_paypal').fadeIn(); - $name = 'paypal'; - } - if (window.ga && ga.create){ - // submit form by GA send event - onStepComplete(4, $name,null,$form); - } else { - $form.submit(); - } + $('.overlay_bbb').fadeIn(); + return false; } } {/literal} @@ -103,7 +126,7 @@ {if !$opc}

{l s='Previous'} - {l s='Valider ma commande'} + {l s='Valider ma commande'}

{else}
From 2b858963a39faf3e0154609f0ca179605647862f Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Fri, 23 Jun 2017 10:11:06 +0200 Subject: [PATCH 2/2] add comment --- modules/paybox/direct_paiement.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/paybox/direct_paiement.php b/modules/paybox/direct_paiement.php index 80f8a483..3888929c 100644 --- a/modules/paybox/direct_paiement.php +++ b/modules/paybox/direct_paiement.php @@ -11,7 +11,7 @@ $controller->preProcess(); if (!$cookie->isLogged()) Tools::redirect('authentication.php'); - +// verif if there's one order already then redirect to the order detail if ($id_order = (int)Order::getOrderByCartId($cart->id)) { // log @@ -23,6 +23,7 @@ if ($id_order = (int)Order::getOrderByCartId($cart->id)) $content .= $line; file_put_contents('logs.txt', $content); // end log + Tools::redirect('order-detail.php?id_order='.$id_order); }