How to show the popup for the first time based on thc cookies

We can show the popup in plp and pdp page for the first time condition based on the cookies , if the cookies were not there the popup will show if the cookies were catched then the popup will not show

Define

‘js.cookie’

Function

cookie

_.extend(ProductDetailsFullView.prototype, {

initialize:_.wrap(ProductDetailsFullView.prototype.initialize,function(fn){

fn.apply(this,_.toArray(arguments).slice(1));

this.on(‘afterViewRender’, this.showPopupModel, this);

}),

showPopupModel:function () {

var showPopupPDP = cookie.get(“showPopupPDP”);

if (showPopupPDP !== true && showPopupPDP !== “true”) {

let view = new PromotionalpopupView();

view.useLayoutError = true;

container.getLayout().showInModal(view);

cookie.set(“showPopupPDP”, true, { expires: null });

}

},

now it will show the popup based on the cookies

Leave a comment

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