How to add order comments?

Moderator
Fra United States
Medlem siden okt. 2019

Using the api, when updating an order, can a comment be added also?  If so, how would that get passed via the api, since they are stored in a different table than the orders?

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

Comments is it's own table of data and I think you will need to add it as a separate endpoint e.g. /api.php/orders/123/comments/. See how product images is done in the API.

Moderator
Fra United States
Medlem siden okt. 2019

Product images is not in the api.  Were you thinking of another table?

Also, would I need to create an ent_comments file to handle them?  Or will save() in ent_orders be enough?

Moderator
Fra Lithuania
Medlem siden mar. 2016

tim, am I wrong to say that API addon can handle everything that's inside entities?

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

@dodo, you are mostly right. It can handle everything that is processed by $entity->save(). But appending comments would be hard as you would need to re-add those that are current to prevent them from getting removed. When we set $order->data['comments'] we kind of replace everything that exists in it currently. Therefore a special endpoint would be convenient.

[quote]Product images is not in the api.  Were you thinking of another table?[/quote]
Is it not in the last version available?

Moderator
Fra United States
Medlem siden okt. 2019

[quote]Is it not in the last version available?[/quote]
Yep.  You snuck one past me.  🙂

Du
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.