Announcement

Collapse
No announcement yet.

Miva Merchant 9.13.x Bug Reports

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Leanne
    replied
    Ryan,

    Thank you, step 1 fixed the issue for the site I had the issue with as well.

    Leanne

    Leave a comment:


  • SidFeyDesigns
    replied
    Originally posted by rguisewite View Post

    Hey Nick,

    The issue here is likely one of two things, possibly both (without knowing the full context of what you're doing/how you're doing it, it's not possible to know with 100% certainty, but the two things below are likely the culprit).

    1. When you switched over to using async, that first code block (the one declaring var gallery) becomes wrapped in an anonymous function, taking any variable or function declared within that block out of the global context and placing it into the local context. As a result, anything attempting to access "gallery" outside of that block will no longer be able to access it. A simple fix for this is to just change "var gallery = [];" to "window.gallery = [];" and "gallery" becomes defined in the global context. This will 100% lead to the error you have above if left unchanged, because you're attempting to access gallery from prodscripts.min.js

    2. If prodscripts.min.js is NOT loaded asynchronously and happens to be called before the block that sets up "gallery", even if #1 above is changed, you'll still run into JS issues, because that data won't have been created yet. The fix for that is to make sure whatever code is attempting to do stuff based on gallery is done AFTER the above block is run. This can be done the same way we do the above block, by wrapping it in an anonymous (or non-anonymous if it is inside a class) function and triggering it to be run based on the 'imagemachine_initialize' event being fired on the window. See below for an example:

    Code:
    (function( obj, eventType, fn )
    {
    if ( obj.addEventListener )
    {
    obj.addEventListener( eventType, fn, false );
    }
    else if ( obj.attachEvent )
    {
    obj.attachEvent( 'on' + eventType, fn );
    }
    })( window, 'imagemachine_initialize', function()
    {
    // Your code run from prodscripts.min.js attempting to do stuff based on "gallery" should be run here
    });
    Let me know if you have any problems with the above, or need further clarification.

    Ryan
    Hi Ryan,

    Thank you for the super easy fix. Only needed to do #1 from your suggestion.

    "A simple fix for this is to just change "var gallery = [];" to "window.gallery = [];" and "gallery" becomes defined in the global context."

    For others following this thread and needing a fix, this change was made in the Product Display Layout Image Machine head template section.

    And to be more specific, the suivant readytheme is what we use for our site.

    Our PROD pages are now well into the green for google pagespeed score. No more render blocking javascript warnings.

    Thanks again Ryan,

    Nick

    Leave a comment:


  • rguisewite
    replied
    Originally posted by SidFeyDesigns View Post
    Having trouble implementing the deferred and async script features to the PROD image machine. We are on the suiavant ready theme with a slightly altered image machine script.

    I changed the head and body items to the following:

    <mvt:item name="product_display_imagemachine" param="head_deferred" />
    <mvt:item name="product_display_imagemachine" param="body_deferred:product:id" />

    This is the code in the image machine after removing the script tags as instructed.

    Code:
    <mvt:assign name="l.settings:clean:product:name" value="glosub(l.settings:product:name, asciichar(39), '&#39;')" />
    
    var gallery = [],
    thumbnailIndex = 0;
    
    ImageMachine.prototype.ImageMachine_Generate_Thumbnail = function (thumbnail_image, main_image, closeup_image, type_code) {
    var thumbnail,
    img;
    
    thumbnail = document.createElement('span');
    thumbnail.setAttribute('data-index', thumbnailIndex++);
    
    if (typeof(thumbnail_image) == 'string' && thumbnail_image.length > 0) {
    img = document.createElement('img');
    img.src = thumbnail_image;
    thumbnail.appendChild(img);
    };
    if (typeof(closeup_image) == 'string' && closeup_image.length > 0) {
    gallery.push({
    src: closeup_image,
    title: '&mvt:clean:product:name;'
    });
    };
    return thumbnail;
    };
    After I made those changes the images can no longer be clicked on to view the full sized image.

    This is the error the console was giving me.

    Code:
    prodscripts.min.js:4 Uncaught ReferenceError: gallery is not defined
    at HTMLSpanElement.<anonymous> (prodscripts.min.js:4)
    at HTMLSpanElement.dispatch (jquery-3.4.0.min.js:2)
    at HTMLSpanElement.v.handle (jquery-3.4.0.min.js:2)
    (anonymous) @ prodscripts.min.js:4
    dispatch @ jquery-3.4.0.min.js:2
    v.handle @ jquery-3.4.0.min.js:2
    I updated to jquery-3.4.0 before making the changes for the deferred scrip tags and everything was working as normal.

    Thanks in advance for the help.

    -Nick
    Hey Nick,

    The issue here is likely one of two things, possibly both (without knowing the full context of what you're doing/how you're doing it, it's not possible to know with 100% certainty, but the two things below are likely the culprit).

    1. When you switched over to using async, that first code block (the one declaring var gallery) becomes wrapped in an anonymous function, taking any variable or function declared within that block out of the global context and placing it into the local context. As a result, anything attempting to access "gallery" outside of that block will no longer be able to access it. A simple fix for this is to just change "var gallery = [];" to "window.gallery = [];" and "gallery" becomes defined in the global context. This will 100% lead to the error you have above if left unchanged, because you're attempting to access gallery from prodscripts.min.js

    2. If prodscripts.min.js is NOT loaded asynchronously and happens to be called before the block that sets up "gallery", even if #1 above is changed, you'll still run into JS issues, because that data won't have been created yet. The fix for that is to make sure whatever code is attempting to do stuff based on gallery is done AFTER the above block is run. This can be done the same way we do the above block, by wrapping it in an anonymous (or non-anonymous if it is inside a class) function and triggering it to be run based on the 'imagemachine_initialize' event being fired on the window. See below for an example:

    Code:
    (function( obj, eventType, fn )
    {
        if ( obj.addEventListener )
        {
            obj.addEventListener( eventType, fn, false );
        }
        else if ( obj.attachEvent )
        {
            obj.attachEvent( 'on' + eventType, fn );
        }
    })( window, 'imagemachine_initialize', function()
    {
        // Your code run from prodscripts.min.js attempting to do stuff based on "gallery" should be run here
    });
    Let me know if you have any problems with the above, or need further clarification.

    Ryan

    Leave a comment:


  • SidFeyDesigns
    replied
    Originally posted by Leanne View Post


    Did you ever get a resolution to this? I have a site experiencing the same error.
    No I have not been given a resolution for this.

    Glad I'm not the only one experiencing the issue.

    Hopefully they will have a solution for us soon.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Leanne View Post


    Did you ever get a resolution to this? I have a site experiencing the same error.
    Wow, talk about timing. I was just about to post this same issue. I can post a link if need be.

    Leave a comment:


  • Leanne
    replied
    Originally posted by SidFeyDesigns View Post
    Below is the js code the error is referencing in the console for the scripts file

    Uncaught ReferenceError: gallery is not defined
    at HTMLSpanElement.<anonymous> (prodscripts.js:284)


    Code:
    // ---- Open Product Image Gallery ---- //
    
    productGallery: function (trigger) {
    
    trigger.on('click', function (e) {
    
    var startAt = Number($(this).attr('data-index'));
    
    
    
    e.preventDefault();
    
    if (gallery.length > 0) {X
    
    $.magnificPopup.open({
    
    callbacks: {
    
    open: function () {
    
    $.magnificPopup.instance.goTo(startAt);
    
    }
    
    },
    
    gallery: {
    
    enabled: true
    
    },
    
    items: gallery,
    
    type: 'image'
    
    });
    
    }
    
    else {
    
    $.magnificPopup.open({
    
    items: {
    
    src: $('#js-main-image').attr('data-image')
    
    },
    
    type: 'image'
    
    });
    
    };
    
    });
    
    }
    
    
    
    },

    Did you ever get a resolution to this? I have a site experiencing the same error.

    Leave a comment:


  • Eric Foresman
    replied
    Originally posted by delcorsets View Post

    Brennan screenshot attached
    Hi Psydde,

    the column that is reporting the error "Product_Order" is the product display order column. my guess is that someone has set a negative display order for those products at some point. you should be able to fix this by just turning on the "edit display order" and saving the current display order again without making any changes. that should reset everything to a positive value without changing the current display order in any way.

    -Eric

    Leave a comment:


  • kayakbabe
    replied
    Updating products and entering price group sale price on product edit detail.
    This worked before 9.13 update. But now after the update, I can't update the product screen.

    Can't update products in store admin because the store wants a subscription field to have a value in it.
    I get a pop up error message that says "please enter a number"
    when I close the pop-up, the product subscription block is now showing -- NOTE: I have no subscriptions set up at all.
    and the cancellation allowed after ____ fulfilled orders text box is highlighted.

    I even went to the modules list and made all the subscription modules inactive. After doing that, when I update a product in the admin the problem remains.

    NOTE: I did try to update via the catalog:products product list first.. right after I updated to 9.13. So I don't know if the actually bug might have started there... While it appeared to accept my data entry on the all products listing screen (double click on field in row, then click save icon). None of what I entered was saved. So then I went to edit in each individual products admin screen. And that is when experienced the problem I described above. So it seems that I also ran into the bug delcorsets reported about the catalog:products and editing.

    SOLN: I figured out the saleprice table for some reason has prgp_id = 0 for some of the rows. (Probably becuase I tried to create a script to do the data entry and I got it wrong the first time I ran it. ) I manually updated that zero value to the one it should be and now the errors I described above have gone away.

    Psydde, maybe you have a data problem. if some key field has zero when it's expecting values from 1 and up.. that will break some things. I know I was bitten by this in the past on an older version of miva with a bad module. Maybe you have that going on somewhere.
    Last edited by kayakbabe; 05-10-19, 04:43 PM. Reason: updating becuase I figured out some new info

    Leave a comment:


  • delcorsets
    replied
    Originally posted by Brennan View Post
    I'm not aware of that issue, can you post the screenshot you're getting.
    Brennan screenshot attached

    Leave a comment:


  • dcarver
    replied
    Originally posted by dreamingdigital View Post
    Yup.
    <mvt:item name="urls" param="hidden_params:&mvte:global:Screen;:auto" /> is readyTheme code so it's invalid from the theme itself. Might not be in any themes anymore but it was. and yup, that's not correct code but when it comes from the theme you're expecting it to work and looking at our codes for errors. Anyways, super easy fix. Takes 5min with find/replace. No biggie.
    Thanks for that update, we'll make sure we don't use that in any future themes!

    Leave a comment:


  • dreamingdigital
    replied
    Yup.
    <mvt:item name="urls" param="hidden_params:&mvte:global:Screen;:auto" /> is readyTheme code so it's invalid from the theme itself. Might not be in any themes anymore but it was. and yup, that's not correct code but when it comes from the theme you're expecting it to work and looking at our codes for errors. Anyways, super easy fix. Takes 5min with find/replace. No biggie.

    Leave a comment:


  • dcarver
    replied
    Originally posted by Beefy Nugget View Post
    Was there any change to the <mvt:item name="urls" in 9.13? We updated to 9.13 and our url broke when any facets were applied. The url would have "Screen=%26MVTE" and thus cause the product not found page to be displayed.
    The solution I found to fix this was to remove the line
    Code:
    <mvt:item name="urls" param="hidden_params:&mvte:global:Screen;:auto" />
    from the facet layouts.
    Is this a problem anyone else ran into?
    Originally posted by dreamingdigital View Post

    Yes!!!

    Change instance of

    <mvt:item name="urls" param="hidden_params:&mvte:global:Screen;:auto" />

    and replace with

    <mvt:item name="urls" param="hidden_params:_self:auto" />
    Beefy Nugget and dreamingdigital : We were able to figure out exactly what was going on in 9.13.00. The param in
    Code:
    <mvt:item name="urls" param="hidden_params:&mvte:global:Screen;:auto" />
    is invalid and will never work as expected as we do not evaluate store-morph within store-morph. In 9.13.00, as previously mentioned, changes were made to the URLs module to drastically speedup the building of the URLs. The URLs are now built on-demand. With these changes we now support building of non-existent screens if one were to desire to do so. Thus the new module sees "&mvte:global:Screen;:auto" and breaks that into a screen of "&mvte" and the way the "hidden_params" functionality of the module works is it now has a URL pointing to "&mvte" and will output
    Code:
    <input type="hidden" name="Screen" value="&amp;mvte" />
    . There is no bug per-se we will be filing about this. The original template written by Miva was the correct code and is what should be used in this case.
    Code:
    <mvt:item name="urls" param="hidden_params:_self:auto" />
    and I wanted to give you an update on what exactly was going on.

    Leave a comment:


  • Mark Hood
    replied
    My expected behavior for clicking "new order" in the admin from an old order would be that the screen refreshes to that new order.
    Does not appear to be the case while a new order is in fact created. Was this on purpose?

    Leave a comment:


  • Brennan
    replied
    I'm not aware of that issue, can you post the screenshot you're getting.

    Leave a comment:


  • delcorsets
    replied
    Originally posted by Leanne View Post

    I have a site that gets that warning on certain products. The site hasn't been updated yet, so this bug has existed prior to this update.
    Brennan Is this a known bug? I don't think I've seen it mentioned on the forums before.

    Leave a comment:

Working...
X