Price-box.js overriding via Mixin bug - Magento 2.3Magento 2 Installation BugMagento2 override admin js fileoverriding/extending price-options.js does not workMixin js file in Magento 2What is mixin in Magento 2?Cannot upgrade from 2.2.7 to 2.3 via composer | Magento2Magento 2.3 : How to create product attribute via declarative schemaMagento 2 - js mixinMagento upgrade from 2.3 to 2.3.1 via CLI errorMagento 2 Custom Product Price Calculation and Overriding Cart Totals

Can my Boyfriend, who lives in the UK and has a Polish passport, visit me in the USA?

Stuffing in the middle

How does turbine efficiency compare with internal combustion engines if all the turbine power is converted to mechanical energy?

Church Booleans

How could Tony Stark wield the Infinity Nano Gauntlet - at all?

Default camera device to show screen instead of physical camera

Is there a commercial liquid with refractive index greater than n=2?

How does the Saturn V Dynamic Test Stand work?

What happens when two creatures actually share the same turn?

In xXx, is Xander Cage's 10th vehicle a specific reference to another franchise?

Writing/buying Seforim rather than Sefer Torah

What is the evidence on the danger of feeding whole blueberries and grapes to infants and toddlers?

Why doesn't mathematics collapse down, even though humans quite often make mistakes in their proofs?

What professions does medieval village with a population of 100 need?

Why doesn't the Falcon-9 first stage use three legs to land?

Can my boss not paying for hours I put in to clean bar after we close?

Count the frequency of items in an array

Can a Beast Master ranger choose a swarm as an animal companion?

Why are there fixed target experiments?

How to dismiss intrusive questions from a colleague with whom I don't work?

Nuclear decay triggers

Vacuum collapse -- why do strong metals implode but glass doesn't?

Why should someone be willing to write a strong recommendation even if that means losing a undergraduate from their lab?

How do you call it when two celestial bodies come as close to each other as they will in their current orbits?



Price-box.js overriding via Mixin bug - Magento 2.3


Magento 2 Installation BugMagento2 override admin js fileoverriding/extending price-options.js does not workMixin js file in Magento 2What is mixin in Magento 2?Cannot upgrade from 2.2.7 to 2.3 via composer | Magento2Magento 2.3 : How to create product attribute via declarative schemaMagento 2 - js mixinMagento upgrade from 2.3 to 2.3.1 via CLI errorMagento 2 Custom Product Price Calculation and Overriding Cart Totals






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Overriding 'Magento_Catalog/js/price-box' via mixin works in only Chrome and I can't understand why. Other jQuery widgets overriding works fine (breadcrumb, swatch-renderer)



$path-to-theme / requirejs-config.js



var config = 
config:
mixins:
'Magento_Catalog/js/price-box':
'Magento_Catalog/js/custompricebox': true
,


;


$path-to-theme / Magento_Catalog/web/js/custompricebox.js



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

return function (priceBox)
return $.widget('mage.priceBox', priceBox,
_init: function ()
this._super();
console.log('Hello theme!');

);

);


And it's works only in Chrome. Screenshots:



Chrome:



enter image description here



Firefox:



enter image description here










share|improve this question
























  • This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

    – Renon Stewart
    Aug 15 at 14:53

















0















Overriding 'Magento_Catalog/js/price-box' via mixin works in only Chrome and I can't understand why. Other jQuery widgets overriding works fine (breadcrumb, swatch-renderer)



$path-to-theme / requirejs-config.js



var config = 
config:
mixins:
'Magento_Catalog/js/price-box':
'Magento_Catalog/js/custompricebox': true
,


;


$path-to-theme / Magento_Catalog/web/js/custompricebox.js



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

return function (priceBox)
return $.widget('mage.priceBox', priceBox,
_init: function ()
this._super();
console.log('Hello theme!');

);

);


And it's works only in Chrome. Screenshots:



Chrome:



enter image description here



Firefox:



enter image description here










share|improve this question
























  • This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

    – Renon Stewart
    Aug 15 at 14:53













0












0








0








Overriding 'Magento_Catalog/js/price-box' via mixin works in only Chrome and I can't understand why. Other jQuery widgets overriding works fine (breadcrumb, swatch-renderer)



$path-to-theme / requirejs-config.js



var config = 
config:
mixins:
'Magento_Catalog/js/price-box':
'Magento_Catalog/js/custompricebox': true
,


;


$path-to-theme / Magento_Catalog/web/js/custompricebox.js



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

return function (priceBox)
return $.widget('mage.priceBox', priceBox,
_init: function ()
this._super();
console.log('Hello theme!');

);

);


And it's works only in Chrome. Screenshots:



Chrome:



enter image description here



Firefox:



enter image description here










share|improve this question














Overriding 'Magento_Catalog/js/price-box' via mixin works in only Chrome and I can't understand why. Other jQuery widgets overriding works fine (breadcrumb, swatch-renderer)



$path-to-theme / requirejs-config.js



var config = 
config:
mixins:
'Magento_Catalog/js/price-box':
'Magento_Catalog/js/custompricebox': true
,


;


$path-to-theme / Magento_Catalog/web/js/custompricebox.js



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

return function (priceBox)
return $.widget('mage.priceBox', priceBox,
_init: function ()
this._super();
console.log('Hello theme!');

);

);


And it's works only in Chrome. Screenshots:



Chrome:



enter image description here



Firefox:



enter image description here







magento2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 17:04









ArthanisArthanis

451 silver badge8 bronze badges




