Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/app/code/Amasty/Label/view/frontend/web/js/configurable/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Amasty/Label/view/frontend/web/js/configurable/configurable.js
define([
    'jquery',
    'underscore',
    'Amasty_Label/js/configurable/reload',
    'Magento_Ui/js/modal/modal'
], function ($, _, reloader) {
    'use strict';

    return function (widget) {
        $.widget('mage.configurable', widget, {
            /**
             * Trigger label reload
             *
             * @return {void}
             */
            _processLabelReload: function () {
                var productId = this.simpleProduct,
                    imageContainer = null,
                    originalProductId = this.options.spConfig['original_product_id'];

                if (this.inProductList) {
                    imageContainer = this.element.closest('li.item').find(this.options.spConfig['label_category']);
                } else {
                    imageContainer = this.element.closest('.column.main').find(this.options.spConfig['label_product']);
                }

                if (!productId) {
                    productId = this.options.spConfig['original_product_id'];
                }

                if (typeof this.options.spConfig['label_reload'] != 'undefined') {
                    reloader.reload(
                        imageContainer,
                        productId,
                        this.options.spConfig['label_reload'],
                        this.inProductList ? 1 : 0,
                        originalProductId
                    );
                }
            },

            /**
             * OVERRIDE
             *
             * @inheritDoc
             */
            _changeProductImage: function (noLabel) {
                if (noLabel !== true) {
                    this._processLabelReload();
                }

                var images,
                    initialImages = this.options.mediaGalleryInitial,
                    gallery = $(this.options.mediaGallerySelector).data('gallery');

                if (_.isUndefined(gallery)) {
                    $(this.options.mediaGallerySelector).on('gallery:loaded', function () {
                        this._changeProductImage(true); // skip label reloading to prevent duplicates
                    }.bind(this));

                    return;
                }

                images = this.options.spConfig.images[this.simpleProduct];

                if (images) {
                    images = this._sortImages(images);

                    if (this.options.gallerySwitchStrategy === 'prepend') {
                        images = images.concat(initialImages);
                    }

                    images = $.extend(true, [], images);
                    images = this._setImageIndex(images);

                    gallery.updateData(images);
                    this._addFotoramaVideoEvents(false);
                } else {
                    gallery.updateData(initialImages);
                    this._addFotoramaVideoEvents(true);
                }
            }
        });

        return $.mage.configurable;
    };
});

Spamworldpro Mini