Announcement

Collapse
No announcement yet.

jQuery.Deferred exception & Uncaught ReferenceError: MivaEvents is not defined

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

    jQuery.Deferred exception & Uncaught ReferenceError: MivaEvents is not defined

    getting this warning: (intermittently)

    "jQuery.Deferred exception: MivaEvents is not defined ReferenceError: MivaEvents is not defined
    at Object.jsPROD ( CLIENTDOMAIN .com/mm5/json.mvc?Store_Code=XXXX&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=138e059a:662:3)
    at HTMLDocument.<anonymous> ( CLIENTDOMAIN .com/mm5/json.mvc?Store_Code=XXXX&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=138e059a:141:26)
    at e ( CLIENTDOMAIN .com/mm5/json.mvc?Store_Code=XXXX&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=138e059a:2:30038)
    at t ( CLIENTDOMAIN .com/mm5/json.mvc?Store_Code=XXXX&Function=JavaScriptCombin edResource_Output&JavaScriptCombinedResource_Code= site-scripts&T=138e059a:2:30340) undefined"

    Along with this error: (intermittently)

    Uncaught ReferenceError: MivaEvents is not defined
    at Object.jsPROD (json.mvc?Store_Code=XXXX&Function=JavaScriptCombi nedResource_Output&JavaScriptCombinedResource_Code =site-scripts&T=138e059a:662:3)
    at HTMLDocument.<anonymous> (json.mvc?Store_Code=XXXX&Function=JavaScriptCombi nedResource_Output&JavaScriptCombinedResource_Code =site-scripts&T=138e059a:141:26)
    at e (json.mvc?Store_Code=XXXX&Function=JavaScriptCombi nedResource_Output&JavaScriptCombinedResource_Code =site-scripts&T=138e059a:2:30038)
    at t (json.mvc?Store_Code=XXXX&Function=JavaScriptCombi nedResource_Output&JavaScriptCombinedResource_Code =site-scripts&T=138e059a:2:30340)

    they both seem to point to this code within the scripts.js file.

    MivaEvents.SubscribeToEvent('variant_changed', function () {
    gallery.length = 0;
    mainImageZoom.attr('data-index', 0);
    thumbnailIndex = 0;
    outOfStock ();
    selectedSwatch ();
    });

    The site in question is on the Suivant ReadyTheme

    It seems to mostly happen if landing directly on a product page and it doesn't seem to happen all the time.

    It's happening in an incognito too which I confirmed and seems to be more frequent in an incognito window.

    It also intermittently happens while browsing from page to page but there seems to be no rhyme or reason to it.

    Any help is appreciated.

    Thanks.

    #2
    I should have searched more. I found my answer here:

    https://www.miva.com/forums/forum/ir...n-my-prod-page

    Removed the deferred setting from the attribute machine in the head and body and all is good in Miva land.

    Comment


      #3
      I spoke too soon.

      Now the price does not update when clicking the plus or minus button for the quantity.

      No console errors either.

      Comment


        #4
        Sounds like you have a bit of a moving target. You may check the loading order of your scripts as well as altering from defer to async depending on the script location.
        Matt Zimmermann
        Front-End Development Director / Miva, Inc.

        Comment


          #5
          Matt Zimmermann yeah its a moving target alright.

          What is weird is even when I reverted back to the non deferred scripts and turned the Defer Loading of JavaScript setting off under Search Settings this file /mm5/clientside.mvc?T=5afee121&amp;M=1&amp;Filename=run time_ui.js still had the async and defer attributes when checking the elements in chrome's dev tools.

          Th order of everything called in on the page seems to be correct on the PROD page template.

          Code:
          head>
              meta charset="utf-8" />
              meta name="viewport" content="width=device-width, initial-scale=1" />
              base href="&mvt:global:basehref;" />
              Conditional for title>&mvt:product:name;: &mvt:store:name; /title>
              mvt:item name="readytheme" param="contentsection( 'HT_high_priority' )" />
                  the above contains the following in this order
                  preconnect/prefetch browser hints for third party tracking scripts
                  link rel="preload" as="style" href="fonts. googleapis .com /css2?family=Maven+Pro:[email protected];500;700;900&display =swap" />
                  link rel="stylesheet" href="fonts. googleapis .com/css2?family=Maven+Pro:[email protected];500;700;900&display =swap" />
                  mvt:item name="head" param="css_list" />
                  mvt:item name="readytheme" param="contentsection( 'google_tag_manager' )" />
                      the above contains google tag manager data layer and container script
              mvt:item name="head" param="head_tag" />
                  the above contains the following in this order
                  Conditionals for the canonical links
                  mvt:item name="prodctgy_meta" param="combined" />
                  mvt:assign name="g.cookie_count" value="miva_struct_members( g.request_cookies, g.cookies )" />
                  mvt:assign name="l.settings:cookieName" value="'mm5-' $ g.store:code $ '-basket-id'" />
                  mvt:assign name="g.cookiesDisabled" value="0" />
                  mvt:foreach iterator="cookie" array="global:cookies">
                      mvt:if expr="g.cookiesDisabled EQ 1">
                          mvt:foreachcontinue />
                      /mvt:if>
                      mvt:if expr="l.settings:cookie EQ l.settings:cookieName AND ISNULL miva_variable_value('g.request_cookies:' $ l.settings:cookie)">
                          mvt:assign name="g.cookiesDisabled" value="1" />
                      /mvt:if>
                  /mvt:foreach>
              SOCIAL Meta tags follow
          /head>
          The mvt:item name="product_display_imagemachine" param="body_deferred:product:id" /> is in the Product Display Item

          The mvt:item name="attributemachine" param="body_deferred" /> is in the Template just underneath mvt:item name="product_display" />

          The mvt:item name="head" param="footer_js" /> is placed in the global footer and is called in on the page template just before the closing body tag as it should be.

          The order of the scripts in the in that resource group are as follows:

          dom (vendor.min.js (jquery 3.6.0))
          plugins (plugins.js)
          scripts (scripts.js)

          The mvt:item name="head" param="footer_js" /> is not the last item in the global footer.

          It is followed by:

          mvt:item name="runa_client" param="page_insert" />
          mvt:item name="ups" />
          mvt:item name="readytheme" param="contentsection( 'noscript_tracking_global' )" /> (noscript 3rd party tracking)


          Not sure if anything other than those second and third to last items in the global footer are the culprits here.

          Nothing really seems out of place other than those items.

          I'm quite confused. Thank you for responding though.
          Last edited by SidFeyDesigns; 06-21-22, 11:13 AM.

          Comment


            #6
            Is this something that recently started happening or has it just become more prevalent? This might be something for Support to look into so day can get into the code.
            Matt Zimmermann
            Front-End Development Director / Miva, Inc.

            Comment


              #7
              Matt Zimmermann unfortunately I don't have a great estimate on when it started happening. I will direct the them to support. Thanks.

              Comment

              Working...
              X