451 silver badge8 bronze badges















  • This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

    – Renon Stewart
    Aug 15 at 14:53

















  • This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

    – Renon Stewart
    Aug 15 at 14:53
















This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

– Renon Stewart
Aug 15 at 14:53





This should be fixed in the next release of Magento > 2.3.2 .. github.com/magento/magento2/pull/24054

– Renon Stewart
Aug 15 at 14:53










2 Answers
2






active

oldest

votes


















1














The problem was that the price-box widget was called this way in the module-catalog/view/frontend/templates/product/view/form.phtml:



priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


in this script section:



var dataPriceBoxSelector = '[data-role=priceBox]',
dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

priceBoxes = priceBoxes.filter(function(index, elem)
return !$(elem).find('.price-from').length;
);

priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


If you override this template and call the priceBox widget this way, it works:



<script type="text/x-magento-init">

"[data-role=priceBox]":
"Magento_Catalog/js/price-box":
"priceConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>



</script>


With this way, you can't filter the price boxes.






share|improve this answer



























  • THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

    – Pol Ravalitera
    Jul 5 at 15:41












  • @PolRavalitera Unfortunately not.

    – Arthanis
    Aug 5 at 11:04


















0














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






share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267502%2fprice-box-js-overriding-via-mixin-bug-magento-2-3%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The problem was that the price-box widget was called this way in the module-catalog/view/frontend/templates/product/view/form.phtml:



    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    in this script section:



    var dataPriceBoxSelector = '[data-role=priceBox]',
    dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
    priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

    priceBoxes = priceBoxes.filter(function(index, elem)
    return !$(elem).find('.price-from').length;
    );

    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    If you override this template and call the priceBox widget this way, it works:



    <script type="text/x-magento-init">

    "[data-role=priceBox]":
    "Magento_Catalog/js/price-box":
    "priceConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>



    </script>


    With this way, you can't filter the price boxes.






    share|improve this answer



























    • THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

      – Pol Ravalitera
      Jul 5 at 15:41












    • @PolRavalitera Unfortunately not.

      – Arthanis
      Aug 5 at 11:04















    1














    The problem was that the price-box widget was called this way in the module-catalog/view/frontend/templates/product/view/form.phtml:



    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    in this script section:



    var dataPriceBoxSelector = '[data-role=priceBox]',
    dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
    priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

    priceBoxes = priceBoxes.filter(function(index, elem)
    return !$(elem).find('.price-from').length;
    );

    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    If you override this template and call the priceBox widget this way, it works:



    <script type="text/x-magento-init">

    "[data-role=priceBox]":
    "Magento_Catalog/js/price-box":
    "priceConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>



    </script>


    With this way, you can't filter the price boxes.






    share|improve this answer



























    • THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

      – Pol Ravalitera
      Jul 5 at 15:41












    • @PolRavalitera Unfortunately not.

      – Arthanis
      Aug 5 at 11:04













    1












    1








    1







    The problem was that the price-box widget was called this way in the module-catalog/view/frontend/templates/product/view/form.phtml:



    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    in this script section:



    var dataPriceBoxSelector = '[data-role=priceBox]',
    dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
    priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

    priceBoxes = priceBoxes.filter(function(index, elem)
    return !$(elem).find('.price-from').length;
    );

    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    If you override this template and call the priceBox widget this way, it works:



    <script type="text/x-magento-init">

    "[data-role=priceBox]":
    "Magento_Catalog/js/price-box":
    "priceConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>



    </script>


    With this way, you can't filter the price boxes.






    share|improve this answer















    The problem was that the price-box widget was called this way in the module-catalog/view/frontend/templates/product/view/form.phtml:



    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    in this script section:



    var dataPriceBoxSelector = '[data-role=priceBox]',
    dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($_product->getId()) ?>]',
    priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

    priceBoxes = priceBoxes.filter(function(index, elem)
    return !$(elem).find('.price-from').length;
    );

    priceBoxes.priceBox('priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>);


    If you override this template and call the priceBox widget this way, it works:



    <script type="text/x-magento-init">

    "[data-role=priceBox]":
    "Magento_Catalog/js/price-box":
    "priceConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>



    </script>


    With this way, you can't filter the price boxes.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 4 at 13:08

























    answered Apr 4 at 12:49









    ArthanisArthanis

    451 silver badge8 bronze badges




    451 silver badge8 bronze badges















    • THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

      – Pol Ravalitera
      Jul 5 at 15:41












    • @PolRavalitera Unfortunately not.

      – Arthanis
      Aug 5 at 11:04

















    • THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

      – Pol Ravalitera
      Jul 5 at 15:41












    • @PolRavalitera Unfortunately not.

      – Arthanis
      Aug 5 at 11:04
















    THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

    – Pol Ravalitera
    Jul 5 at 15:41






    THANK YOU. Still did not work with that selector, but with .price-box, it works. Did you ever found a proper solution ? I mean without rewriting anything but JS and not phtml ?

    – Pol Ravalitera
    Jul 5 at 15:41














    @PolRavalitera Unfortunately not.

    – Arthanis
    Aug 5 at 11:04





    @PolRavalitera Unfortunately not.

    – Arthanis
    Aug 5 at 11:04













    0














    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






    share|improve this answer





























      0














      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






      share|improve this answer



























        0












        0








        0







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 8 at 0:14









        Renon StewartRenon Stewart

        12.3k1 gold badge21 silver badges46 bronze badges




        12.3k1 gold badge21 silver badges46 bronze badges






























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267502%2fprice-box-js-overriding-via-mixin-bug-magento-2-3%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?