Ejemplo n.º 1
0
        protected void upsell_sale(MagentoService mservice, string mlogin, string brand_sql, string search_family, string source_sku)
        {
            string storeview = "1";

            if (search_family.Contains("OEM"))
            {
                storeview = "3";
            }
            string sku_family = search_family;

            if (sku_family.Contains("DK"))
            {
                search_family = "DK";
            }
            else if (sku_family.Contains("LP"))
            {
                search_family = "LP";
            }

            filters filter = new filters();

            filter = addFilter(filter, "sku_family", "like", "%" + search_family + "%");
            filter = addFilter(filter, "status", "eq", "1");
            var result = mservice.catalogProductList(mlogin, filter, storeview);

            string[] sku_arr = new string[result.Length];

            int i = 0;

            //get result sku
            foreach (catalogProductEntity product in result)
            {
                sku_arr[i] = product.sku;

                i += 1;
            }
            //get stock level
            var result2 = mservice.catalogInventoryStockItemList(mlogin, sku_arr);

            foreach (catalogInventoryStockItemEntity product in result2)
            {
                string qty_sku = product.sku;
                Double qty     = double.Parse(product.qty);
                if (qty > 0)
                {
                    catalogProductLinkEntity assign = new catalogProductLinkEntity();
                    assign.position = "1";

                    // inject related listing
                    mservice.catalogProductLinkUpdate(mlogin, "up_sell", source_sku, qty_sku, assign, "sku");
                }
            }

            mservice.Dispose();
        }
Ejemplo n.º 2
0
        //login to magento with soap_api
        protected void get_magento_detail()
        {
            MagentoService mservice = new MagentoService();
            String         mlogin   = mservice.login("admin", "Interconnection123");
            //retriving list of product from storeview
            //para @sessionid = login info
            //@ filter = searchfilter @store id = see below
            //store id : 1 = Main Website Store, 2= Low Income Store, 3 = Retail Store



            var result = mservice.catalogProductInfo(mlogin, "ICL1296", "1", null, null);


            mservice.Dispose();
        }
Ejemplo n.º 3
0
        protected void export_Click(object sender, EventArgs e)
        {
            MagentoService mservice = new MagentoService();
            String         mlogin   = mservice.login("admin", "Interconnection123");

            string[] arr1    = new string[] { "1218" };
            string   product = "1";
            catalogInventoryStockItemUpdateEntity update_item = new catalogInventoryStockItemUpdateEntity();

            update_item.qty         = "1";
            update_item.is_in_stock = 1;
            var update = mservice.catalogInventoryStockItemUpdate(mlogin, product, update_item);
            var item   = mservice.catalogInventoryStockItemList(mlogin, arr1);


            //working up_sell function
            //catalogProductLinkEntity assign = new catalogProductLinkEntity();
            //assign.position = "1";


            //mservice.catalogProductLinkUpdate(mlogin, "related", "1030", "1029", assign, "product_id");



            catalogProductCreateEntity create = new catalogProductCreateEntity();
            var inv = new catalogProductTierPriceEntity();

            create.name              = name.Text;
            create.price             = price_control.Text;
            create.description       = des.Text;
            create.short_description = short_des.Text;
            create.tax_class_id      = "2";
            create.meta_title        = meta_info.Text;
            create.visibility        = "4";
            create.weight            = "0";
            create.status            = "2";
            create.meta_description  = meta_description.Text;
            inv.qty = 0;

            associativeEntity[] attributes = new associativeEntity[18];
            attributes[0]       = new associativeEntity();
            attributes[0].key   = "asset_tag";
            attributes[0].value = asset_tag.Text;

            attributes[1]       = new associativeEntity();
            attributes[1].key   = "sku_family";
            attributes[1].value = sku_family.Text;

            attributes[2]       = new associativeEntity();
            attributes[2].key   = "cpu";
            attributes[2].value = cpu.Text;

            attributes[3]       = new associativeEntity();
            attributes[3].key   = "software_description";
            attributes[3].value = soft_des.Text;

            attributes[4]       = new associativeEntity();
            attributes[4].key   = "ram";
            attributes[4].value = ram.Text + " RAM";

            attributes[5]       = new associativeEntity();
            attributes[5].key   = "hdd";
            attributes[5].value = hdd.Text + " HDD";

            attributes[6]       = new associativeEntity();
            attributes[6].key   = "os";
            attributes[6].value = software.Text;

            attributes[7]       = new associativeEntity();
            attributes[7].key   = "creation_date";
            attributes[7].value = create_date.Text;

            attributes[8]       = new associativeEntity();
            attributes[8].key   = "wireless";
            attributes[8].value = wireless.SelectedItem.ToString();

            attributes[9]       = new associativeEntity();
            attributes[9].key   = "incl";
            attributes[9].value = includes.Text;

            attributes[10]       = new associativeEntity();
            attributes[10].key   = "brand";
            attributes[10].value = brand.Text;

            attributes[11]       = new associativeEntity();
            attributes[11].key   = "grade";
            attributes[11].value = grade.SelectedItem.Value;

            attributes[12]       = new associativeEntity();
            attributes[12].key   = "wcoa";
            attributes[12].value = wcoa.Text;

            attributes[13]       = new associativeEntity();
            attributes[13].key   = "ocoa";
            attributes[13].value = ocoa.Text;

            attributes[14]       = new associativeEntity();
            attributes[14].key   = "video";
            attributes[14].value = video_card.Text;

            attributes[15]       = new associativeEntity();
            attributes[15].key   = "display";
            attributes[15].value = screen.Text;

            attributes[16]       = new associativeEntity();
            attributes[16].key   = "computer";
            attributes[16].value = is_computer.SelectedValue;

            attributes[17]       = new associativeEntity();
            attributes[17].key   = "optical";
            attributes[17].value = optical.Text;

            catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity();

            additionalAttributes.single_data = attributes;
            create.additional_attributes     = additionalAttributes;

            mservice.catalogProductCreate(
                mlogin, "simple", "4", sku.Text, create, "1");

            mservice.Dispose();

            //update inventory
            catalogInventoryStockItemUpdateEntity qty_update = new catalogInventoryStockItemUpdateEntity();


            qty_update.qty         = qty.Text;
            qty_update.is_in_stock = int.Parse(stock_Availability.SelectedValue);

            mservice.catalogInventoryStockItemUpdate(
                mlogin, sku.Text, qty_update);



            get_magento_list(sku.Text);
            ClearTextBoxes(Page);
            //string content = "admin,,Default,simple,,,0,"+status.SelectedItem.ToString()+ ",No,\"Catalog, Search\",Yes,"+tax_class.SelectedItem.ToString()+ ",No,No,Yes,No,No,\"" + name.Text+ "\",,," + software.Text+ ","+cpu.Text+","+hdd.Text+",,"+ram.Text+ ",Use config,Use config,\"" + meta_info.Text+ "\",\"" + meta_description.Text+ "\",,,,,No layout updates,Block after Info Column,No,,,,,,"+brand.Text+ ",\"" + includes.Text+ "\"," + grade.SelectedItem.ToString()+",,,,,,,,,,,,,,,,,,"+wireless.SelectedItem.ToString()+ ",,,,,,,,,,,,,," + des.Text + ",\"" + short_des.Text+ "\",,,\"" + soft_des.Text+ "\",,,,,,,,,,,1,0,1,0,0,1,1,1,0,1,0,,,1,0,1,0,1,0,1,0,0,0,1,\"" + name.Text+ "\",0,simple,,,,,,,,,,," + asset_tag.Text+","+sku_family.Text+","+create_date.Text+"";
        }