Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38
  1. #11
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

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

    Seeing so many having difficulty using this added feature and while this (solution and addition to ZC) makes a plugin I offer obsolete, ZC 1.5.5x is missing an important part of the process outlined by PayPal to support In Context checkout. Namely the javascript code needed to support the operation.

    The code needs to be incorporated first in the shopping_cart, and then anywhere from which the PayPal Express button can be applied and anywhere to which return from PayPal is expected in order to allow revisiting the in context operation and to "hold" the view in the original screen.

    An easy solution that doesn't require any file overrides nor template modification is to place the following code in a file named jscript_paypal_incontext.php then place that file in the folders listed below:

    jscript_paypal_incontext.php:
    Code:
    <?php
    if (defined('MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE') && MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE == 'InContext' && defined('MODULE_PAYMENT_PAYPALWPP_MERCHANTID') && MODULE_PAYMENT_PAYPALWPP_MERCHANTID != '' && defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
    ?><!-- merchant site HTML page --><script> (function(d, s, id){ var js, ref = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)){ js = d.createElement(s); js.id = id; js.async = true; js.src = "//www.paypalobjects.com/js/external/paypal.js"; ref.parentNode.insertBefore(js, ref); } }(document, "script", "paypal-js")); </script><?php
    }
    Place the file in at least each of the folders in the path includes/modules/pages/

    shopping_cart
    login
    checkout_shipping
    checkout_payment
    checkout_confirmation
    checkout_success
    time_out
    index

    Ie. includes/modules/pages/shopping_cart/jscript_paypal_incontext.php

    And any other page that has the PayPal express checkout button or that is or could be a return page displayed to the customer in the checkout process as implemented by modifications made to your site to where a customer could return from PayPal express. (For example, the shipping page can be bypassed using PayPal Express, further the payment page can be bypassed also provided there is no possibility of a coupon being applied, which would deliver the customer to the checkout_confirmation page in a default ZC install.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

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

    @mc12345678, would you provide a link to the associated PayPal documentation?

  3. #13
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

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

    CRUD!! I was HOPING this would work... but it still opens up in a new window. Site is https://www.tjsattic.com
    Site is using 1.5.5a and everything is correct in the admin under modules/payment


    Quote Originally Posted by mc12345678 View Post
    Seeing so many having difficulty using this added feature and while this (solution and addition to ZC) makes a plugin I offer obsolete, ZC 1.5.5x is missing an important part of the process outlined by PayPal to support In Context checkout. Namely the javascript code needed to support the operation.

    The code needs to be incorporated first in the shopping_cart, and then anywhere from which the PayPal Express button can be applied and anywhere to which return from PayPal is expected in order to allow revisiting the in context operation and to "hold" the view in the original screen.

    An easy solution that doesn't require any file overrides nor template modification is to place the following code in a file named jscript_paypal_incontext.php then place that file in the folders listed below:

    jscript_paypal_incontext.php:
    Code:
    <?php
    if (defined('MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE') && MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE == 'InContext' && defined('MODULE_PAYMENT_PAYPALWPP_MERCHANTID') && MODULE_PAYMENT_PAYPALWPP_MERCHANTID != '' && defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
    ?><!-- merchant site HTML page --><script> (function(d, s, id){ var js, ref = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)){ js = d.createElement(s); js.id = id; js.async = true; js.src = "//www.paypalobjects.com/js/external/paypal.js"; ref.parentNode.insertBefore(js, ref); } }(document, "script", "paypal-js")); </script><?php
    }
    Place the file in at least each of the folders in the path includes/modules/pages/

    shopping_cart
    login
    checkout_shipping
    checkout_payment
    checkout_confirmation
    checkout_success
    time_out
    index

    Ie. includes/modules/pages/shopping_cart/jscript_paypal_incontext.php

    And any other page that has the PayPal express checkout button or that is or could be a return page displayed to the customer in the checkout process as implemented by modifications made to your site to where a customer could return from PayPal express. (For example, the shipping page can be bypassed using PayPal Express, further the payment page can be bypassed also provided there is no possibility of a coupon being applied, which would deliver the customer to the checkout_confirmation page in a default ZC install.)

  4. #14
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

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

    Quote Originally Posted by stellarweb View Post
    CRUD!! I was HOPING this would work... but it still opens up in a new window. Site is https://www.tjsattic.com
    Site is using 1.5.5a and everything is correct in the admin under modules/payment
    Generally speaking, it's still supposed to open in a new window, but the previous window is supposed to have a lightbox applied to it and the new window "hovering" over the existing.

    Lat9, the reference I have for that code and direction has been replaced with the current in context information. That said, the src path can be modified to //www.paypalobjects.com/api/checkout.js and still function.

    In further review, it appears that in includes/modules/payment/paypalwpp.php function process_button, the reason upon returning to the shopping cart and not being able to reuse incontext checkout is because the token has been provided back even though ec_cancel=1 and therefore when presenting the button code through process_button, the applicable javascript associated is not returned for display. This is also why after a "timeout" that the next visit to the shopping cart page will allow reuse of the in context method.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #15
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

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

    Quote Originally Posted by mc12345678 View Post
    ... Lat9, the reference I have for that code and direction has been replaced with the current in context information. That said, the src path can be modified to //www.paypalobjects.com/api/checkout.js and still function. ...
    mc12345678, I have absolutely no idea what you mean. Are you saying that the jscript code you posted was for an older implementation of the in-context processing?

  6. #16
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

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

    So.... bottom line is.... how the heck do we get this to work properly? lol

  7. #17
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

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

    Quote Originally Posted by mc12345678 View Post
    Seeing so many having difficulty using this added feature and while this (solution and addition to ZC) makes a plugin I offer obsolete, ZC 1.5.5x is missing an important part of the process outlined by PayPal to support In Context checkout. Namely the javascript code needed to support the operation.

    The code needs to be incorporated first in the shopping_cart, and then anywhere from which the PayPal Express button can be applied and anywhere to which return from PayPal is expected in order to allow revisiting the in context operation and to "hold" the view in the original screen.

    An easy solution that doesn't require any file overrides nor template modification is to place the following code in a file named jscript_paypal_incontext.php then place that file in the folders listed below:

    jscript_paypal_incontext.php:
    Code:
    <?php
    if (defined('MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE') && MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE == 'InContext' && defined('MODULE_PAYMENT_PAYPALWPP_MERCHANTID') && MODULE_PAYMENT_PAYPALWPP_MERCHANTID != '' && defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
    ?><!-- merchant site HTML page --><script> (function(d, s, id){ var js, ref = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)){ js = d.createElement(s); js.id = id; js.async = true; js.src = "//www.paypalobjects.com/js/external/paypal.js"; ref.parentNode.insertBefore(js, ref); } }(document, "script", "paypal-js")); </script><?php
    }
    Place the file in at least each of the folders in the path includes/modules/pages/

    shopping_cart
    login
    checkout_shipping
    checkout_payment
    checkout_confirmation
    checkout_success
    time_out
    index

    Ie. includes/modules/pages/shopping_cart/jscript_paypal_incontext.php

    And any other page that has the PayPal express checkout button or that is or could be a return page displayed to the customer in the checkout process as implemented by modifications made to your site to where a customer could return from PayPal express. (For example, the shipping page can be bypassed using PayPal Express, further the payment page can be bypassed also provided there is no possibility of a coupon being applied, which would deliver the customer to the checkout_confirmation page in a default ZC install.)
    Revision to the above which so far has worked in all testing and uses more recent/locatable information.

    An easy solution that doesn't require any file overrides nor template modification is to place the following code in a file named jscript_paypal_incontext.php then place that file in the folders listed below:

    jscript_paypal_incontext.php:
    Code:
    <?php
    if (defined('MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE') && MODULE_PAYMENT_PAYPALWPP_CHECKOUTSTYLE == 'InContext' && defined('MODULE_PAYMENT_PAYPALWPP_MERCHANTID') && MODULE_PAYMENT_PAYPALWPP_MERCHANTID != '' && defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
      require_once(DIR_WS_CLASSES . 'payment.php');
      $paypalwpp_module = 'paypalwpp';
      // init the payment object
      $classPay = new payment($paypalwpp_module);
      ?><script>
      
      paypal.checkout.setup('<?php echo MODULE_PAYMENT_PAYPALWPP_MERCHANTID; ?>', {
        //locale: '<?php echo ${$paypalwpp_module}->getLanguageCode('incontext'); ?>',
    <?php
      echo (MODULE_PAYMENT_PAYPALWPP_SERVER == 'live' ? '' : "\n          environment: 'sandbox',")?>
        container: 'PPecic',
        buttons: 'ecButton',
        click: function() {
          paypal.checkout.initXO();
    
          var action = $.post('/set-express-checkout');
    
          action.done(function (data) {
            paypal.checkout.startFlow(data.token);
          });
    
          action.fail(function () {
            paypal.checkout.closeFlow();
          });
        }
      });
    </script>
    <!-- merchant site HTML page --><script src = "//www.paypalobjects.com/api/checkout.js" async></script><?php
    }
    Place the file in at least each of the folders in the path includes/modules/pages/

    shopping_cart
    login
    checkout_shipping
    checkout_payment
    checkout_confirmation
    checkout_success
    time_out
    index

    Ie. includes/modules/pages/shopping_cart/jscript_paypal_incontext.php

    And any other page that has the PayPal express checkout button or that is or could be a return page displayed to the customer in the checkout process as implemented by modifications made to your site to where a customer could return from PayPal express. (For example, the shipping page can be bypassed using PayPal Express, further the payment page can be bypassed also provided there is no possibility of a coupon being applied, which would deliver the customer to the checkout_confirmation page in a default ZC install.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #18
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

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

    It looks like you're getting closer, mc12345678, incorporating the Advanced In-Context JavaScript settings suggested by PayPal.

    There's an unclosed parentheses in your starting if-clause and I'm wondering what the purpose of setting the $classPay variable is (since it's not referenced within the code you posted).

  9. #19
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

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

    Quote Originally Posted by lat9 View Post
    It looks like you're getting closer, mc12345678, incorporating the Advanced In-Context JavaScript settings suggested by PayPal.

    There's an unclosed parentheses in your starting if-clause and I'm wondering what the purpose of setting the $classPay variable is (since it's not referenced within the code you posted).
    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.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #20
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

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

    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?

 

 
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Send Mail page does not load
    By joaocunha in forum General Questions
    Replies: 2
    Last Post: 20 Mar 2010, 12:14 AM
  2. Main Text Content not full page
    By tachedout in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Oct 2009, 02:13 AM
  3. Replies: 1
    Last Post: 4 Jul 2007, 03:37 PM
  4. Admin page does not load
    By Toina in forum Basic Configuration
    Replies: 5
    Last Post: 10 Mar 2007, 09:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR