Magento API V2 - Add an Additional API Response Attribute

I am using Magento API V2.

When I call salesOrderCreditmemoInfo , I get a response with credit memo data and a list of products related to the order.

But there is no product_type attribute in the product item list .

I want to manually edit the answer to add this attribute.

I tried editing: Application \ code \ core \ Mage \ Sales \ Model \ Order \ Creditmemo \ Api.php

And replaced by:

public function info($creditmemoIncrementId)
{
    ...
    $result['items'] = array();
    foreach ($creditmemo->getAllItems() as $item) {
        $result['items'][] = $this->_getAttributes($item, 'creditmemo_item');
    }

With the following - (basically adding an additional attribute to the array):

 public function info($creditmemoIncrementId)
    {
      ...
    $result['items'] = array();
    foreach ($creditmemo->getAllItems() as $item) {
            $product_type = '1'; //test value to check if works
            $attribs = $this->_getAttributes($item, 'creditmemo_item');
            $attribs['product_type'] = $product_type;

            $result['items'][] = $attribs;
        }

When I do mage :: log ($ result), the extra attribute seems to be added correctly to the array. (also indicating that this function is called the caller) But this does not affect the actual API response.

- , ?

+5
1

SOAP V2, wsdl.xml, .

product_type . /tmp, wsdl.xml, . .

+7

All Articles