public static MetaInfo GetFormatedMetaInfo(MetaInfo meta, string name, string categoryName = null, string brandName = null) { if (meta != null) { if (string.IsNullOrEmpty(meta.Title)) { meta.Title = SettingsSEO.GetDefaultTitle(meta.Type) ?? SettingsSEO.DefaultMetaTitle; } if (string.IsNullOrEmpty(meta.MetaKeywords)) { meta.MetaKeywords = SettingsSEO.GetDefaultMetaKeywords(meta.Type) ?? SettingsSEO.DefaultMetaKeywords; } if (string.IsNullOrEmpty(meta.MetaDescription)) { meta.MetaDescription = SettingsSEO.GetDefaultMetaDescription(meta.Type) ?? SettingsSEO.DefaultMetaKeywords; } if (string.IsNullOrEmpty(meta.H1)) { meta.H1 = SettingsSEO.GetDefaultH1(meta.Type) ?? String.Empty; } meta.Title = GlobalStringVariableService.TranslateExpression(meta.Title, meta.Type, name, categoryName, brandName); meta.MetaKeywords = GlobalStringVariableService.TranslateExpression(meta.MetaKeywords, meta.Type, name, categoryName, brandName); meta.MetaDescription = GlobalStringVariableService.TranslateExpression(meta.MetaDescription, meta.Type, name, categoryName, brandName); meta.H1 = GlobalStringVariableService.TranslateExpression(meta.H1, meta.Type, name, categoryName, brandName); } return meta; }
public static void SetMeta(MetaInfo meta) { if (IsMetaExist(meta.ObjId, meta.Type)) { UpdateMetaInfo(meta); } else { meta.MetaId = InsertMetaInfo(meta); } }
private static void UpdateMetaInfo(MetaInfo meta) { SQLDataAccess.ExecuteNonQuery( "UPDATE [SEO].[MetaInfo] SET [Title] = @Title, [MetaKeywords] = @MetaKeywords,[MetaDescription] = @MetaDescription, [H1]=@H1 where ObjId=@ObjId and Type=@Type", CommandType.Text, new SqlParameter("@Title", meta.Title ?? SettingsSEO.DefaultMetaTitle), new SqlParameter("@MetaKeywords", meta.MetaKeywords ?? SettingsSEO.DefaultMetaKeywords), new SqlParameter("@MetaDescription", meta.MetaDescription ?? SettingsSEO.DefaultMetaDescription), new SqlParameter("@H1", meta.H1 ?? SettingsSEO.DefaultH1 ?? string.Empty), new SqlParameter("@ObjId", meta.ObjId), new SqlParameter("@Type", meta.Type.ToString())); }
private static int InsertMetaInfo(MetaInfo meta) { var id = SQLDataAccess.ExecuteScalar <int>("[SEO].[sp_AddMetaInfo]", CommandType.StoredProcedure, new SqlParameter("@Title", meta.Title ?? SettingsSEO.DefaultMetaTitle), new SqlParameter("@MetaKeywords", meta.MetaKeywords ?? SettingsSEO.DefaultMetaKeywords), new SqlParameter("@MetaDescription", meta.MetaDescription ?? SettingsSEO.DefaultMetaDescription), new SqlParameter("@H1", meta.H1 ?? SettingsSEO.DefaultH1 ?? string.Empty), new SqlParameter("@ObjId", meta.ObjId), new SqlParameter("@Type", meta.Type.ToString())); return(id); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; LoadData(); var nmeta = new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_Brands_Header)); SetMeta(nmeta, string.Empty, page: paging.CurrentPage); header.Text = Resource.Client_Brands_Header; if (paging.CurrentPage > 1) { header.Text = header.Text + Resource.Client_Catalog_PageIs + paging.CurrentPage; } }
public static MetaInfo GetFormatedMetaInfo(MetaInfo meta, string name) { if (meta != null) { if (string.IsNullOrEmpty(meta.Title)) { meta.Title = SettingsSEO.GetDefaultTitle(meta.Type) ?? SettingsSEO.DefaultMetaTitle; } if (string.IsNullOrEmpty(meta.MetaKeywords)) { meta.MetaKeywords = SettingsSEO.GetDefaultMetaKeywords(meta.Type) ?? SettingsSEO.DefaultMetaKeywords; } if (string.IsNullOrEmpty(meta.MetaDescription)) { meta.MetaDescription = SettingsSEO.GetDefaultMetaDescription(meta.Type) ?? SettingsSEO.DefaultMetaKeywords; } meta.Title = GlobalStringVariableService.TranslateExpression(meta.Title, meta.Type, name); meta.MetaKeywords = GlobalStringVariableService.TranslateExpression(meta.MetaKeywords, meta.Type, name); meta.MetaDescription = GlobalStringVariableService.TranslateExpression(meta.MetaDescription, meta.Type, name); } return(meta); }
private static void UpdateMetaInfo(MetaInfo meta) { SQLDataAccess.ExecuteNonQuery("UPDATE [SEO].[MetaInfo] SET [Title] = @Title,[MetaKeywords] = @MetaKeywords,[MetaDescription] = @MetaDescription where ObjId=@ObjId and Type=@Type", CommandType.Text, new[] { new SqlParameter { ParameterName = "@Title", Value = meta.Title ?? SettingsSEO.DefaultMetaTitle }, new SqlParameter { ParameterName = "@MetaKeywords", Value = meta.MetaKeywords ?? SettingsSEO.DefaultMetaKeywords }, new SqlParameter { ParameterName = "@MetaDescription", Value = meta.MetaDescription ?? SettingsSEO.DefaultMetaDescription }, new SqlParameter { ParameterName = "@ObjId", Value = meta.ObjId }, new SqlParameter { ParameterName = "@Type", Value = meta.Type.ToString( ) } } ); }
protected void Page_Load(object sender, EventArgs e) { bool categoryIdIsNum = false; int categoryId = -1; if (!string.IsNullOrEmpty(Request["newscategoryid"]) && Int32.TryParse(Request["newscategoryid"], out categoryId)) { categoryIdIsNum = categoryId != -1; } _paging = new SqlPaging { TableName = "Settings.News left join Catalog.Photo on Photo.objId=News.NewsID and Type=@Type", ItemsPerPage = SettingsNews.NewsPerPage }; _paging.AddField(new Field { Name = "NewsID" }); _paging.AddField(new Field { Name = "AddingDate", Sorting = SortDirection.Descending }); _paging.AddField(new Field { Name = "Title" }); _paging.AddField(new Field { Name = "PhotoName as Picture" }); _paging.AddField(new Field { Name = "TextToPublication" }); _paging.AddField(new Field { Name = "TextToEmail" }); _paging.AddField(new Field { Name = "TextAnnotation" }); _paging.AddField(new Field { Name = "UrlPath" }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.News.ToString() }); if (categoryIdIsNum) { var f = new Field { Name = "NewsCategoryID", NotInQuery = true }; var filter = new EqualFieldFilter { ParamName = "@NewsCategoryID", Value = categoryId.ToString(CultureInfo.InvariantCulture) }; f.Filter = filter; _paging.AddField(f); } MetaInfo nmeta = new MetaInfo { Type = MetaType.News, Title = SettingsNews.NewsMetaTitle, MetaKeywords = SettingsNews.NewsMetaKeywords, MetaDescription = SettingsNews.NewsMetaDescription, H1 = SettingsNews.NewsMetaH1 }; var category = NewsService.GetNewsCategoryById(categoryId); header.Text = category != null ? string.Format("{0} / {1}", Resource.Client_News_News, category.Name) : Resource.Client_News_News; if (paging.CurrentPage > 1) { header.Text = header.Text + Resource.Client_Catalog_PageIs + paging.CurrentPage; } if (category != null) { ucBreadCrumbs.Items = new List<BreadCrumbs> { new BreadCrumbs { Name = Resource.Client_News_News, Url = UrlService.GetAbsoluteLink("news") }, new BreadCrumbs { Name = category.Name, Url = UrlService.GetLink(ParamType.NewsCategory, category.UrlPath, category.NewsCategoryID) } }; } else { ucBreadCrumbs.Visible = false; } if (paging.CurrentPage > 1) { nmeta.Title += Resource.Client_Catalog_PageIs + paging.CurrentPage; nmeta.MetaDescription += Resource.Client_Catalog_PageIs + paging.CurrentPage; } SetMeta(nmeta, string.Empty); }
protected void Page_Load(object sender, EventArgs e) { _priceField = CustomerSession.CurrentCustomer.PriceType.ToString(); _paging = new SqlPaging { TableName = "[Catalog].[Product] " + "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] AND [Offer].[Main] = 1 " + "LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='product' and Photo.Main=1 " + "inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] " + "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " + "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " + "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId" }; _paging.AddFieldsRange( new List<Field> { new Field {Name = "[Product].[ProductID]", IsDistinct = true}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field {Name = "Recomended"}, new Field {Name = "Bestseller"}, new Field {Name = "New"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "Offer.Main", NotInQuery=true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "Offer.Amount"}, new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Multiplicity"}, new Field {Name = "Enabled"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "UrlPath"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true}, new Field {Name = "BrandID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true}, new Field {Name = "Offer.ColorID"}, new Field {Name = "CategoryEnabled", NotInQuery=true}, new Field {Name = "null as AdditionalPhoto"} }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List<Field> { new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"}, new Field {Name = string.Format("(select max ({0}) - min ({0}) from catalog.offer where offer.productid=product.productid) as MultiPrices", _priceField)}, new Field {Name = string.Format("(select min ({0}) from catalog.offer where offer.productid=product.productid) as Price", _priceField)}, }); } else { _paging.AddFieldsRange(new List<Field> { new Field {Name = "null as Colors"}, new Field {Name = "0 as MultiPrices"}, new Field { Name = SettingsCatalog.UseLastPrice ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField) : string.Format("{0} as Price", _priceField) }, }); } _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); BuildSorting(); BuildFilter(); var nmeta = new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_Search_AdvancedSearch)); SetMeta(nmeta, string.Empty, page:paging.CurrentPage); txtName.Focus(); }
private static void UpdateMetaInfo(MetaInfo meta) { SQLDataAccess.ExecuteNonQuery( "UPDATE [SEO].[MetaInfo] SET [Title] = @Title, [MetaKeywords] = @MetaKeywords,[MetaDescription] = @MetaDescription, [H1]=@H1 where ObjId=@ObjId and Type=@Type", CommandType.Text, new SqlParameter("@Title", meta.Title ?? SettingsSEO.DefaultMetaTitle), new SqlParameter("@MetaKeywords", meta.MetaKeywords ?? SettingsSEO.DefaultMetaKeywords), new SqlParameter("@MetaDescription", meta.MetaDescription ?? SettingsSEO.DefaultMetaDescription), new SqlParameter("@H1", meta.H1 ?? SettingsSEO.DefaultH1), new SqlParameter("@ObjId", meta.ObjId), new SqlParameter("@Type", meta.Type.ToString())); }
private static int InsertMetaInfo(MetaInfo meta) { var id = SQLDataAccess.ExecuteScalar<int>("[SEO].[sp_AddMetaInfo]", CommandType.StoredProcedure, new SqlParameter("@Title", meta.Title ?? SettingsSEO.DefaultMetaTitle), new SqlParameter("@MetaKeywords", meta.MetaKeywords ?? SettingsSEO.DefaultMetaKeywords), new SqlParameter("@MetaDescription", meta.MetaDescription ?? SettingsSEO.DefaultMetaDescription), new SqlParameter("@H1", meta.H1 ?? SettingsSEO.DefaultH1), new SqlParameter("@ObjId", meta.ObjId), new SqlParameter("@Type", meta.Type.ToString())); return id; }
private Int32 ProcessProduct(Random rnd, Int32 intProductIndex) { if (!ImportStatistic.IsRun) { return(0); } var product = new Product(); // Simple prop product.ArtNo = intProductIndex.ToString(); product.Name = Strings.GetRandomString(rnd, 35, 5); product.Enabled = true; product.Discount = DevTool.GetRandomInt(rnd, 0, 100); product.Weight = DevTool.GetRandomInt(rnd, 0, 1000); product.Size = GetSizeForBdFormat(string.Format("{0} x {1} x {2}", DevTool.GetRandomInt(rnd, 0, 100), DevTool.GetRandomInt(rnd, 0, 100), DevTool.GetRandomInt(rnd, 0, 100))); product.BriefDescription = Strings.GetRandomString(rnd, 250, 7); product.Description = Strings.GetRandomString(rnd, 2500, 7); // Offer var offr = new Offer { OfferListId = CatalogService.DefaultOfferListId, Price = DevTool.GetRandomInt(rnd, 1000, 10000), SupplyPrice = DevTool.GetRandomInt(rnd, 0, 3000), ShippingPrice = DevTool.GetRandomInt(rnd, 0, 2000), Amount = DevTool.GetRandomInt(rnd, 0, 500), Unit = Strings.GetRandomString(rnd, 4) }; product.Offers = new List <Offer> { offr }; // URL product.UrlPath = product.ArtNo; // Meta var metaResul = new AdvantShop.SEO.MetaInfo { Title = string.Format("#STORE_NAME# - {0} {1} ({2})", Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4)), MetaKeywords = string.Format("{0}, {1}, {2}, {3}, {4}", Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4), Strings.GetRandomString(rnd, 4)), MetaDescription = Strings.GetRandomString(rnd, 255, 7) }; metaResul.ObjId = product.ProductId; // New Adv3.0 Fix product.Meta = metaResul; // Update / Insert Product UpdateInsertProduct(product); return(product.ProductId); }