2

I have created products through API from c#.net and products also created successfully with category ids. But the products are not showing from frontend even though I have cleared cache.

try
            {

            learningProductProductRepositoryV1Service objSrvc = new learningProductProductRepositoryV1Service();
            objSrvc.Credentials = new System.Net.NetworkCredential("democustomer", "kujpcuds24jeaio16u9624rjb2pilnw5c3g");//ay966a9xbvrxcoe2jxpuno85b8wrgxs5rej

            LearningProductProductRepositoryV1Product_multiCreateRequest objP = new LearningProductProductRepositoryV1Product_multiCreateRequest();
            objP.product = new CatalogDataProductInterface[1];
            objP.product[0] = new CatalogDataProductInterface();
            objP.product[0].name = "Computer Kit Components 9";
            //objP.product[0].price = 201.00f;
            //objP.product[0].priceSpecified = true;
            objP.product[0].sku = "CKC9";
            objP.product[0].status = 1;
            objP.product[0].statusSpecified = true;
            objP.product[0].visibility = 4;
            objP.product[0].visibilitySpecified = true;
            objP.product[0].weight = 3.00f;
            objP.product[0].weightSpecified = true;
            objP.product[0].typeId = "bundle";
            objP.product[0].attributeSetId = 4;
            objP.product[0].attributeSetIdSpecified = true;
            objP.product[0].customAttributes = new FrameworkAttributeInterface[5];
            objP.product[0].customAttributes[0] = new FrameworkAttributeInterface();
            objP.product[0].customAttributes[0].attributeCode = "price_view";
            objP.product[0].customAttributes[0].value = "0";

            objP.product[0].customAttributes[1] = new FrameworkAttributeInterface();
            objP.product[0].customAttributes[1].attributeCode = "category_ids";
            objP.product[0].customAttributes[1].value = "9";

            objP.product[0].customAttributes[2] = new FrameworkAttributeInterface();
            objP.product[0].customAttributes[2].attributeCode = "category_ids";
            objP.product[0].customAttributes[2].value = "10";

            objP.product[0].customAttributes[3] = new FrameworkAttributeInterface();
            objP.product[0].customAttributes[3].attributeCode = "sku_type";
            objP.product[0].customAttributes[3].value = "0";

            objP.product[0].customAttributes[4] = new FrameworkAttributeInterface();
            objP.product[0].customAttributes[4].attributeCode = "tax_class_id";
            objP.product[0].customAttributes[4].value = "1";

            objP.product[0].extensionAttributes = new CatalogDataProductExtensionInterface();
            objP.product[0].extensionAttributes.stockItem = new CatalogInventoryDataStockItemInterface();
            objP.product[0].extensionAttributes.stockItem.isInStock = true;
            objP.product[0].extensionAttributes.stockItem.manageStock = true;

            objP.product[0].extensionAttributes.bundleProductOptions = new BundleDataOptionInterface[2];
            objP.product[0].extensionAttributes.bundleProductOptions[0] = new BundleDataOptionInterface();
            objP.product[0].extensionAttributes.bundleProductOptions[0].required = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].optionId = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[0].optionIdSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].position = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[0].positionSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].requiredSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].type = "bundle";
            objP.product[0].extensionAttributes.bundleProductOptions[0].title = "Computer Test Kit";

            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks = new BundleDataLinkInterface[1];
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0] = new BundleDataLinkInterface();
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].isDefault = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].optionId = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].optionIdSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].position = 0;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].positionSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].qty = 1;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].qtySpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].sku = "KB";
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].canChangeQuantity = 0;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].canChangeQuantitySpecified = false;

            objP.product[0].extensionAttributes.bundleProductOptions[1] = new BundleDataOptionInterface();
            objP.product[0].extensionAttributes.bundleProductOptions[1].required = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].optionId = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[1].optionIdSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].position = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[1].positionSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].requiredSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].type = "bundle";
            objP.product[0].extensionAttributes.bundleProductOptions[1].title = "Computer Test Kit 2";

            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks = new BundleDataLinkInterface[1];
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0] = new BundleDataLinkInterface();
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].isDefault = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].optionId = 2;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].optionIdSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].position = 1;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].positionSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].qty = 1;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].qtySpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].sku = "HD";
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].canChangeQuantity = 0;
            objP.product[0].extensionAttributes.bundleProductOptions[1].productLinks[0].canChangeQuantitySpecified = false;

            var result = objSrvc.learningProductProductRepositoryV1Product_multiCreate(objP);

            }
            catch (Exception ex)
            {

                throw;
            }

enter image description here

But when I open the created product from admin panel and just click on save button it is showing from the front store without modifying anything.

I don't know what is the difference or something happening?

Categories

And I have passed the 2 category id's which is 9,10 but it is created only 10 which is last one what about another one 9?

how can I pass multiple category ids to create multiple categories with the product?

Could you please suggest me how to do this?

  • you can try reindexing once..... but it may take more time and slow down the site if you have more products, if you do with ssh , it will take less time.... – Baby in Magento Nov 25 '16 at 7:03
  • @BabyinMagento no luck. again I tried same procedure where I posted. – Bojjaiah Nov 25 '16 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.