Ejemplo n.º 1
0
        /// <summary>
        /// for elbuz import
        /// </summary>
        /// <param name="strCategory"></param>
        /// <returns></returns>
        public static int SubParseAndCreateCategory(string strCategory)
        {
            int categoryId = -1;

            //
            // strCategory "[Техника >> Игровые приставки >> PlayStation]-10;[....]" (10 - порядок сортировки товара в категории(* необязательно))
            //
            foreach (string strT in strCategory.Split(new[] { ';' }))
            {
                var st = strT;
                st = st.Replace("[", "");
                st = st.Replace("]", "");
                int      parentId = 0;
                string[] temp     = st.Split(new[] { ">>" }, StringSplitOptions.RemoveEmptyEntries);

                for (int i = 0; i <= temp.Length - 1; i++)
                {
                    string name = temp[i].Trim();
                    if (!String.IsNullOrEmpty(name))
                    {
                        var cat = GetChildCategoryIdByName(parentId, name);
                        if (cat.HasValue)
                        {
                            parentId   = cat.Value;
                            categoryId = cat.Value;
                        }
                        else
                        {
                            parentId = AddCategory(new Category
                            {
                                Name             = name,
                                ParentCategoryId = parentId,
                                //Picture = string.Empty,
                                SortOrder            = 0,
                                Enabled              = true,
                                DisplayChildProducts = false,
                                UrlPath              = UrlService.GetAvailableValidUrl(0, ParamType.Category, name),
                                DisplayStyle         = DisplayStyle.List.ToString(),
                                Meta = MetaInfoService.GetDefaultMetaInfo(MetaType.Category, name)
                            }, false);
                        }
                    }
                    if (i == temp.Length - 1)
                    {
                        categoryId = parentId;
                    }
                }
            }
            return(categoryId);
        }
Ejemplo n.º 2
0
        protected MetaInfo SetMeta(MetaInfo meta, string name = null, string categoryName = null, string brandName = null, string price = null, int page = 0)
        {
            var newMeta = meta != null ? (MetaInfo)meta.Clone() : MetaInfoService.GetDefaultMetaInfo(); // Creating new object to modify - keeping original Meta for cache

            if (page > 1)
            {
                newMeta.Title           += Resource.Client_Catalog_PageIs + page;
                newMeta.H1              += Resource.Client_Catalog_PageIs + page;
                newMeta.MetaDescription += Resource.Client_Catalog_PageIs + page;
            }

            SetMetaTags(MetaInfoService.GetFormatedMetaInfo(newMeta, name, categoryName, brandName, price));

            return(newMeta);
        }
Ejemplo n.º 3
0
        protected void SetMeta(MetaInfo meta, string name)
        {
            MetaInfo newMeta = meta != null?meta.DeepClone() : MetaInfoService.GetDefaultMetaInfo();   // Creating new object to modify - keeping original Meta for cache

            SetMetaTags(MetaInfoService.GetFormatedMetaInfo(newMeta, name));
        }