0

in my app\code\X\Y\view\frontend\requirejs-config.js I have:

var config = {
    map: {
        '*': {
            'configurable':'X_Y/js/configurable',
            'swatchRenderer':'X_Y/js/swatchRenderer'

        }
    }
};

in my app\code\X\Y\view\frontend\web\js\swatch_renderer.js I have

define([
    'jquery',
    'underscore',
    'Magento_Swatches/js/swatchRenderer'
], function ($, _, swatchRenderer) {
    'use strict';
    _.extend(swatchRenderer.prototype, {

        _UpdatePrice: function () {
            var $widget = this,
                $product = $widget.element.parents($widget.options.selectorProduct),
                $productPrice = $product.find(this.options.selectorProductPrice),
                options = _.object(_.keys($widget.optionsMap), {}),
                result;

            $widget.element.find('.' + $widget.options.classes.attributeClass + '[option-selected]').each(function () {
                var attributeId = $(this).attr('attribute-id');

                options[attributeId] = $(this).attr('option-selected');
            });

            result = $widget.options.jsonConfig.optionPrices[_.findKey($widget.options.jsonConfig.index, options)];
            console.log("testing override");
            $productPrice.trigger(
                'updatePrice',
                {
                    'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
                }
            );

        },
    });
});

any idea why it is not working?

  • kindly mention above file path so i can get some idea. – Suresh Chikani Sep 23 '16 at 17:33
  • path is added - thanks for looking into this. – MageDevBrossard Sep 23 '16 at 17:41
  • Have you deploy static content or not ? – Suresh Chikani Sep 23 '16 at 17:45
  • Yes . just deployed: php bin/magento setup:di:compile – MageDevBrossard Sep 23 '16 at 17:53
  • Which version you have tried? – Sohel Rana Sep 23 '16 at 18:33
0

You have to follow bellow steps.

Delete var folder

Delete all files and folder inside pub/static/

Run bellow command for deploy content:

php bin/magento setup:static-content:deploy

Delete browser cache.

Now you can check your changes is deploy or not.

Let me know if you have any difficulty.

  • I can see /pub/static/frontend/Magento/luma/en_US/X_Y/js/swatch-renderer.js but, it is still not working. – MageDevBrossard Sep 23 '16 at 18:16
  • Your theme is luma ? – Suresh Chikani Sep 23 '16 at 18:24
  • Yes, it is Luma theme. – MageDevBrossard Sep 23 '16 at 18:33
  • Now check file code which is run from core file or you module file. you can find out it in Network by inspect element. – Suresh Chikani Sep 23 '16 at 18:43
  • I have this in my custom function console.log("testing override"); since i see nothing in my console, it means that the code is never executed. – MageDevBrossard Sep 23 '16 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.