2

I am trying to create bundle product from c#.net, but it is throwing error.

The value of attribute price_view must be set

try
            {

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

            LearningProductProductRepositoryV1Product_multiCreateRequest objP = new LearningProductProductRepositoryV1Product_multiCreateRequest();
            objP.product = new CatalogDataProductInterface[1];
            objP.product[0] = new CatalogDataProductInterface();
            objP.product[0].name = "Computer Kit Components";
            objP.product[0].price = 201.00f;
            objP.product[0].priceSpecified = true;
            objP.product[0].sku = "CKC";
            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].extensionAttributes = new CatalogDataProductExtensionInterface();
            objP.product[0].extensionAttributes.stockItem = new CatalogInventoryDataStockItemInterface();
            objP.product[0].extensionAttributes.stockItem.qty = 125;
            objP.product[0].extensionAttributes.stockItem.isInStock = true;
            objP.product[0].extensionAttributes.stockItem.isQtyDecimal = false;
            objP.product[0].extensionAttributes.stockItem.useConfigMinQty = true;
            objP.product[0].extensionAttributes.stockItem.minQty = 1f;
            objP.product[0].extensionAttributes.stockItem.useConfigMinSaleQty = 1;
            objP.product[0].extensionAttributes.stockItem.minSaleQty = 1f;
            objP.product[0].extensionAttributes.stockItem.useConfigMaxSaleQty = true;
            objP.product[0].extensionAttributes.stockItem.maxSaleQty = 1000f;
            objP.product[0].extensionAttributes.stockItem.useConfigBackorders = true;
            objP.product[0].extensionAttributes.stockItem.backorders = 0;
            objP.product[0].extensionAttributes.stockItem.useConfigNotifyStockQty = true;
            objP.product[0].extensionAttributes.stockItem.notifyStockQty = 1;
            objP.product[0].extensionAttributes.stockItem.useConfigEnableQtyInc = true;
            objP.product[0].extensionAttributes.stockItem.enableQtyIncrements = true;
            objP.product[0].extensionAttributes.stockItem.useConfigManageStock = true;
            objP.product[0].extensionAttributes.stockItem.manageStock = true;
            objP.product[0].extensionAttributes.stockItem.isDecimalDivided = false;

            objP.product[0].extensionAttributes.bundleProductOptions = new BundleDataOptionInterface[1];
            objP.product[0].extensionAttributes.bundleProductOptions[0] = new BundleDataOptionInterface();
            objP.product[0].extensionAttributes.bundleProductOptions[0].required = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks = new BundleDataLinkInterface[2];
            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 = 1;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].optionIdSpecified = true;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].position = 1;
            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[0].productLinks[0].price = 3.0f;
            objP.product[0].extensionAttributes.bundleProductOptions[0].productLinks[0].priceType = 1;

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

            var result = objSrvc.learningProductProductRepositoryV1Product_multiCreate(objP);

            }
            catch (Exception ex)
            {

                throw;
            }

could you please help me on this.

1 Answer 1

1

For that you have to set price_view attribute in your code. Please check below image, Price View is required field while creating bundle product.

enter image description here

As per the Magento

Price View : Determines if the product price is shown as a range, from the least expensive to the most expensive (Price Range), or with the least expensive shown (As Low As). Options include: Price Range / As Low As.

For more Information please visit this link or this. Please check this sample CSV file for bundle product Import.

4
  • in customAttributes I need to pass bundle_price_view or price_view?
    – Bojjaiah
    Commented Nov 24, 2016 at 12:42
  • You can try with the price_view
    – Keyur Shah
    Commented Nov 24, 2016 at 12:44
  • yes I have passed .attributeCode = "price_view" and .value = "0"; but returned could not save options Error.
    – Bojjaiah
    Commented Nov 24, 2016 at 12:46
  • then there must be different error. this error has been solved. For that you can ask new question
    – Keyur Shah
    Commented Nov 24, 2016 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.