Zen Cart Logo
Forums / PayPal Express Checkout support / Paypal In-context popup does not load content, then proceeds to full-page payment

Paypal In-context popup does not load content, then proceeds to full-page payment

Views: 46,658

Results 21 to 38 of 38
13 Aug 2016, 1:57 PM
#21
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Paypal In-context popup does not load content, then proceeds to full-page payment

stellarweb:

Thanks for all your help on this Chad!!

Tested with Firefox, Chrome and Windows Edge - still a "no go" on https://www.tjsattic.com. Have tried from the shopping cart page as well as the login page.

I can see the coding in view source mode. I have other modules and google schema on this site... wonder if I should be testing on a "vanilla" cart?

You've definitely got something going on, as when I navigate down to the product level I don't get the css and the images/additional images are all that are presented. I'll try the "buy now" buttons unless you have a different way to get to adding a product to the cart.

13 Aug 2016, 2:04 PM
#22
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,085
Plugin Contributions:
56

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

mc12345678:

If there is its a miracle that the code works on my test site without an error. There are 4 opening and 4 closing parentheses, and they are matched such that a close always closes an open one.

The assignment of $classPay is not as important as the function called to assign it. The variable could likely be unset at the end of the code or not assigned to begin with, but wanted to leave the maximum potential functionality without impacting existing code by otherwise reusing a variable (though somewhat too late in using $paypalwpp_module variable.
Oops! That "missing" closing paren snuck in as the very last (undisplayed) line of the code.

It's still unclear to me what the instantiation of the paypalwpp payment-class is adding to the mix.

13 Aug 2016, 2:10 PM
#23
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

mc12345678:

You've definitely got something going on, as when I navigate down to the product level I don't get the css and the images/additional images are all that are presented. I'll try the "buy now" buttons unless you have a different way to get to adding a product to the cart.

Found that by selecting buy now (although I may want to shop for other things before final purchase) adds the product to the cart. Confirmed that selecting the PayPal express option did not open a new window, but instead redirected from the existing one. Did see the code in the source view. But, found that using an html validator that there are several errors on both the shopping_cart and login pages. Not sure (limited resources at the moment) of the effect of those errors. Seems a lot of odd quote issues and separation from another location. Could have an effect.

A clean install tends to be the best for figuring out an issue as if it works in the base install and not in some other "current" install then there is obviously a difference of importance. :) that's where the tough part comes.

13 Aug 2016, 2:13 PM
#24
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,085
Plugin Contributions:
56

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

mc12345678:

You've definitely got something going on, as when I navigate down to the product level I don't get the css and the images/additional images are all that are presented. I'll try the "buy now" buttons unless you have a different way to get to adding a product to the cart.
From the shopping-cart page, when I click the "Checkout with PayPal" button, there's the following javascript error reported in the console:

