Exemple #1
0
        private void ProcessProductRow(ExportFeedProduts row, XmlWriter writer)
        {
            writer.WriteStartElement("item");

            writer.WriteStartElement("title");
            writer.WriteString(row.Name);
            writer.WriteEndElement();

            writer.WriteStartElement("description");

            string desc = _description == "full" ? row.Description : row.BriefDescription;

            writer.WriteString(desc);

            writer.WriteEndElement();

            writer.WriteStartElement("link");
            writer.WriteString(SettingsGeneral.AbsoluteUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductID));
            writer.WriteEndElement();

            writer.WriteStartElement("g", "id");
            writer.WriteString(row.ProductID.ToString());
            writer.WriteEndElement();

            writer.WriteStartElement("g", "price");
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            writer.WriteString(CatalogService.CalculatePrice(row.Price, row.Discount).ToString(nfi));
            writer.WriteEndElement();

            writer.WriteStartElement("g", "image_link");

            var temp = row.Photo;

            if (!string.IsNullOrEmpty(temp))
            {
                writer.WriteString(GetImageProductPath(temp));
            }

            writer.WriteEndElement();

            writer.WriteStartElement("g", "currency");
            writer.WriteString(_currency);
            writer.WriteEndElement();

            writer.WriteStartElement("g", "condition");
            writer.WriteString("new");
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
Exemple #2
0
        private void ProcessProductRow(ExportFeedProduts row, StreamWriter memoryBuffer)
        {
            memoryBuffer.Write("\"");
            //MPN
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Manufacturer name
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //UPC
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Product Name
            memoryBuffer.Write(row.Name);
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Product Description
            string desc = _description == "full" ? row.Description : row.BriefDescription;

            memoryBuffer.Write(!string.IsNullOrEmpty(desc) ? desc : Resource.ExportFeed_NoDescription);
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Product Price
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            memoryBuffer.Write(CatalogService.CalculatePrice(row.Price, row.Discount).ToString(nfi));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Product URL
            memoryBuffer.Write(ShopUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductId));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");
            memoryBuffer.Write("\"");
            //Image URL
            if (!string.IsNullOrEmpty(row.Photos))
            {
                var temp = row.Photos.Split(',');
                var item = temp.FirstOrDefault();
                if (!string.IsNullOrEmpty(item))
                {
                    memoryBuffer.Write(GetImageProductPath(item));
                }
            }

            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Shopping.com Categorization
            var      categorizationBuffer = new StringBuilder();
            Category category             = CategoryService.GetCategory(row.ParentCategory);

            categorizationBuffer.Insert(0, category.Name);
            while (category.ParentCategoryId != 0)
            {
                category = CategoryService.GetCategory(category.ParentCategoryId);
                categorizationBuffer.Insert(0, category.Name + " >> ");
            }
            memoryBuffer.Write(categorizationBuffer.ToString());
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Stock Availability
            //memoryBuffer.Write(SQLDataHelper.GetBoolean(row["Enabled"]));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Stock Description
            memoryBuffer.Write("shopping");
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Ground Shipping
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Weight
            //memoryBuffer.Write(SQLDataHelper.GetDecimal(row["Weight"]));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Zip Code
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            //Condition
            memoryBuffer.Write("New");
            memoryBuffer.Write("\"");

            memoryBuffer.Write("\n");
        }
        private void ProcessVendorModel(ExportFeedProduts row, XmlWriter writer)
        {
            var list = new List <string>()
            {
                "a", "b"
            };

            writer.WriteStartElement("offer");
            writer.WriteAttributeString("id", row.ArtNo.XmlEncode().RemoveInvalidXmlChars());
            writer.WriteAttributeString("group_id", row.ProductId.ToString());

            writer.WriteAttributeString("available", (row.Amount > 0).ToString().ToLower());

            writer.WriteAttributeString("type", "vendor.model");

            writer.WriteStartElement("url");
            writer.WriteRaw(CreateLink(row));
            writer.WriteEndElement();

            float discount = 0;

            if (_productDiscountModels != null)
            {
                var prodDiscount = _productDiscountModels.Find(d => d.ProductId == row.ProductId);
                if (prodDiscount != null)
                {
                    discount = prodDiscount.Discount;
                }
            }

            writer.WriteStartElement("price");
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            writer.WriteRaw(Math.Round(CatalogService.CalculatePrice(row.Price, discount != 0 ? discount : row.Discount)).ToString(nfi));
            writer.WriteEndElement();

            writer.WriteStartElement("currencyId");
            writer.WriteRaw(_currency);
            writer.WriteEndElement();

            writer.WriteStartElement("categoryId");
            writer.WriteRaw(row.ParentCategory.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();


            if (!string.IsNullOrEmpty(row.Photos))
            {
                var temp = row.Photos.Split(',').Take(9);
                foreach (var item in temp.Where(item => !string.IsNullOrWhiteSpace(item)))
                {
                    writer.WriteStartElement("picture");
                    writer.WriteRaw(GetImageProductPath(item));
                    writer.WriteEndElement();
                }
            }

            if (_delivery)
            {
                writer.WriteStartElement("delivery");
                writer.WriteRaw(_delivery.ToString().ToLower());
                writer.WriteEndElement();
            }

            if (_localDeliveryCost)
            {
                writer.WriteStartElement("local_delivery_cost");
                writer.WriteRaw(Math.Round(row.ShippingPrice).ToString(nfi));
                writer.WriteEndElement();
            }


            writer.WriteStartElement("vendor");
            writer.WriteRaw(row.BrandName.XmlEncode().RemoveInvalidXmlChars());
            writer.WriteEndElement();

            writer.WriteStartElement("vendorCode");
            writer.WriteRaw(row.ArtNo.XmlEncode().RemoveInvalidXmlChars());
            writer.WriteEndElement();

            writer.WriteStartElement("model");
            writer.WriteRaw(row.Name.XmlEncode().RemoveInvalidXmlChars() + (!string.IsNullOrWhiteSpace(row.SizeName) ? " " + row.SizeName.XmlEncode().RemoveInvalidXmlChars() : string.Empty) + (!string.IsNullOrWhiteSpace(row.ColorName) ? " " + row.ColorName.XmlEncode().RemoveInvalidXmlChars() : string.Empty));
            writer.WriteEndElement();

            writer.WriteStartElement("description");
            string desc = SQLDataHelper.GetString(_description == "full" ? row.Description : row.BriefDescription);

            if (_removeHTML)
            {
                desc = StringHelper.RemoveHTML(desc);
            }

            writer.WriteRaw(desc.XmlEncode().RemoveInvalidXmlChars());

            writer.WriteEndElement();

            if (!string.IsNullOrWhiteSpace(row.SalesNote))
            {
                writer.WriteStartElement("sales_notes");
                writer.WriteRaw(row.SalesNote.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteEndElement();
            }
            else if (!string.IsNullOrWhiteSpace(_salesNotes))
            {
                writer.WriteStartElement("sales_notes");
                writer.WriteRaw(_salesNotes.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteEndElement();
            }

            if (row.ManufacturerWarranty)
            {
                writer.WriteStartElement("manufacturer_warranty");
                writer.WriteRaw(row.ManufacturerWarranty.ToString().ToLower());
                writer.WriteEndElement();
            }

            if (row.Adult)
            {
                writer.WriteStartElement("adult");
                writer.WriteRaw(row.Adult.ToString().ToLower());
                writer.WriteEndElement();
            }

            if (!string.IsNullOrWhiteSpace(row.ColorName))
            {
                writer.WriteStartElement("param");
                writer.WriteAttributeString("name", SettingsCatalog.ColorsHeader.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteRaw(row.ColorName.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteEndElement();
            }

            if (!string.IsNullOrWhiteSpace(row.SizeName))
            {
                writer.WriteStartElement("param");
                writer.WriteAttributeString("name", SettingsCatalog.SizesHeader.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteRaw(row.SizeName.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteEndElement();
            }

            if (_properties)
            {
                foreach (var prop in PropertyService.GetPropertyValuesByProductId(row.ProductId))
                {
                    if (prop.Property.Name.IsNotEmpty() && prop.Value.IsNotEmpty())
                    {
                        writer.WriteStartElement("param");
                        writer.WriteAttributeString("name", prop.Property.Name.XmlEncode().RemoveInvalidXmlChars());
                        writer.WriteRaw(prop.Value.XmlEncode().RemoveInvalidXmlChars());
                        writer.WriteEndElement();
                    }
                }
            }

            writer.WriteEndElement();
        }
        private void ProcessProductRow(ExportFeedProduts row, XmlWriter writer)
        {
            writer.WriteStartElement("item");

            #region ќсновные сведени¤ о товарах

            //id
            writer.WriteElementString("g", "id", GoogleBaseNamespace, row.OfferId.ToString(CultureInfo.InvariantCulture));

            //title [title]
            writer.WriteStartElement("title");
            var title = row.Name.XmlEncode().RemoveInvalidXmlChars();
            //title should be not longer than 70 characters
            if (title.Length > 70)
            {
                title = title.Substring(0, 70);
            }
            writer.WriteCData(title);
            writer.WriteEndElement();

            //description

            var desc = _description == "full" ? row.Description : row.BriefDescription;
            if (_removeHTML)
            {
                desc = StringHelper.RemoveHTML(desc);
            }

            if (desc.IsNotEmpty())
            {
                writer.WriteStartElement("description");
                writer.WriteCData(desc.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteEndElement();
            }

            //google_product_category http://www.google.com/support/merchants/bin/answer.py?answer=160081
            var googleProductCategory = row.GoogleProductCategory;
            if (string.IsNullOrEmpty(googleProductCategory))
            {
                googleProductCategory = _googleProductCategory;
            }
            writer.WriteStartElement("g", "google_product_category", GoogleBaseNamespace);
            writer.WriteCData(googleProductCategory.XmlEncode().RemoveInvalidXmlChars());
            writer.WriteEndElement();

            //product_type
            var localPath = string.Empty;
            var cats      = CategoryService.GetParentCategories(row.ParentCategory).Reverse()
                            .Select(cat => new
            {
                Name = cat.Name,
                Url  = UrlService.GetLink(ParamType.Category, cat.UrlPath, cat.ID)
            }).ToList();
            for (var i = 0; i < cats.Count; i++)
            {
                var cat = cats[i];
                localPath = localPath + cat.Name;
                if (i == cats.Count - 1)
                {
                    continue;
                }
                localPath = localPath + " > ";
            }
            writer.WriteStartElement("g", "product_type", GoogleBaseNamespace);
            writer.WriteCData(localPath.XmlEncode().RemoveInvalidXmlChars());
            writer.WriteEndElement();

            if (row.Adult)
            {
                writer.WriteElementString("g", "adult", GoogleBaseNamespace, row.Adult.ToString());
            }


            //link
            writer.WriteElementString("link", ShopUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductId));

            //image link
            if (!string.IsNullOrEmpty(row.Photos))
            {
                var temp = row.Photos.Split(',');
                for (var i = 0; i < temp.Length; i++)
                {
                    writer.WriteElementString("g", i == 0 ? "image_link" : "additional_image_link", GoogleBaseNamespace, GetImageProductPath(temp[i]));
                }
            }

            //condition
            writer.WriteElementString("g", "condition", GoogleBaseNamespace, "new");
            #endregion


            #region наличие и цена
            //availability
            const string availability = "in stock";
            writer.WriteElementString("g", "availability", GoogleBaseNamespace, availability);


            float discount = 0;
            if (_productDiscountModels != null)
            {
                var prodDiscount = _productDiscountModels.Find(d => d.ProductId == row.ProductId);
                if (prodDiscount != null)
                {
                    discount = prodDiscount.Discount;
                }
            }

            writer.WriteElementString("g", "price", GoogleBaseNamespace, Math.Round(CatalogService.CalculatePrice(row.Price, discount != 0 ? discount : row.Discount)).ToString());

            #endregion

            #region ”никальные идентификаторы товаров
            //GTIN
            var gtin = row.Gtin;
            if (!string.IsNullOrEmpty(gtin))
            {
                writer.WriteStartElement("g", "gtin", GoogleBaseNamespace);
                writer.WriteCData(gtin);
                writer.WriteFullEndElement(); // g:gtin
            }

            //brand
            if (!string.IsNullOrEmpty(row.BrandName))
            {
                writer.WriteStartElement("g", "brand", GoogleBaseNamespace);
                writer.WriteCData(row.BrandName.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteFullEndElement(); // g:brand
            }

            //mpn [mpn]
            if (!string.IsNullOrEmpty(row.ArtNo))
            {
                writer.WriteStartElement("g", "mpn", GoogleBaseNamespace);
                writer.WriteCData(row.ArtNo.XmlEncode().RemoveInvalidXmlChars());
                writer.WriteFullEndElement(); // g:mpn
            }
            #endregion

            #region ¬арианты товара
            if (!(row.ColorName.IsNullOrEmpty() || row.SizeName.IsNullOrEmpty()))
            {
                //item_group_id
                writer.WriteElementString("g", "item_group_id", GoogleBaseNamespace, row.ProductId.ToString());
                //color
                writer.WriteElementString("g", "color", GoogleBaseNamespace, row.ColorName.XmlEncode().RemoveInvalidXmlChars());
                //color
                writer.WriteElementString("g", "size", GoogleBaseNamespace, row.SizeName.XmlEncode().RemoveInvalidXmlChars());
            }

            #endregion

            #region Tax & Shipping
            #endregion

            writer.WriteElementString("g", "expiration_date", GoogleBaseNamespace, DateTime.Now.AddDays(28).ToString("yyyy-MM-dd"));
            writer.WriteEndElement();
        }
Exemple #5
0
        private void ProcessProductRow(ExportFeedProduts row, StreamWriter memoryBuffer)
        {
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";

            //Category
            var categorizationBuffer = new StringBuilder();
            var category             = CategoryService.GetCategory(row.ParentCategory);

            categorizationBuffer.Insert(0, category.Name);
            while (category.ParentCategoryId != 0)
            {
                category = CategoryService.GetCategory(category.ParentCategoryId);
                categorizationBuffer.Insert(0, category.Name + " >> ");
            }
            memoryBuffer.Write(categorizationBuffer.ToString());
            memoryBuffer.Write("\t");

            //Manufacturer
            memoryBuffer.Write("\t");

            //Title
            memoryBuffer.Write(row.Name);
            memoryBuffer.Write("\t");

            //Description
            string desc = _description == "full" ? row.Description : row.BriefDescription;

            memoryBuffer.Write(!string.IsNullOrEmpty(desc) ? desc : Resource.ExportFeed_NoDescription);
            memoryBuffer.Write("\t");

            //Link
            memoryBuffer.Write(SettingsGeneral.AbsoluteUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductID));
            memoryBuffer.Write("\t");

            //Image
            var temp = row.Photo;

            if (!string.IsNullOrEmpty(temp))
            {
                memoryBuffer.Write(GetImageProductPath(row.Photo));
            }
            memoryBuffer.Write("\t");

            //SKU
            memoryBuffer.Write(row.ProductID.ToString());
            memoryBuffer.Write("\t");

            //Quantity on Hand
            memoryBuffer.Write("\t");

            //Condition
            memoryBuffer.Write("new");
            memoryBuffer.Write("\t");

            //Shipping Weight
            //memoryBuffer.Write(SQLDataHelper.GetDecimal(row["Weight"]));
            memoryBuffer.Write("\t");

            //Shipping Cost
            //memoryBuffer.Write(SQLDataHelper.GetDecimal(row["ShippingPrice"]).ToString(nfi));
            memoryBuffer.Write("\t");

            //Bid
            memoryBuffer.Write("\t");

            //Promo Text
            memoryBuffer.Write("\t");

            //UPC
            memoryBuffer.Write("\t");

            //Price
            memoryBuffer.Write(CatalogService.CalculatePrice(row.Price, row.Discount).ToString(nfi));
            memoryBuffer.Write("\n");
        }
        private void ProcessProductRow(ExportFeedProduts row, XmlWriter writer)
        {
            //var tempUrl = (_shopUrl.EndsWith("/") ? _shopUrl.TrimEnd('/') : _shopUrl);
            writer.WriteStartElement("offer");
            writer.WriteAttributeString("id", row.ProductID.ToString());
            writer.WriteAttributeString("available", (row.Amount > 0).ToString().ToLower());

            writer.WriteStartElement("url");
            writer.WriteString(SettingsGeneral.AbsoluteUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductID));
            writer.WriteEndElement();


            writer.WriteStartElement("price");
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            writer.WriteString(CatalogService.CalculatePrice(row.Price, row.Discount).ToString(nfi));
            writer.WriteEndElement();

            writer.WriteStartElement("currencyId");
            writer.WriteString(_currency == "RUB" ? "RUR" : _currency);
            writer.WriteEndElement();

            writer.WriteStartElement("categoryId");
            writer.WriteString(row.ParentCategory.ToString());
            writer.WriteEndElement();

            writer.WriteStartElement("picture");
            var photo = SQLDataHelper.GetString(row.Photo);

            if (!string.IsNullOrEmpty(photo))
            {
                writer.WriteString(GetImageProductPath(photo));
            }
            writer.WriteEndElement();

            writer.WriteStartElement("name");

            //Added by Evgeni to Change product Name like in Description
            //from details.aspx

            if (!row.Name.ToLower().Contains(row.BrandName.ToLower()))
            {
                if (row.BrandName.ToLower() == "bosch" && Regex.IsMatch(row.Name, @"[A-Z]"))
                {
                    row.Name = row.Name.Insert(Regex.Match(row.Name, @"[A-Z]").Index, row.BrandName + ' ');
                }
                else
                {
                    row.Name = row.BrandName + " " + row.Name;
                }
            }
            if (!row.Name.ToLower().Contains(row.ArtNo.Replace(".", "").Replace("-", "").ToLower()))
            {
                row.Name = row.Name + " [" + row.ArtNo.Replace(".", "").Replace("-", "") + "]";
            }

            ///

            writer.WriteString(row.Name);
            writer.WriteEndElement();

            writer.WriteStartElement("description");
            string desc = SQLDataHelper.GetString(_description == "full" ? row.Description : row.BriefDescription);

            writer.WriteString(desc);

            writer.WriteEndElement();

            if (_salesNotes.IsNotEmpty())
            {
                writer.WriteStartElement("sales_notes");
                writer.WriteString(_salesNotes);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
        private void ProcessDataRow(ExportFeedProduts row, StreamWriter memoryBuffer)
        {
            var tempId = row.ProductID;

            memoryBuffer.Write("\"");
            memoryBuffer.Write(tempId);
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            memoryBuffer.Write("");
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            memoryBuffer.Write(row.Name);
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            var      categorizationBuffer = new StringBuilder();
            Category category             = CategoryService.GetCategory(row.ParentCategory);

            categorizationBuffer.Insert(0, category.Name);
            while (category.ParentCategoryId != 0)
            {
                category = CategoryService.GetCategory(category.ParentCategoryId);
                categorizationBuffer.Insert(0, category.Name + " >> ");
            }
            memoryBuffer.Write(categorizationBuffer.ToString());
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            memoryBuffer.Write(SettingsGeneral.AbsoluteUrl.TrimEnd('/') + "/" + UrlService.GetLink(ParamType.Product, row.UrlPath, row.ProductID));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            //memoryBuffer.Write("\"");
            //memoryBuffer.Write(GetShopUrl() + GetProductLink(tempId));
            //memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            var temp = row.Photo;

            if (!string.IsNullOrEmpty(temp))
            {
                memoryBuffer.Write(GetImageProductPath(temp));
            }
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            string desc = _descriptionSelecton == "full" ? row.Description : row.BriefDescription;

            memoryBuffer.Write(!string.IsNullOrEmpty(desc) ? desc : Resource.ExportFeed_NoDescription);
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            memoryBuffer.Write(CatalogService.CalculatePrice(row.Price, row.Discount).ToString(nfi));
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            memoryBuffer.Write("New");
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            //memoryBuffer.Write("\"");
            //memoryBuffer.Write(row["Enabled"]);
            //memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            memoryBuffer.Write("\"");
            memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            //memoryBuffer.Write("\"");
            //memoryBuffer.Write(SQLDataHelper.GetDecimal(row["ShippingPrice"]).ToString(nfi));
            //memoryBuffer.Write("\"");

            memoryBuffer.Write(",");

            //memoryBuffer.Write("\"");
            //memoryBuffer.Write(SQLDataHelper.GetDecimal(row["Weight"]));
            //memoryBuffer.Write("\"");

            memoryBuffer.Write("\n");
        }
        private static void ProcessProductRow(DataRow row, XmlWriter writer)
        {
            writer.WriteStartElement("offer");
            writer.WriteAttributeString("available", SQLDataHelper.GetBoolean(row["Enabled"]).ToString().ToLower());
            writer.WriteAttributeString("id", row["ArtNo"].ToString());

            writer.WriteStartElement("url");
            if (string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query))
            {
                writer.WriteString(HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, "") + "/" + UrlService.GetLink(ParamType.Product, (string)row["UrlPath"], (int)row["ProductID"]));
            }
            else
            {
                writer.WriteString(HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, "").Replace(HttpContext.Current.Request.Url.Query, "") + "/" + UrlService.GetLink(ParamType.Product, (string)row["UrlPath"], (int)row["ProductID"]));
            }
            writer.WriteEndElement();


            writer.WriteStartElement("price");
            var nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            nfi.NumberDecimalSeparator = ".";
            writer.WriteString(CatalogService.CalculatePrice(SQLDataHelper.GetDecimal(row["Price"]), SQLDataHelper.GetDecimal(row["discount"])).ToString(nfi));
            writer.WriteEndElement();

            writer.WriteStartElement("currencyId");
            writer.WriteString(_currency);
            writer.WriteEndElement();

            writer.WriteStartElement("categoryId");
            writer.WriteString(row["ParentCategory"].ToString().Replace("ID", ""));
            writer.WriteEndElement();

            writer.WriteStartElement("picture");
            var temp = SQLDataHelper.GetString(row["photo"]);

            if (!string.IsNullOrEmpty(temp))
            {
                if (string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query))
                {
                    writer.WriteString(HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, "") + "/" + FoldersHelper.GetImageProductPath(ProductImageType.Middle, temp, false));
                }
                else
                {
                    writer.WriteString(HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, "").Replace(HttpContext.Current.Request.Url.Query, "") + "/" + FoldersHelper.GetImageProductPath(ProductImageType.Middle, temp, false));
                }
            }
            writer.WriteEndElement();

            writer.WriteStartElement("name");
            writer.WriteString(SQLDataHelper.GetString(row["Name"]));
            writer.WriteEndElement();

            writer.WriteStartElement("description");
            string desc = SQLDataHelper.GetString(_description == "full" ? row["Description"] : row["BriefDescription"]);

            writer.WriteString(!string.IsNullOrEmpty(desc) ? desc : Resource.ExportFeed_NoDescription);

            writer.WriteEndElement();

            writer.WriteStartElement("sales_notes");
            writer.WriteString(_salesNotes);
            writer.WriteEndElement();

            // расширение от Ritmz
            writer.WriteStartElement("rz_Active");
            writer.WriteString(SQLDataHelper.GetString(row["Enabled"]));
            writer.WriteEndElement();

            writer.WriteStartElement("rz_Quantity");
            writer.WriteString(SQLDataHelper.GetString(row["Amount"]));
            writer.WriteEndElement();

            writer.WriteStartElement("rz_Weight");
            writer.WriteString(SQLDataHelper.GetString(row["Weight"]));
            writer.WriteEndElement();

            writer.WriteStartElement("rz_Length");
            writer.WriteString(string.Empty);
            writer.WriteEndElement();
            writer.WriteStartElement("rz_Width");
            writer.WriteString(string.Empty);
            writer.WriteEndElement();
            writer.WriteStartElement("rz_Height");
            writer.WriteString(string.Empty);
            writer.WriteEndElement();

            writer.WriteStartElement("rz_SupplierName");
            writer.WriteString(string.Empty);
            writer.WriteEndElement();
            writer.WriteStartElement("rz_SupplierCode");
            writer.WriteString(string.Empty);
            writer.WriteEndElement();
            writer.WriteStartElement("rz_SupplierPrice");
            writer.WriteString(SQLDataHelper.GetString(row["SupplyPrice"]));
            writer.WriteEndElement();

            //add fields
            //rz_Active - принимает значение «true», если товар активен и
            //участвует в продажах, «false» - если товар неактивен,
            //даже если количество товара положительное.
            //Значение по умолчанию - «true»;
            //rz_Quantity - cодержит количество товара на складе ИМ в штуках (не обязательное);
            //rz_Weight - cодержит вес товара с упаковкой в килограммах (не обязательное);
            //rz_Length - cодержит длину упаковки в метрах (не обязательное);
            //rz_Width - cодержит ширину упаковки в метрах (не обязательное);
            //rz_Height - содержит высоту упаковки в метрах (не обязательное);
            //rz_SupplierName - наименование поставщика;
            //rz_SupplierCode - код поставщика;
            //rz_SupplierPrice - цена поставщика. Указывается в случае, если
            //требуется получать отчетность по маржинальной
            //прибыли или установить приоритетность выбора
            //поставщиков одного и того же товара по приоритету цены (не обязательное).

            writer.WriteEndElement();
        }