CZ shops

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
default: www.levnebagly.cz just added class for generate xml feed for jyxo.cz, zbozi.cz atd.
a few addtitions: www.e4u.cz add project for import products from csv

thanks NopCommerce!!! And thanks to Miroslav Matalak
14 years ago
very cool.

I'm also trying to develop a way to import/update products via CSV.  Would you be willing to share your code?

Thanks.
14 years ago
string err = string.Empty;

            string[] lines = File.ReadAllLines(PathFile, Encoding.Default);
            bool NoFirstLine = true;
            foreach (string line in lines)
            {
                if (NoFirstLine)
                {
                    NoFirstLine = false;
                    continue;
                }
                string[] items = line.Split(';');
                try
                {
                    string Name = items[2];
                    string ShortDescription = items[2];
                    string FullDescription = ParseDescription(items[3]);
                    string AdminComment = string.Empty;
                    int ProductType = 1;
                    int Template = 4;
                    bool ShowOnHomePage = false;
                    string MetaKeywords = "Sexshop, erotické pomůcky, sex shop, vibrátory, " + items[2];
                    string MetaDescription = "Sexshop, erotické pomůcky, sex shop, vibrátory, " + items[2];
                    string MetaTitle = "Sexshop, erotické pomůcky, sex shop, vibrátory, " + items[2];
                    string SEName = items[2];
                    bool AllowCustomerReviews = true;
                    bool AllowCustomerRatings = true;
                    int RatingSum = 0;
                    int TotalRatingVotes = 0;
                    bool Published = true;
                    bool Deleted = false;
                    DateTime CreatedOn = DateTime.Now;
                    DateTime UpdatedOn = DateTime.Now;

                    // Insert Product
                    Product product = ProductManager.InsertProduct(Name, ShortDescription, FullDescription, AdminComment, ProductType, Template,
                        ShowOnHomePage, MetaKeywords, MetaDescription, MetaTitle, SEName, AllowCustomerReviews, AllowCustomerRatings, RatingSum, TotalRatingVotes,
                        Published, Deleted, CreatedOn, UpdatedOn);

                    string SKU = string.Empty;
                    string ManufacturerPartNumber = string.Empty;//Convert.ToString(reader["ManufacturerPartNumber"]);
                    bool IsDownload = false;
                    int productVariantDownloadID = 0;
                    bool IsShipEnabled = true;
                    bool IsFreeShipping = false;
                    bool IsTaxExempt = false;
                    int TaxCategory = 0;
                    int StockQuantity = 0;
                    int MinStockQuantity = 0;
                    int Warehouse = 0;
                    bool DisableBuyButton = false;
                    bool RequiresTextOption = false;
                    int OrderMinQantity = 1;
                    int OrderMaxQantity = 100;
                    decimal Price = 0;
                    try
                    {
                        Price = Convert.ToDecimal(items[8], new CultureInfo("en-US"));
                        if (Price >= 100)
                            Price = Convert.ToDecimal(Convert.ToInt32((Convert.ToInt32(Price) - 20) * 1.19));
                        else
                            Price = Convert.ToDecimal(Convert.ToInt32(Price));
                    }
                    catch { Price = Convert.ToDecimal(0); }
                    decimal OldPrice = Convert.ToDecimal(0);
                    decimal Weight = Convert.ToDecimal(0);
                    decimal Length = Convert.ToDecimal(0);
                    decimal Width = Convert.ToDecimal(0);
                    decimal Height = Convert.ToDecimal(0);
                    int PictureID = 0;
                    int DisplayOrder = 1;

                    LowStockActivityEnum lowStockActivity = (LowStockActivityEnum)Enum.ToObject(typeof(LowStockActivityEnum), 0);

                    ProductVariant productvariant = ProductManager.InsertProductVariant(product.ProductID, string.Empty, SKU, string.Empty,
                        string.Empty, ManufacturerPartNumber, IsDownload, productVariantDownloadID, IsShipEnabled, IsFreeShipping,11, IsTaxExempt,
                        TaxCategory,false, StockQuantity, MinStockQuantity, lowStockActivity,0,OrderMinQantity, OrderMaxQantity, Warehouse, DisableBuyButton, RequiresTextOption,
                        string.Empty, Price, OldPrice, Weight, Length, Width, Height, PictureID,null, null, Published, Deleted, DisplayOrder, CreatedOn, UpdatedOn);

                    
                    string itemPicture = ImagesPath + items[1];
                    try
                    {
                        Picture pixx = new Picture();
                        FileStream o;
                        o = new FileStream(itemPicture, FileMode.Open, FileAccess.Read);
                        StreamReader r = new StreamReader(o);
                        Byte[] bytImage = new Byte[o.Length];
                        o.Read(bytImage, 0, Convert.ToInt32(o.Length));
                        pixx.PictureBinary = bytImage;
                        int PicID = PictureManager.InsertPicture(pixx.PictureBinary, "image/jpeg", true).PictureID;
                        ProductManager.InsertProductPicture(product.ProductID, PicID, 0);
                    }
                    catch
                    {

                    }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.