Magento product_attribute.addOption requests a default option

I am using the Magento SOAP v1 API, I am trying to add a parameter to an attribute. Using the following documentation Link

This is the code that I use as a test.

$attributeCode = "colour"; $optionToAdd = array( "Label" => array( array( "store_id" => 1, "value" => "Green" ) ), "order" => 0, "is_default" => 0 ); 

When I make an API call, it returns the following:

 <b>Fatal error</b>: Uncaught SoapFault exception: [108] Default option value is not defined 

I can't make me work for life. Nothing else was missing from the documents ?!

+4
source share
2 answers

I think maybe you should define a value for store_id 0 (admin)? You define a value for store_id 1, but you may need to have a value in admin.

+10
source

A small addition to the accepted answer. Store_id should be ArrayOfStrings. Therefore, the data should look like this:

 $attributeCode = "colour"; $optionToAdd = array( "label" => array( array( "store_id" => array("0","1"), "value" => "Green" ) ), "order" => 0, "is_default" => 0 ); 
0
source

All Articles