Page 1 of 2 12 LastLast
Results 1 to 10 of 3052

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: One-Page Checkout [Support Thread]

    @frank18, it appears that the site's Google tracking script is not playing nice with OPC:
    Code:
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-xxxxx-1");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    More investigation required ...

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by lat9 View Post
    @frank18, it appears that the site's Google tracking script is not playing nice with OPC:
    Code:
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-xxxxx-1");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    More investigation required ...
    I replaced the Google tracking script to eliminate document.write but still have same issue.

  3. #3
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: One-Page Checkout [Support Thread]

    Interesting that document.write is still used in the latest ZC 1.5.5e in includes/templates/template_default/common/html_header.php, around lines 123-124

    Code:
    <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>
    but a Google search for "alternative to document.write" returns umpteen documents stating that document.write is an outdated and even bad way to use it.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by frank18 View Post
    Interesting that document.write is still used in the latest ZC 1.5.5e in includes/templates/template_default/common/html_header.php, around lines 123-124

    Code:
    <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>
    but a Google search for "alternative to document.write" returns umpteen documents stating that document.write is an outdated and even bad way to use it.
    Yes. It was still somewhat in vogue when that template was initially created. Are you suggesting it should be ripped out during a "point release" and not wait for a "major version release"?

    Keep in mind that the majority of people who have contributed templates or who google for help with pretty much any javascript-driven stuff are gonna find or use outdated methods ... and most won't have a clue how to use many of the so-called "better" methods.

    Furthermore, you do realize that the code you're referring to is ONLY a catch-all in case the CORRECT loading of jquery hasn't already happened earlier. Those two script lines should NEVER trigger anything if the template is working as designed out of the box
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by DrByte View Post
    Yes. It was still somewhat in vogue when that template was initially created. Are you suggesting it should be ripped out during a "point release" and not wait for a "major version release"?

    Keep in mind that the majority of people who have contributed templates or who google for help with pretty much any javascript-driven stuff are gonna find or use outdated methods ... and most won't have a clue how to use many of the so-called "better" methods.

    Furthermore, you do realize that the code you're referring to is ONLY a catch-all in case the CORRECT loading of jquery hasn't already happened earlier. Those two script lines should NEVER trigger anything if the template is working as designed out of the box
    Thanks Doc, we are just trying to get errors with OPC fixed as per lat9's post #470.

    Eliminated one possible source, namely the Google Analytics issue but still investigating the other in that post.

  6. #6
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by frank18 View Post
    ... we are just trying to get errors with OPC fixed as per lat9's post #470.

    Eliminated one possible source, namely the Google Analytics issue but still investigating the other in that post.
    Ok, problem solved.

    This morning I decided to revive the local clone of this site so I could play with various scenarios including deleting files at will without interupting a live site.

    Long story short, on the local clone I had a few more files for Zen Lightbox. Found out that things started to work after deleting ../jscript/jquery-1.12.0.min.js and ../jscript/jquery.min.js. A peek at the source showed the output of ../jscript/jscript_zen_lightbox.php including a call for jquery-1.11.3.min.js - and the lightbulb went off!!! Gotcha, bugger!!

    So made all look the same on the live site (deleting and modifying a few files) and bingo, OPC was up and running. As I suspected from the outset, there had to be a clash of some jscripts. This was not the case when that site had OPC 1.2.0 running....

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: One-Page Checkout [Support Thread]

    Thanks for that, @frank18! I'll investigate further as it looks like I might be able to use the jQuery.noConflict method to provide a work-around for those multiple versions of jQuery being loaded in an OPC update.

  8. #8
    Join Date
    Apr 2015
    Location
    United States
    Posts
    144
    Plugin Contributions
    0

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by frank18 View Post
    Ok, problem solved.

    This morning I decided to revive the local clone of this site so I could play with various scenarios including deleting files at will without interupting a live site.

    Long story short, on the local clone I had a few more files for Zen Lightbox. Found out that things started to work after deleting ../jscript/jquery-1.12.0.min.js and ../jscript/jquery.min.js. A peek at the source showed the output of ../jscript/jscript_zen_lightbox.php including a call for jquery-1.11.3.min.js - and the lightbulb went off!!! Gotcha, bugger!!

    So made all look the same on the live site (deleting and modifying a few files) and bingo, OPC was up and running. As I suspected from the outset, there had to be a clash of some jscripts. This was not the case when that site had OPC 1.2.0 running....
    Hello Frank18,
    I am having the same symptoms and problems. Could you give me a clue which jscript was interfering with OPC and how you fixed it.

    Thanks, Frank

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: One-Page Checkout [Support Thread]

    Quote Originally Posted by frank18 View Post
    I replaced the Google tracking script to eliminate document.write but still have same issue.
    Thanks for trying that, Frank. I also noticed that you're using jQuery 1.12.0 while my test site was using 2.1.4; unfortunately, downleveling the jQuery version did not lead me to replication of the site's interoperability issue.

  10. #10
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: One-Page Checkout [Support Thread]

    Whenever using jQuery 1.12.x or 2.2.x I always advocate to also use jQuery Migrate which helps with backwards capability; ie. JS code that needs an earlier version of jQuery to work properly. It is a shim that is most handy. Save it on your hosting account though as calling it locally is faster.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Set number of products displayed per page (support thread)
    By yellow1912 in forum All Other Contributions/Addons
    Replies: 146
    Last Post: 2 Nov 2023, 12:50 AM
  2. v151 Banners In Main Page - Support Thread
    By stevesh in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Sep 2021, 03:36 PM
  3. v151 Site Map/Page Not Found: Combined [Support Thread]
    By lat9 in forum All Other Contributions/Addons
    Replies: 7
    Last Post: 4 Jan 2016, 02:19 PM
  4. v151 PayPal Express Checkout Using NVP 84.0 [Support Thread]
    By lat9 in forum Addon Payment Modules
    Replies: 32
    Last Post: 28 Dec 2015, 04:54 PM
  5. Checkout Amazon Style -- Support Thread
    By CJPinder in forum All Other Contributions/Addons
    Replies: 72
    Last Post: 13 Apr 2011, 08:18 PM

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