Skip to content

Commit

Permalink
Select PayPal Express as the payment method after a successful PayPal…
Browse files Browse the repository at this point in the history
… Login
  • Loading branch information
haraldpdl committed Apr 4, 2014
1 parent f3f6052 commit ef2cf8d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion catalog/includes/modules/content/login/cm_paypal_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function preLogin() {
}

function postLogin() {
global $paypal_login_customer_id, $login_customer_id;
global $paypal_login_customer_id, $login_customer_id, $language, $payment;

if ( tep_session_is_registered('paypal_login_customer_id') ) {
if ( $paypal_login_customer_id !== false ) {
Expand All @@ -258,6 +258,25 @@ function postLogin() {

tep_session_unregister('paypal_login_customer_id');
}

// Register PayPal Express Checkout as the default payment method
if ( !tep_session_is_registered('payment') || ($payment != 'paypal_express') ) {
if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
if ( in_array('paypal_express.php', explode(';', MODULE_PAYMENT_INSTALLED)) ) {
if ( !class_exists('paypal_express') ) {
include(DIR_WS_LANGUAGES . $language . '/modules/payment/paypal_express.php');
include(DIR_WS_MODULES . 'payment/paypal_express.php');
}

$ppe = new paypal_express();

if ( $ppe->enabled ) {
$payment = 'paypal_express';
tep_session_register('payment');
}
}
}
}
}

function isEnabled() {
Expand Down

0 comments on commit ef2cf8d

Please sign in to comment.