Im aktuellen PayPal-Plus-Modul fällt mir auf, dass Daten mindestens doppelt an PayPal- gesendet werden, wenn in der Konfiguration die Verwendung von TABS aktiviert ist.
Direkt beim laden der checkout_payment.php und beim öffnen des payPal-Plus-Tabs werden Daten an PayPal gesendet und ich frage ich, muss das sein?
Sollte, wenn die die Verwendung von Tabs konfiguriert ist, nicht nur dann die PayPal-Elemente abgerufen werden, wenn das Tab auch geöffnet wird?
Verantwortlich scheint mir derzeit dafür unter anderem die Datei
/includes/modules/payment/paypalplus.php an Zeile 79
$
("#checkout_payment").attr
("name", "checkout_payment"); $
.get
("'.xtc_href_link('callback/paypal/paypalplus.php', '', 'SSL').'", function(data
) { $
("#ppp_result").html
(data
); }); '.(($this->get_config('MODULE_PAYMENT_
'.strtoupper($this->code).'_USE_TABS
') == '1' || count($payments) > 0) ? ' $
("[id*=\"rd\"]").click
(function(e
) { if ($
(\
'input[name="payment"]:checked\', \'#checkout_payment\').val() == "'.$this->code.'") {
'.(($this->get_config('MODULE_PAYMENT_'.strtoupper($this->code).'_USE_TABS') == '1') ?
'
$.get("'.xtc_href_link
('callback/paypal/paypalplus.php', '', 'SSL').'", function(data) {
$("#ppp_result").html(data);
});
' : '').'
'.((count($payments) > 0) ?
'
$("#continueButton").removeAttr("onclick");
$("#continueButton").attr("onclick", "ppp.doContinue(); return false;");
' : '').'
} else {
'.((count($payments) > 0) ?
'$("#continueButton").removeAttr("onclick");' : '').'
}
});' : '').'
Die Callback-Datei wird aufgerufen, sobald die Seite geladen wird. 2 Zeilen darunter wird sie nochmals aufgerufen, wenn die radio-box aktiviert wird.
Sollte man den Code nicht so ändern:
$
("#checkout_payment").attr
("name", "checkout_payment"); '.(($this->get_config('MODULE_PAYMENT_
'.strtoupper($this->code).'_USE_TABS
') == '1' || count($payments) > 0) ? ' $
("[id*=\"rd\"]").click
(function(e
) { if ($
(\
'input[name="payment"]:checked\', \'#checkout_payment\').val() == "'.$this->code.'") {
'.(($this->get_config('MODULE_PAYMENT_'.strtoupper($this->code).'_USE_TABS') == '1') ?
'
$.get("'.xtc_href_link
('callback/paypal/paypalplus.php', '', 'SSL').'", function(data) {
$("#ppp_result").html(data);
});
' : '').'
'.((count($payments) > 0) ?
'
$("#continueButton").removeAttr("onclick");
$("#continueButton").attr("onclick", "ppp.doContinue(); return false;");
' : '').'
} else {
'.((count($payments) > 0) ?
'$("#continueButton").removeAttr("onclick");' : '').'
}
});
$(document).ready(function($) {
if($(":radio[value=paypalplus]:checked").length) {
$.get("'.xtc_href_link
('callback/paypal/paypalplus.php', '', 'SSL').'", function(data) {
$("#ppp_result").html(data);
});
}
});' : '
$.get("'.xtc_href_link
('callback/paypal/paypalplus.php', '', 'SSL').'", function(data) {
$("#ppp_result").html(data);
});
').'
Nur noch im nicht-Tab-Modus wird die PayPal-Box sofort geladen. Im Tab-Modus wird die Box nur nach dann mit der Seite geladen, wenn PayPalPlus bereits ausgewählt ist.
Achtung, die Änderung ist nicht ausführlich getestet.
Viele Grüße
Andreas