If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / [Done v1.5.0] PayPal Express Checkout Button does not display

[Done v1.5.0] PayPal Express Checkout Button does not display

Started by numinix on 25 Oct 2011, 9:28 PM · Views: 2,794

Results 1 to 3 of 3
25 Oct 2011, 9:28 PM
#1
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,572
Plugin Contributions:
60

[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:

// 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:

$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
(defined('MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON') && MODULE_PAYMENT_PAYPALWPP_ECS_BUTTON == 'Off')

...needs to be in the header_php.php file like this:

```php
$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.

25 Oct 2011, 9:49 PM
#2
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,572
Plugin Contributions:
60

Re: [Done v1.5.0] PayPal Express Checkout Button does not display

NEVERMIND, I see this is fixed in v1.5, good job.

5 Apr 2012, 5:42 AM
#3
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,022
Plugin Contributions:
2

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:

$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?

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