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/Ecombricks/InventoryConfigurableProduct/view/frontend/web/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/Ecombricks/InventoryConfigurableProduct/view/frontend/web/js/configurable-mixin.js
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
define([
    'jquery',
    'Ecombricks_InventoryCatalog/js/product/source',
    'jquery-ui-modules/widget'
], function ($, source) {
    'use strict';
    
    return function (target) {
        
        $.widget('mage.configurable', target, {
            
            /**
             * Create
             * 
             * @returns {Object}
             */
            _create: function () {
                this._super();
                source.onChange(this.onSourceChange.bind(this));
                this.changeSource();
                return this;
            },

            /**
             * On source change
             * 
             * @returns {Object}
             */
            onSourceChange: function () {
                this.changeSource();
                return this;
            },
            
            /**
             * Set options prices
             * 
             * @returns {Object}
             */
            setOptionsPrices: function () {
                var sourceCode = source.getValue();
                if (sourceCode in this.options.jsonConfig.sourceOptionPrices) {
                    this.options.jsonConfig.optionPrices = this.options.jsonConfig.sourceOptionPrices[sourceCode];
                }
                return this;
            },

            /**
             * Change source
             * 
             * @returns {Object}
             */
            changeSource: function () {
                this.setOptionsPrices();
                this._configureElement();
                return this;
            }
            
        });
        return $.mage.configurable;
    };
    
});

Spamworldpro Mini