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

Need to define :

‘js.cookie’

Need to add in 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 });

}

},

based on the cookie i will show the popup for the first time and it will show again when the cookie was cleared

Leave a comment

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