Announcement

Collapse
No announcement yet.

HELP! Tried to update the jQuery version and killed it

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HELP! Tried to update the jQuery version and killed it

    I was trying to update the version of jQuery and thought I was doing everything correctly. Now none of the jQuery/javascript functions work. I'm getting a Console error that says
    json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=fe5d9eaa:6 Uncaught ReferenceError: $ is not defined
    the error underlines the $ here

    Code:
    window.jQuery = cash = $;
    I have tried rolling back to the old version but I'm still getting that error and more. I'm trying to find the correct javascript resources for Colossus to see what I may have goofed up.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    Hi Leslie,

    If you only replaced the jQuery file outright, then try removing this from the scripts.js file:
    Code:
    /**
    * Check if Cash has been replaced by jQuery. If it has not, set jQuery
    * as a `window` element.
    */
    if (typeof jQuery === 'undefined') {
    window.jQuery = cash = $;
    }
    Matt Zimmermann
    Front-End Development Director / Miva, Inc.

    Comment


      #3
      Originally posted by Matt Zimmermann View Post
      Hi Leslie,

      If you only replaced the jQuery file outright, then try removing this from the scripts.js file:
      Code:
      /**
      * Check if Cash has been replaced by jQuery. If it has not, set jQuery
      * as a `window` element.
      */
      if (typeof jQuery === 'undefined') {
      window.jQuery = cash = $;
      }
      Is the file assigned to any Resource Group?
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        Hi Leslie,

        The "dome" and "core_scripts" JavaScript Resources are both part of the "site-scripts" Combined JavaScript Resource which is assigned to the "footer_js" Resource Group. For updating jQuery, you would replace the code in the "dom" JavaScript Resource with the Compressed, Production version here: https://code.jquery.com/jquery-3.6.0.min.js
        Matt Zimmermann
        Front-End Development Director / Miva, Inc.

        Comment


          #5
          Originally posted by Matt Zimmermann View Post
          Hi Leslie,

          If you only replaced the jQuery file outright, then try removing this from the scripts.js file:
          Code:
          /**
          * Check if Cash has been replaced by jQuery. If it has not, set jQuery
          * as a `window` element.
          */
          if (typeof jQuery === 'undefined') {
          window.jQuery = cash = $;
          }
          I don't think that was it. The error just moved down to the next $

          I have also opened a Support Ticket since this has pretty much broken the entire site functionality.

          Would it make a difference as to how I updated the file? I made the update (replaced the entire content) in the admin instead of FTP or uploading a new file.
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            Hi Leslie,

            Replacing JavaScript through the administration portal is fine; I do it all the time.
            Matt Zimmermann
            Front-End Development Director / Miva, Inc.

            Comment


              #7
              Originally posted by Matt Zimmermann View Post
              Hi Leslie,

              Replacing JavaScript through the administration portal is fine; I do it all the time.
              I didn't think it was but I thought I'd better ask. This is maddening. I can't figure out what has broken this. I tried rolling back the jQuery, I've tried putting the link for the jQuery directly in the Global Footer. That gave a new error

              Code:
              Uncaught TypeError: $.debounced is not a function
              at json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:661
              at HTMLScriptElement.scriptCalled.onload.scriptCalled .onreadystatechange (json.mvc?Store_Code=KCD&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=2353e1cf:89)
              I've got the old version of jQuery directly linked in the Global Footer but the "cash" section is not commented out (removed). I would have thought rolling back to the old version would have made this work again.
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                I expanded (clicked open) the error out and found even more issues

                Code:
                json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:661 Uncaught TypeError: $.debounced is not a function
                at json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:661
                at HTMLScriptElement.scriptCalled.onload.scriptCalled .onreadystatechange (json.mvc?Store_Code=KCD&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=2353e1cf:89)
                (anonymous) @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:661
                scriptCalled.onload.scriptCalled.onreadystatechang e @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:89
                load (async)
                loadScript @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:78
                theme @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:659
                (anonymous) @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:723
                (anonymous) @ json.mvc?Store_Code=KCD&Function=JavaScriptCombine dResource_Output&JavaScriptCombinedResource_Code=s ite-scripts&T=2353e1cf:724
                Leslie Kirk
                Miva Certified Developer
                Miva Merchant Specialist since 1997
                Previously of Webs Your Way
                (aka Leslie Nord leslienord)

                Email me: [email protected]
                www.lesliekirk.com

                Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                Comment


                  #9
                  Following up - somehow the order of the scripts got out of whack. When I manually added the link to the jQuery file in the Global Footer before the Combined Resources everything worked again. Is there anything in the user docs on how to properly sort these files?
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                  Comment


                    #10
                    Hi Leslie,

                    You can sort the file order in the combined resource as well as the resource group.
                    Matt Zimmermann
                    Front-End Development Director / Miva, Inc.

                    Comment


                      #11
                      Originally posted by Matt Zimmermann View Post
                      Hi Leslie,

                      You can sort the file order in the combined resource as well as the resource group.
                      Yes, that I know. But what is the proper order?
                      Leslie Kirk
                      Miva Certified Developer
                      Miva Merchant Specialist since 1997
                      Previously of Webs Your Way
                      (aka Leslie Nord leslienord)

                      Email me: [email protected]
                      www.lesliekirk.com

                      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                      Comment


                        #12
                        Hi Leslie,

                        You will always want jQuery, whether that is one you have manually added or the "dom" resource, to come before the scripts used on the site as they will require jQuery to be initialized first.
                        Matt Zimmermann
                        Front-End Development Director / Miva, Inc.

                        Comment


                          #13
                          Originally posted by Matt Zimmermann View Post
                          Hi Leslie,

                          You will always want jQuery, whether that is one you have manually added or the "dom" resource, to come before the scripts used on the site as they will require jQuery to be initialized first.
                          I understand that what I'm looking for is the docs that show all this stuff.

                          Leslie Kirk
                          Miva Certified Developer
                          Miva Merchant Specialist since 1997
                          Previously of Webs Your Way
                          (aka Leslie Nord leslienord)

                          Email me: [email protected]
                          www.lesliekirk.com

                          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                          Comment


                            #14
                            https://docs.miva.com/how-to-guides/...-order-scripts
                            Matt Zimmermann
                            Front-End Development Director / Miva, Inc.

                            Comment

                            Working...
                            X