ReferenceError: paypal is not defined
paypal.checkout.setup('PAYPALCODE', {
13 Aug 2016, 2:15 PM
#25
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

lat9:

Oops! That "missing" closing paren snuck in as the very last (undisplayed) line of the code.

It's still unclear to me what the instantiation of the paypalwpp payment-class is adding to the mix.

Well, as currently implemented in ZC technically nothing as the locale option was disabled in the paypalwpp function process_button, I left it disabled in the above code, but what it does is instantiate $paypalwpp to be of the class payment so that the built in ZC code to provide the getLanguageCode('incontext') response without repeating that code in the event it changes (PayPal modifies areas of concern and ZC follows).

13 Aug 2016, 2:27 PM
#26
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

Ok Chad - I will set up a "vanilla" cart with no modifications to it and test it later today after I have woken up a little bit more! :laugh:

mc12345678:

Found that by selecting buy now (although I may want to shop for other things before final purchase) adds the product to the cart. Confirmed that selecting the PayPal express option did not open a new window, but instead redirected from the existing one. Did see the code in the source view. But, found that using an html validator that there are several errors on both the shopping_cart and login pages. Not sure (limited resources at the moment) of the effect of those errors. Seems a lot of odd quote issues and separation from another location. Could have an effect.

A clean install tends to be the best for figuring out an issue as if it works in the base install and not in some other "current" install then there is obviously a difference of importance. :) that's where the tough part comes.

13 Aug 2016, 2:35 PM
#27
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

Cindy - that is definitely in the code of the jscript file on line 9 ```php
paypal.checkout.setup('<?php echo MODULE_PAYMENT_PAYPALWPP_MERCHANTID; ?>', {


I also noticed that when it goes to a new window, it says I can't log in with my own merchant account - but I am not logged into my merchant account at PayPal... so don't know what that's all about!  lol

> **lat9:**
>
> From the shopping-cart page, when I click the "Checkout with PayPal" button, there's the following javascript error reported in the console:
> ```
ReferenceError: paypal is not defined
paypal.checkout.setup('PAYPALCODE', {
13 Aug 2016, 2:44 PM
#28
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

stellarweb:

Ok Chad - I will set up a "vanilla" cart with no modifications to it and test it later today after I have woken up a little bit more! :laugh:

Notice that jquery is loaded after the above script instead of before it. That can wreak havoc on things as well...

13 Aug 2016, 2:53 PM
#29
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

OK - that is above my pay grade! How do I change that? I am using CSS/JS loader to minimize the files - don't know if that has anything to do with it or not.

mc12345678:

Notice that jquery is loaded after the above script instead of before it. That can wreak havoc on things as well...

13 Aug 2016, 3:06 PM
#30
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

mc12345678:

Notice that jquery is loaded after the above script instead of before it. That can wreak havoc on things as well...

Correction, one of three versions of jQuery is loaded after the paypal script. Initially, version 1.7.1 (or whatever content is in the file with that version name in the template, then later if jQuery is not already loaded, version 1.10.2 is loaded (which should not be loaded because of the previous load), and then finally after the applicable includes/modules/pages/PAGE_NAME/jscript_ file(s) are loaded then version 1.12.0.min.js is loaded as provided in the template directory (but it is loaded after the occurrence of any other javascript/jquery action(s) and can basically cancel out the previous actions as has been found on the admin side with the way that jquery was implemented there in ZC 1.5.5.

13 Aug 2016, 3:08 PM
#31
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,085
Plugin Contributions:
56

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

stellarweb:

Cindy - that is definitely in the code of the jscript file on line 9 ```php
paypal.checkout.setup('<?php echo MODULE_PAYMENT_PAYPALWPP_MERCHANTID; ?>', {

> 
> I also noticed that when it goes to a new window, it says I can't log in with my own merchant account - but I am not logged into my merchant account at PayPal... so don't know what that's all about!  lol
Right, the code that's generating the error is that code on line 9; the *paypal *object doesn't exist, so the javascript call fails.
13 Aug 2016, 3:12 PM
#32
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

stellarweb:

OK - that is above my pay grade! How do I change that? I am using CSS/JS loader to minimize the files - don't know if that has anything to do with it or not.

I'd start at your template's includes/templates/2016/common/html_header.php file and then, well, I assume that the plugin splits off from there possibly before hand. (I've actually somewhat avoided that plugin because of the odd things that it does to a site, but to each their own)... the default html_header.php looks in part like this with jquery loaded before venturing into each of the subsequent load folders:

/** CDN for jQuery core **/
?>

<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="//code.jquery.com/jquery-1.12.0.min.js"%3E%3C/script%3E'));</script>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"%3E%3C/script%3E'));</script>

<?php
/**
 * load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
 */
  $directory_array = $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.js');
  while(list ($key, $value) = each($directory_array)) {
    echo '<script type="text/javascript" src="' .  $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value . '"></script>'."\n";
  }

/**
 * load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically
 */
  $directory_array = $template->get_template_part($page_directory, '/^jscript_/', '.js');
  while(list ($key, $value) = each($directory_array)) {
    echo '<script type="text/javascript" src="' . $page_directory . '/' . $value . '"></script>' . "\n";
  }

/**
 * load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
 */
  $directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php');
  while(list ($key, $value) = each($directory_array)) {
/**
 * include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
 * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
 */
    require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value); echo "\n";
  }
/**
 * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
 */
  $directory_array = $template->get_template_part($page_directory, '/^jscript_/');
  while(list ($key, $value) = each($directory_array)) {
/**
 * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
 * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
 */
    require($page_directory . '/' . $value); echo "\n";
  }
18 Aug 2016, 7:51 AM
#33
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

The solutions here do not work on my vanilla test shop, can someone post a link to a shop or demo that has this working please.

18 Aug 2016, 11:21 AM
#34
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,085
Plugin Contributions:
56

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

torvista:

The solutions here do not work on my vanilla test shop, can someone post a link to a shop or demo that has this working please.
Ditto, I've tried a couple of things on a ZC1.5.5a test-site to no avail.

18 Aug 2016, 12:23 PM
#35
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

I've spent a couple of hours fiddling with Paypals crappy demo and crappy documentation and checkng what it is doing and when before coming to the conclusion...it's complicated!
I don't have clear how the ZC form submission to ipn_handler joins hands with what the popup is expecting...and I need to get some real work done so can't waste all day on this.
Something seems broken in the zc core so some dev input would not go amiss...

2 Aug 2017, 6:12 AM
#36
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

I've only just noticed that this works now, after having done precisely nothing to it since my last post...apart from keep ZC up to date.

2 Aug 2017, 5:06 PM
#37
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

torvista:

I've only just noticed that this works now, after having done precisely nothing to it since my last post...apart from keep ZC up to date.
Fascinating :)
Thanks for the update.

9 Mar 2022, 12:24 PM
#38
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Location:
England
Posts:
730
Plugin Contributions:
0

Re: Paypal In-context popup does not load content, then proceeds to full-page payment

Just wondered if this perhaps works for UK stores? I have merchant ID filled and switched on context, but seems to be the same as before. Unless its a template clash with ajax / Javascript, am not sure.