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;
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:
Firefox:
magento2
add a comment |
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:
Firefox:
magento2
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
add a comment |
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:
Firefox:
magento2
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:
Firefox:
magento2
magento2
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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.
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
add a comment |
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
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
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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