public CategoryNode(catalogCategoryEntity category) { if (category == null) { return; } Id = category.category_id; Level = category.level; Name = category.name; ParentId = category.parent_id; IsActive = category.is_active; Childrens = category.children != null?category.children.Select(x => new CategoryNode(x)).Where(x => x != null).ToList() : new List <CategoryNode>(); }
//use for retail picklist public int retail_quick_import(Models.retail_quick_import retail) { MagentoService mservice = new MagentoService(); String mlogin = mservice.login("admin", "Interconnection123!"); catalogProductCreateEntity create = new catalogProductCreateEntity(); catalogCategoryEntity add_cat = new catalogCategoryEntity(); catalogInventoryStockItemUpdateEntity stock_data = new catalogInventoryStockItemUpdateEntity(); stock_data.qty = "1"; stock_data.manage_stock = 1; stock_data.use_config_manage_stock = 0; stock_data.is_in_stock = 1; create.description = retail.desc; create.name = retail.name; create.price = retail.price; create.short_description = retail.short_desc; create.status = retail.status; create.visibility = retail.visible; create.weight = retail.weight; create.website_ids = retail.webistes; create.tax_class_id = retail.tax_id; create.stock_data = stock_data; associativeEntity[] attributes = new associativeEntity[3]; attributes[0] = new associativeEntity(); attributes[0].key = "vendor_id"; attributes[0].value = "11"; attributes[1] = new associativeEntity(); attributes[1].key = "approval"; attributes[1].value = "2"; attributes[2] = new associativeEntity(); attributes[2].key = "vendor_sku"; attributes[2].value = retail.sku + "_vendor"; catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity(); additionalAttributes.single_data = attributes; create.additional_attributes = additionalAttributes; int p_id = mservice.catalogProductCreate( mlogin, retail.type, retail.attr, retail.sku, create, "5"); mservice.catalogCategoryAssignProduct(mlogin, 2, retail.sku, "0", "SKU"); return(p_id); }
private int GetBrandID(string brandName) { CultureInfo cultureInfo = new CultureInfo("en-US", false); brandName = cultureInfo.TextInfo.ToTitleCase(brandName.ToLower()); catalogCategoryEntity category = _brandCategoryTree.children.SingleOrDefault(p => p.name.Equals(brandName)); if (category == null) { throw new NotImplementedException("Category " + brandName + " does not exist"); } else { return(category.category_id); } }