The issue with the integration of PayPal Express Checkout, One-Page Checkout and payment methods that use a separate checkout_payment page jscript module is as follows.
Requirements to "expose" the issue:
The site has enabled the PayPal Express Checkout (and its shortcut button) and either Square or Payeezyjs in addition to One-Page Checkout.
A new customer chooses to pay via the PP-EC shortcut button and the email address associated with the customer's PayPal account is not associated with a customer on the site.
The problem:
The jscript processing associated with those payment methods (and possibly others) currently loads so long as the associated payment-method is enabled in the admin. When the customer makes a purchase using the PP-ec Shortcut button, the payment-gathering page is rendered only with the PayPal-related form elements. Unfortunately, the jscript for these payment methods assumes that its form-elements have been rendered if the jscript is loaded. When that jscript attempts to verify settings of an unrendered HTML element, a javascript error is raised; that error subsequently results in the One-Page Checkout's "Confirm Order" button failing to activate.
The solution:
Unfortunately, this change requires updates to both the One-Page Checkout and the payment-methods' processing.
First, the OPC's entry-page processing will check to see if the customer is currently in "special checkout" (a.k.a. checkout using the PP-ec shortcut) and, if so, "resets" the payment methods to activate only the special-checkout payment method. Note that this is a chicken/egg situation, since for OPC to determine whether or not the customer is in "special checkout", all currently-enabled payment methods must be loaded.
When OPC sees that the customer is in "special checkout", OPC reloads the payment methods to specify that the active payment-method is the "special checkout" one. This does not remove the object-instances associated with the other enabled payment methods, but does ensure that only the active payment-method will be called for subsequent payment actions.
Secondly, each payment-method that has a separate jscript_*.php module requires update to that module's loading to ensure that the associated javascript is only loaded when the customer is not in "special checkout".
The changes:
The file /includes/modules/pages/checkout_one/header_php.php:
This change is available on the OPC plugin's GitHub repository.Code:// load all enabled payment modules require DIR_WS_CLASSES . 'payment.php'; $payment_modules = new payment; // ----- // Check to see if we're in "special checkout", i.e. the payment's being made via the PayPal Express // Checkout's "shortcut" button. If so, "reset" the payment modules to include **only** the payment // method presumed to be recorded in the current customer's session. // if ($payment_modules->in_special_checkout()) { unset($payment_modules); $payment_modules = new payment($_SESSION['payment']); } $payment_selections = $payment_modules->selection(); $flagOnSubmit = count($payment_selections);
The jscript_square.php module, distributed as part of the Square payment-method:
The jscript_payeezy.php module, distributed as part of the PayeezyJsZc payment-method:Code:if ($payment_modules->in_special_checkout() || !defined(MODULE_PAYMENT_SQUARE_STATUS) || MODULE_PAYMENT_SQUARE_STATUS != 'True' || (!defined('MODULE_PAYMENT_SQUARE_APPLICATION_ID') || MODULE_PAYMENT_SQUARE_ACCESS_TOKEN == '')) { return false; }
I'll be cross-posting a link to this post to the Square and PayeezyJsZc payment methods' support threads.Code:if ($payment_modules->in_special_checkout() || !defined(MODULE_PAYMENT_PAYEEZYJSZC_STATUS) || MODULE_PAYMENT_PAYEEZYJSZC_STATUS != 'True' || (!defined('MODULE_PAYMENT_PAYEEZYJSZC_JSSECURITY_KEY') && !defined('MODULE_PAYMENT_PAYEEZYJSZC_JSSECURITY_KEY_SANDBOX') )) { return false; }




Reply With Quote
... did you create the (required) template-override file for the tpl_modules_opc_shopping_cart.php file?

