jreinke / magento-improve-api

Magento extension to improve some missing features of API.
92 stars 76 forks source link

How to correctly set 'price_changes' via API Soap V2 #9

Open serifreedom opened 9 years ago

serifreedom commented 9 years ago

Hello Jreinke, Thank you so much for a good free extension, I've tried improve-api with Magento ver. 1.9.0.1 CE by call api soap v2, everything seem great... except! when I define price_changes:

 'price_changes' => array(
            array(
                'color' => array(
                    'Red' => '2',
                    'White' => '-10%',
                ),
                'size' => array(
                    '7'  => '+1',
                    '7-'   => '-3',
                ),
            ),
        ),

error occurred : SOAP-ERROR: Encoding: object has no 'key' property

velvetrevolver commented 9 years ago

I had same problem, you need to use key/value pair for each value. But this add a "stdClass as array" bug I've fixed. I posted the solution, a working example for 1.9.0.1, on Jreinke website and the fix on a fork : https://github.com/GagnantPerdant/magento-improve-api/commit/83b1f319a6c6ae5363092d74c09d52c1f4ac4680