Question

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.

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top