Project- PTC-799
Requirement:
The current website behavior when you land on an item page is that it shows “in stock” based on a default item – it is only when you click on a color that it will reflect the inventory for that particular item.
Remove the “In Stock” notice altogether on the landing page so that you can only view inventory when you click into the color.
Solution:
Extend the pdp options view in the extension created for pdp page.
_.extend(ProductOptionsView.prototype, {
initialize: _.wrap(ProductOptionsView.prototype.initialize, function (fn) {
try{
var context = fn.apply(this, _.toArray(arguments).slice(1));
var isMatrixitem = pdp.getAllMatrixChilds().length;
console.log("isMatrixitem",isMatrixitem);
if(isMatrixitem==0){
console.log("non matrix item")
_.defer(function(){
jQuery(".inventory-display-message-text").show();
})
}
else{
console.log("matrix item")
_.defer(function(){
jQuery(".inventory-display-message-text").hide();
})
}
return context;
}
catch(e){
console.log("err@options", e);
}
}),
events: {
'click [data-action="changeOption"]': 'displayOption'
},
displayOption: function () {
console.log('options show');
_.defer(function(){
jQuery(".inventory-display-message-text").show();})
}
})