[Done v1.5.0] PayPal Express Checkout Button does not display
In the configuration you have the option to disable showing the PayPal Express Checkout button from displaying.
Turning this to false will cause the button to not display on the shopping cart. However, on the login page it will still show the other text and tell the user to click the button below, which of course is not there at all.
The problem is in includes/modules/login/header_php.php this is no check for whether the button is enabled or not, only the following code:
PHP Code:
// Check for PayPal express checkout button suitability:
$paypalec_enabled = (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True');
// Check for express checkout button suitability:
$ec_button_enabled = ($paypalec_enabled && ($_SESSION['cart']->count_contents() > 0 && $_SESSION['cart']->total > 0));
But in includes/modules/payment/paypal/tpl_ec_button.php you have:
PHP Code:
$paypalec_enabled = (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True');
$ecs_off = (defined('MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON') && MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON == 'Off');
if ($ecs_off) $paypalec_enabled = FALSE;
By this point the other text has already been added to the document so this check for...
PHP Code:
(defined('MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON') && MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON == 'Off')
...needs to be in the header_php.php file like this:
PHP Code:
$ec_button_enabled = ($paypalec_enabled && (defined('MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON') && MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON == 'Off') && ($_SESSION['cart']->count_contents() > 0 && $_SESSION['cart']->total > 0));
Then those redundant conditions inside tpl_ec_button.php can be removed and only used when loading from the shopping_cart page.
Re: PayPal Express Checkout Button does not display
NEVERMIND, I see this is fixed in v1.5, good job.
Re: [Done v1.5.0] PayPal Express Checkout Button does not display
Hi Numinix
I tried to get the above to work on 139h but am uncertain about the outcome.
I gather from your instructions that line 153 of includes/modules/pages/login/header_php.php needs to be replaced with:
Code:
$ec_button_enabled = ($paypalec_enabled && (defined('MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON') && MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON == 'Off') && ($_SESSION['cart']->count_contents() > 0 && $_SESSION['cart']->total > 0));
In so doing, the text component of the button no longer appears in the login page, with or without products in cart, or any other page from my reckoning, but on the shopping_cart page a text link (because my site has not yet gone live) to PPEC remains under the checkout button. Is this right?
Quote:
Then those redundant conditions inside tpl_ec_button.php can be removed and only used when loading from the shopping_cart page.
However I am not at all certain about this quote. Is this just a statement of what your fix will do or does some other code need to be removed?
Thanks