문제

I want to pass an extra class to swatch class which is formed via swatch renderer js based on the stock. The reason is the swatches are not being hidden if they are out of stock. This is what I am trying to do -

$.each($widget.options.jsonConfig.product_information, function () {
                    var item = this;
                    inStock = item.is_in_stock;              
                    if(inStock != true){
                        stockClass = 'hideStock';
                    } else{
                        stockClass = 'showStock';
                    }                 
                });


                attr =+
                    ' id="' + controlId + '-item-' + id + '"' +
                    ' aria-checked="false"' +
                    ' aria-describedby="' + controlId + '"' +
                    ' tabindex="0"' +
                    ' option-type="' + type + '"' +
                    ' option-id="' + id + '"' +
                    ' option-label="' + label + '"' +
                    ' aria-label="' + label + '"' +
                    ' option-tooltip-thumb="' + thumb + '"' +
                    ' option-tooltip-value="' + value + '"' +
                    ' title="' + stockClass + '"' +
                    ' class="' + stockClass + '"' +
                    ' role="option"';

The title is coming in the div, but not class. But the title is not coming correctly too. Its somehow looping twice. or Giving incorrect result.

도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top