cancel
Showing results for 
Search instead for 
Did you mean: 

Getting order status by status code [WebAPI] .

Getting order status by status code [WebAPI] .

Hello

 

I've came across strange situation when trying to get order status. When I retrieve order data (using "order.info"), there are two fields describing current order state and status. One is a "state" and second one is a "status" which gives me status code instead of status user friendly name. How can I get appropriate status name based on it's status code? I can't find any suitable method.

I saw this post Retrieve list of available order statuses via the API but the answer really misses the point.

 

Regards

3 REPLIES 3

Re: Getting order status by status code [WebAPI] .

I don't think there is existing api getting list of status, you have to create your own.

or you can simply customize order.info to get status label.

just add this line

 

$result['status_label'] = $order->getStatusLabel();

after

$result = $this->_getAttributes($order, 'order');

 

in Mage_Sales_Model_Order_Api::info, or better yet, rewrite this class and get status_label in _getAttribute

 

then you will get status label in soap V1, if you use V2, you will also have to customize xml files, check this post https://lurajcevi.wordpress.com/2014/09/20/add-custom-attributes-to-magento-soap-api-v1-and-v2/

 

Re: Getting order status by status code [WebAPI] .

Ok. Thanks for answer.

 

As I thought I have to modify API. Well it wasn't my intent coz it will be used gloabally and I don't want to force users to modify their magento files in order to get simple status name. It's ridiculous. API should let you to retrieve all statuses names with their codes and state which they belong to.

Re: Getting order status by status code [WebAPI] .

How about override the function:

Mage_Sales_Model_Order_Api :: items()

 

as your custom module?