Can someone explain me what the following code says in product-media.js :

 getCompatibleProductImages: function(productFallback, selectedLabels) {
        //find compatible products
        var compatibleProducts = [];
        var compatibleProductSets = [];
        selectedLabels.each(function(selectedLabel) {
            if(!productFallback['option_labels'][selectedLabel]) {

            var optionProducts = productFallback['option_labels'][selectedLabel]['products'];

            //optimistically push all products
            optionProducts.each(function(productId) {

        //intersect compatible products
        compatibleProductSets.each(function(productSet) {
            compatibleProducts = ConfigurableMediaImages.arrayIntersect(compatibleProducts, productSet);

        return compatibleProducts;

What does the compatible products & intersect compatible products mean in above code? please someone explain me clearly.

Your Answer

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

Browse other questions tagged or ask your own question.