Popup warning

issue: ACTEN-108915 - Popup warning




popup looks like this





1. Step
To add admin setting on shop account section , need to update ShopAccount.cs
 Sana.Commerce.Sdk\DomainModel\Shop\ShopAccount.cs




2. Step
by creating these field need to create 2 fields in DB >



3.Step

Create ExtendedShopAccountModel to map ShopAccount DB  Fields
we hide the versionMessageDate Field by display  = false 




4.Step
Register ExtendedShopAccountModel in Addon.cs

5.Step
Add admin setting text to Admin. resx


6.Step
by default Show Version Warning need to be ENABLE. so need to override  CreateGet() 
and register it adminarearegistration.cs






Now admin settings are completed.


7.Step
Create a new popup for this issue.




8. now when user go to the Product detail page of a product then  click add to cart button


when admin settings are  getting the cashing need to update






when click add to cart button popup need to be open

for that, we create an ajax call.




var showAddtoCartVersionPopup = function (type) {

            var data = getLines(type);
            if (data.length > 0) {
                return $.ajax({
                    url: Sana.Urls.Home() + 'Basket/IsShowVirsionPopup',
                    type: 'GET',
                    data: { IsPopupShow: "true" },
                    dataType: 'json',
                    success: function (data) {
                        if (data === "True") {
                            var popup = $('#SparePartVirstionPopup');
                            Sana.Popup.open('#SparePartVirstionPopup');
                            return;
                        }
                        else if (data === "False") {
                            addToBasket(type);
                        }                     
                    },
                    error: function (request, error) {
                        return;                     
                    }
                });
            }
        };



Then RegisterSystemRoutes on ExtendedBasketController




on Web.config we keep virsion woning date .

var VersionWarningDays = ConfigurationManager.AppSettings["VersionWarningDays"];