Beispiel #1
0
        private void CheckForType(HtmlTemplateType checkType, List <HtmlTemplate> existing)
        {
            var existCount = existing.Where(y => y.TemplateType == checkType).Count();

            if (existCount < 1)
            {
                var standard = GetDefaultTemplate(checkType);
                if (standard != null)
                {
                    standard.Id      = 0;
                    standard.StoreId = Context.CurrentStore.Id;
                    HtmlTemplates.Create(standard, true);
                    existing.Add(standard);
                }
            }
        }
Beispiel #2
0
        public HtmlTemplate GetHtmlTemplateOrDefault(HtmlTemplateType templateType)
        {
            var existing = HtmlTemplates.FindByStoreAndType(Context.CurrentStore.Id, templateType);

            if (existing == null)
            {
                var standard = GetDefaultTemplate(templateType);

                if (standard != null)
                {
                    standard.Id      = 0;
                    standard.StoreId = Context.CurrentStore.Id;
                    HtmlTemplates.Create(standard, true);
                }

                return(standard);
            }

            return(existing);
        }