4

Have been working to get an API call working to edit an order via API, and remove items or quantity from a current order and save as a new order.

My issue is with passed an array of items & qty's to my api method "amend"

$result = $proxy->salesOrderAmend(
    array(
        "sessionId" => $sessionId,
        "orderId" => $id,
        "amendData" => array(
            array(
                'order_item_id' => 46,
                'qty'   => 1
            )
        ),
        "comment" => 'comment here',
        "notifyCustomer" => 1,
        "includeComment" => 1
        )
    );

The amendData uses the existing wsdl complexType orderItemIdQtyArray. Everytime i try to access this array of data in my method I get a blank stdClass returned.

Here is my WSI.xml file

<wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
    <xsd:complexType name="salesOrderAmendData">
            <xsd:sequence>
                <xsd:element name="qtys" type="typens:orderItemIdQtyArray" minOccurs="0" maxOccurs="unbounded"></xsd:element>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="salesOrderAmendRequestParam">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="1" maxOccurs="1" name="orderId" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="amendData" type="typens:salesOrderAmendData"></xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="comment" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="notifyCustomer" type="xsd:int"></xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="includeComment" type="xsd:int"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
        <xsd:element name="salesOrderAmendResponseParam">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>
</wsdl:types>

And here is the existing elements I am using:

    <xsd:complexType name="orderItemIdQty">
        <xsd:sequence>
<xsd:element name="order_item_id" type="xsd:int"></xsd:element>
<xsd:element name="qty" type="xsd:double"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="orderItemIdQtyArray">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:orderItemIdQty"></xsd:element>
</xsd:sequence>
</xsd:complexType>

Can anyone see what I am doing wrong? I am literally Mage::log the $amendData param in my method: -

public function amend($orderId, $amendData, $comment = '', $notifyCustomer = 0, $includeComment = 0)

But getting no data.

  • In your custom type salesOrderAmendData there is only one field qtys but you are trying to pass one more field order_item_id in your API call for some reason. – Dmytro Zavalkin Mar 11 '13 at 13:42
3

The correct request format according to your description in WSDL is:

...
"amendData" => array(
    'qtys' => array(
        array(
            'order_item_id' => 46,
            'qty' => 1
        )
    )
)
...
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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