Magento2: Magento 2.3 - Issue to override price-box.js using mixin(In Firefox 66.0.2 version)

Created on 15 Apr 2019  路  23Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.3 (Firefox 66.0.2 (64-bit) version)
  2. Magento 2.3.1 (Firefox 66.0.2 (64-bit) version)
  3. Magento 2.2.8 (Firefox 66.0.2 (64-bit) version)

Steps to reproduce (*)

  1. Override updatePrice function(Magento_Catalog/js/price-box) using a mixin.
  2. File call using mixin properly but the updatePrice function is not called. (In chrome working fine, but in Firefox not working.)

Expected result (*)

  1. updatePrice function is call properly in all browser.

Actual result (*)

  1. updatePrice function is not call in Firefox.
Fixed in 2.3.x Format is valid needs update

Most helpful comment

@AlexWorking
I understand that you need to clean the backlog, but really. Stop closing every issue wih "no activity" or "i can't reproduce it". It's fucking not true. I've already read the same exact pb on 2 anothers tickets :

https://github.com/magento/magento2/issues/7322
https://github.com/magento/magento2/issues/14118

It's really annoying when you encounter a real problem, to see that it's as nobody cares about community...

edit: and hooray, a guy found a "fix"
https://magento.stackexchange.com/questions/267502/price-box-js-overriding-via-mixin-bug-magento-2-3
edit2: i had to put another selector than the one written in the stackExchange, but definetly, the mixin is working properly this way.
But still, does not work the way it should work...

All 23 comments

Hi @miteshdhaduk. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@miteshdhaduk do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

We are making a mix of priceBox and exactly the same thing happens to us. In Chrome it works but in Firefox it does not.

@raumatbel Have you fix it or not?

Hello, I have had the same problem in Magento 2.2.6

Hello, I have had the same problem in Magento 2.2.6

Have you fix it or not?

At this time, the problem is not fixed @miteshdhaduk

Hi @niravkrish. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

@lionelalvarez @miteshdhaduk
It's my code and working fine to me.

requirejs-config.js

var config = 
{
    config: 
    {
        mixins: 
        {
            'Magento_Catalog/js/price-box':
            {
                'Vendor_Module/js/price-box': true
            }
        }
    }
};

price-box.js

define([
    'jquery',
    'Magento_Catalog/js/price-utils',
    'underscore',
    'mage/template',
    'jquery/ui'
], function ($, utils, _, mageTemplate) 
{
    'use strict';

    return function (widget) 
    {
        $.widget('mage.priceBox', widget, 
        {
            updatePrice: function updatePrice(newPrices) {
            {
                // Custom code
            }
        });

        return $.mage.priceBox;
    }
});

@mageprashant Yes, you are right. But this is not working in Magento 2.2.8 and Magento 2.3.*(Not working in Firefox).

@lionelalvarez @miteshdhaduk
It's my code and working fine to me.

requirejs-config.js

var config = 
{
    config: 
    {
        mixins: 
        {
            'Magento_Catalog/js/price-box':
            {
              'Vendor_Module/js/price-box': true
            }
        }
    }
};

price-box.js

define([
  'jquery',
  'Magento_Catalog/js/price-utils',
  'underscore',
  'mage/template',
  'jquery/ui'
], function ($, utils, _, mageTemplate) 
{
  'use strict';

  return function (widget) 
  {
      $.widget('mage.priceBox', widget, 
      {
          updatePrice: function updatePrice(newPrices) {
          {
              // Custom code
          }
      });

      return $.mage.priceBox;
  }
});

Code Is working Fine with Magento 2.3.
I am also check in Firefox Browser.

@mageprashant @niravkrish Yes you are right. But this is not work in Firefox 66.0.2 (64-bit) version.

@ajijshekh123 Why you closed it?

Sorry, @miteshdhaduk It was by mistake close the issue.

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi @miteshdhaduk thank you for you report, i褦m not able to reproduce followings steps you described on clean magento 2.3-develop and Firefox 66.0.2 (64-bit) version. please refer to -> Community Forums or the Magento Stack Exchange

@engcom-backlog-nazar I used php7.2.17. And currently I also checked and it is not working. I override updatePrice function using mixin. File execute but the function is not called.

Hello @engcom-backlog-nazar

I have checked this issue with the fresh installation (Magento 2.3.*) in my local system. with the Firefox latest version. I have also attached the gif over here.

ezgif com-video-to-gif

Hi @DeepPopat so please provide exact steps to reproduce not a gif.

Hi all - Firefox engineer here. In 66 we added support for window.event and changed the value of keyCode inside a keypress event handler (to match what Chrome does). So rather than be 0, it will be set to the same value as charCode.

We also don't dispatch keypress for non-printable keys: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Compatibility_notes

So if you had Firefox-specific keypress handling, you should be able to just use whatever you were sending to Chrome for 66+. For older versions, you can use the absence of window.event as a signal it will need the legacy behavior.

I'm not familiar with magento code, or if this component uses keypress... but I'm happy to help if someone who is more familiar with magento can help me. :)

Hi, @miteshdhaduk. We are closing this issue due to inactivity.

@AlexWorking
I understand that you need to clean the backlog, but really. Stop closing every issue wih "no activity" or "i can't reproduce it". It's fucking not true. I've already read the same exact pb on 2 anothers tickets :

https://github.com/magento/magento2/issues/7322
https://github.com/magento/magento2/issues/14118

It's really annoying when you encounter a real problem, to see that it's as nobody cares about community...

edit: and hooray, a guy found a "fix"
https://magento.stackexchange.com/questions/267502/price-box-js-overriding-via-mixin-bug-magento-2-3
edit2: i had to put another selector than the one written in the stackExchange, but definetly, the mixin is working properly this way.
But still, does not work the way it should work...

@miteshdhaduk... is this issue fixed?

This should fix the filtering issue

<script type="text/x-magento-init">
    {
        "[data-role=priceBox][data-price-box=product-id-<?= $block->escapeHtml($_product->getId()) ?>]": {
            "Magento_Catalog/js/price-box": {
                "priceConfig":  <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>
            }
        }
    }
</script>

See /app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml and https://github.com/magento/magento2/pull/12929

Hi @miteshdhaduk. Thank you for your report.
The issue has been fixed in magento/magento2#24054 by @srenon in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.4 release.

Was this page helpful?
0 / 5 - 0 ratings