private EventCartButtonViewModel BuildAdminSettingsView(EventCartButtonViewModel settingsData)
        {
            settingsData.AvailableFields.Clear();

            var field = new Field("EventCartButton", "Event Cart Button", FieldTypes.Html, "<a href='#' class='btn btn-primary'>Event Cart</a>");
            settingsData.AvailableFields.Add(field);

            return settingsData;
        }
 private EventCartButtonViewModel BuildPublicSettingsView(ModuleInstanceView parent, EventCartButtonViewModel settingsData, IDictionary<string, string> parameters)
 {
     foreach (var zone in settingsData.StaticPageZones.Select(z => z.Value).Union(settingsData.DynamicPageZones))
     {
         foreach (var column in zone.FieldColumns)
         {
             foreach (var field in column.Fields)
             {
                 if (field.FieldName == "EventCartButton")
                 {
                     var eventCartUrlSetting = settingsData.GetSettingValue("EventCartPageUrl", "#");
                     field.Value = "<a href='" + eventCartUrlSetting + "' class='btn btn-primary'>Event Cart ({{GetNumberOfOccurrences()}})</a>";
                 }
             }
         }
     }
     return settingsData;
 }
        public string GetModelData(ModuleInstanceView parent, string settingsData, IDictionary<string,string> parameters, bool isConfigView)
        {
            EventCartButtonViewModel viewSettings = null;
            if (string.IsNullOrEmpty(settingsData))
                viewSettings = new EventCartButtonViewModel();
            else
                viewSettings = CommonUtils.JsonDeserialize<EventCartButtonViewModel>(settingsData);

            viewSettings.EnsureStandardSettings();

            if (isConfigView)
                viewSettings = BuildAdminSettingsView(viewSettings);
            else
            {
                viewSettings = BuildPublicSettingsView(parent, viewSettings, parameters);
                viewSettings.AvailableFields.Clear();
            }

            return CommonUtils.JsonSerializeMinimum(viewSettings);
        }