How to solve the issue when colors are added on configuration record but it is not shown on website PDP page

Description: When the colors are already added in configuration record Color pallet under the lay out tab. But it is not showing on the website PDP page.

Solution: In this time we can map the values from the colors which having an issue into the PDP page using PDP extension. Extending the ProductViewsOptionView

_.extend(ProductViewsOptionView.prototype, {
                    getContext: _.wrap(ProductViewsOptionView.prototype.getContext, function (fn) {
                        var originalRet = fn.apply(this, _.toArray(arguments).slice(1));
                        var colors = originalRet.values;
                        var self = this;
                        var colorPallete = SC.CONFIGURATION.layout.colorPalette;
                        originalRet.values = _.each(colors, function (line) {
                            var selectedcolor = _.findWhere(colorPallete, { colorName: (line.label).toLowerCase() });
                            if (!_.isEmpty(selectedcolor)) {
                                line.label = selectedcolor.colorValue;
                            }
                        })
                        originalRet.showLabel = true;
                        return originalRet;
                    })
                });

Leave a comment

Your email address will not be published. Required fields are marked *