Skip to content

Issues #10559 - Extend swatch using mixins (M2.2) #12929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 16, 2018
Merged

Issues #10559 - Extend swatch using mixins (M2.2) #12929

merged 11 commits into from
Mar 16, 2018

Conversation

srenon
Copy link
Member

@srenon srenon commented Dec 29, 2017

Description

Fixed Issues (if relevant)

#10559: Extending swatch functionality using javascript mixins does not work in Safari and MS Edge

Manual testing scenarios

  1. See testing instruction in Extending swatch functionality using javascript mixins does not work in Safari and MS Edge #10559

@ishakhsuvarov ishakhsuvarov self-assigned this Jan 4, 2018
@ishakhsuvarov ishakhsuvarov added this to the January 2018 milestone Jan 4, 2018
@okorshenko okorshenko modified the milestones: January 2018, February 2018 Feb 7, 2018
@okorshenko okorshenko modified the milestones: February 2018, March 2018 Mar 1, 2018
@magento-engcom-team magento-engcom-team merged commit d4fa8a5 into magento:2.2-develop Mar 16, 2018
rostyslav-hymon pushed a commit to rostyslav-hymon/magento2 that referenced this pull request Mar 22, 2018
rostyslav-hymon pushed a commit to rostyslav-hymon/magento2 that referenced this pull request Mar 22, 2018
@nicobatty
Copy link

nicobatty commented May 2, 2018

Thanks a lot @srenon for your fix!

By the way, it seems like this file have the same issue on the product view form for the price-box mixin support:

<script>
require([
'jquery',
'priceBox'
], function($){
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() ?>});
});
</script>

I applied the same method you did for the price-box on the listing which seems to work.

For those wondering, I replaced it with this:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants