As the title says, I'm trying to set/modify the value of a drop down type attribute through the SOAP v2 API. Below is the latest bit of code that I'm working with:
$update_data = array (
'additional_attributes' => array (
'multi_data' => array (
array ('key' => 'ship_separately', 'value' => array ('0' => '1'))
),
'single_data' => array (
array ('key' => 'ship_width', 'value' => '14'),
array ('key' => 'ship_length', 'value' => '24'),
array ('key' => 'ship_height', 'value' => '12'),
//array ('key' => 'ship_separately', 'value' => 'Yes')
)
)
);
$update = $proxy->catalogProductUpdate($sessionId, 'MySKU', $update_data, NULL, 'sku');
The 'single_data' (just simple name/value pairs) attributes update fine. As you can see, I also tried to update the 'ship_separetely' using the 'single_data' array...to no avail. Google and StackExchange put me on the path of the 'multi_data' array, but finding documentation on it is virtually impossible. I think I have the syntax correct because the API isn't throwing an exception and it is updating the 'single_data' attributes, but won't update the drop down value. It is a simple yes/no drop down, so I've tried setting the value to both 'Yes' and '1', but it doesn't change. Any help is greatly appreciated.
1 Answer 1
Just in case someone else is having a bad day like me, the solution was to set the value to '1', but not in a 'multi_data' array...
$update_data = array (
'additional_attributes' => array (
'single_data' => array (
array ('key' => 'ship_width', 'value' => '14'),
array ('key' => 'ship_length', 'value' => '24'),
array ('key' => 'ship_height', 'value' => '12'),
array ('key' => 'ship_separately', 'value' => '1')
)
)
);
$update = $proxy->catalogProductUpdate($sessionId, 'MySKU', $update_data, NULL, 'sku');
Many thanks to Mayers
-
Odd, because in
Mage_Catalog_Model_Product_Api_V2I can't see any different between the two. But glad it worked for you :)Fran Mayers– Fran Mayers2016年02月04日 16:43:41 +00:00Commented Feb 4, 2016 at 16:43
1ortruewithout the quotes?separately, that probably doesn't help'1'works perfect for me. Are you sure you got the name right? If it's been newly created, you will need to Flush Magento cache or else it won't know the field exists.