Skip to content

Fix for amasty labels

Magefan edited this page Jul 31, 2020 · 1 revision

To fix the issue need override this Amasty file

app/code/Amasty/Label/view/base/web/js/label.js

using theme (created file):

app/design/frontend/ThemeVendor/themename/Amasty_Label/web/js/label.js

and added to it this code

/* Start custom fix for magefan lazy load */

        `this.image      = this.element.find('.amasty-label-image');`

        `var self = this;`

        `if (this.image.attr('src').indexOf('Magefan_LazyLoad/images/pixel.jpg') != -1) {`

            `this.image.load(function () {`

                `self._create();`

            `});`

            `this.image.attr(`

                `'src',`

                `this.image.data('original')`

            `);`

            `return;`

        `}`

        `/* End */`

right after _create function start and this.element = $(this.element);

Clone this wiki locally