Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default checkout_payment - Uncaught ReferenceError: $ is not defined

    This is related to

    $(document).ready(function(){
    $('form[name="checkout_payment"]').submit(function() {
    $('.paymentSubmit').attr('disabled', true);
    <?php if ($flagOnSubmit) { ?>
    formPassed = check_form();
    if (formPassed == false) {
    $('.paymentSubmit').attr('disabled', false);
    }
    return formPassed;
    <?php } ?>
    });
    });


    Now... I dont' have jquery on the header... is this the issue ?

    Thanks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

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

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    Yup. But it should be or should have been there if using ZC 1.5.5 as identified in the breadcrumb of this thread.

    What was modified to remove it and why?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    Quote Originally Posted by mc12345678 View Post
    Yup. But it should be or should have been there if using ZC 1.5.5 as identified in the breadcrumb of this thread.

    What was modified to remove it and why?
    Sorry, didn't understand....
    I didn't remove anything... it's there, but I have my jquery, foundation and all that js stuff loaded at the footer, and I was styling this page, saw a error in chrome.
    Wanted to be sure that this was related to that jquery stuff....
    So far, I think it's the only file that's complaining about this.
    I dont' know javascritp to change this lines, so I could remain with the jquery in the footer.
    I've made a test purchase... I don't see no errors on that, so this is changing some attribute on submit, so probably I'll be ok ?
    Or perhaps I could just grab this piece of code, and load it in this page on the footer....
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

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

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    ZC 1.5.5 (as you've at some point come to find out) loads Jquery in the upper area of the page at least in a default template situation. Reload of jquery has negative effects on code loaded between the previous and subsequent code.

    Yes, the $ relates to jquery, as to "being ok" if there is an error that is occurring, then something isn't working as designed/expected.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    Quote Originally Posted by mc12345678 View Post
    ZC 1.5.5 (as you've at some point come to find out) loads Jquery in the upper area of the page at least in a default template situation.
    That was (or still is ) on the admin area..... but on front page, again, it's limiting the user choice of template.
    Oh well... one can change things, but then on future updates.... it's hell.

    Thanks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  6. #6
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    Hi
    After all, I realize that I still have issues with this.
    My jquery, etc, as mentioned, is being loaded after the page load

    PHP Code:
    function downloadJSAtOnload() {
    var element = document.createElement("script");
    element.src = "<?php echo DIR_WS_TEMPLATE.'jscript/'?>tpl_v02.js";
    document.body.appendChild(element);
    if (window.addEventListener)
    window.addEventListener("load", downloadJSAtOnload, false);
    else if (window.attachEvent)
    window.attachEvent("onload", downloadJSAtOnload);
    else window.onload = downloadJSAtOnload;
    For whatever reason I now realize that formPassed = check_form(); is not getting defined.

    This is the zencart file
    PHP Code:
    $(document).ready(function(){
          $('form[name="checkout_payment"]').submit(function() {
              $('#paymentSubmit').attr('disabled', true);
            <?php if ($flagOnSubmit) { ?>
              formPassed = check_form();
              if (formPassed == false) {
                  $('#paymentSubmit').attr('disabled', false);
              }
              return formPassed;
            <?php ?>
          });
    To this what I did now:

    PHP Code:
    // In \includes\modules\pages\checkout_payment\jscript_main.php
    <?php 
    if ($flagOnSubmit) { ?>
        var flagOnSubmit = 1;        
    <?php ?>
    // Portion of this file is loaded on the footer cause jquery
    The document.ready

    PHP Code:
     if (document.body.id === 'checkoutpaymentBody') {
            
            $(
    'form[name="checkout_payment"]').submit(function () {
                $(
    '.paymentSubmit').attr('disabled'true);
                if (
    flagOnSubmit === && check_form() === false
                 {
                    
    //document.getElementsByClassName ('payment')
                    
    $('.paymentSubmit').attr('disabled'false);
                }
                
    console.log(check_form 'check_form');
                return 
    check_form();
            });
        } 
    In chromes console check_form() returns true.
    Am I doing this right ?
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  7. #7
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: checkout_payment - Uncaught ReferenceError: $ is not defined

    Or maybe the return formPassed; is important ?
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

 

 

Similar Threads

  1. Uncaught ReferenceError: cssjsmenu is not defined
    By unclemantis in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 13 Sep 2013, 05:01 PM
  2. v151 "Uncaught ReferenceError: jQuery is not defined" Zen Lightbox not working
    By Pointylimbs in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 14 Jun 2013, 04:13 PM
  3. Checkout_Shipping will not advance to Checkout_Payment
    By ttscanada in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 3 Jun 2010, 05:10 PM
  4. Tax Text Not Showing Up On Checkout_Payment Page
    By enchantedone in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 1 Jun 2006, 05:04 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