How to add a customer with an order using JSON API

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

How to add a customer with an order using JSON API

Post by Anshul Dua » 27 Mar 2018, 04:07

How can a user see his/her previous order, I think there is no option to attach a order with any user?
Because When i am saving the basket and creating the order there is no parameter to send the customer id.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to add a customer with an order using JSON API

Post by aimeos » 27 Mar 2018, 07:51

Either the customers have to be logged in or orders are associated depending on their e-mail address.

To retrieve the orders of a customer you have to use the "order" endpoint (GET request without "id" parameter) and the customer has to be logged in.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: How to add a customer with an order using JSON API

Post by Anshul Dua » 27 Mar 2018, 08:32

I am using the custom login. I made my own API for login. is there any other way with customer id etc?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to add a customer with an order using JSON API

Post by aimeos » 27 Mar 2018, 08:56

It doesn't matter what you use as long as you use the Laravel users table it will work out of the box.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: How to add a customer with an order using JSON API

Post by Anshul Dua » 27 Mar 2018, 09:00

I am hitting the
http://localhost/jsonapi/order
and getting the response

{
"meta": {
"total": 0,
"prefix": null,
"content-baseurl": "/",
"csrf": {
"name": "_token",
"value": "7AHkga0vq1L6eMqJuixV9XJggdL1JqPLVxyg2hhR"
}
},
"links": {
"self": "http://localhost/jsonapi/order"
},
"data": []
}

but order exist
Attachments
ordr.PNG
ordr.PNG (9.44 KiB) Viewed 2466 times

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to add a customer with an order using JSON API

Post by aimeos » 28 Mar 2018, 08:31

Is the "customerid" value in the mshop_order_base table of these orders are same as the users.id value of the user you are logged in with?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: How to add a customer with an order using JSON API

Post by Anshul Dua » 29 Mar 2018, 05:24

No, It is not. But I made the solution to add the customerid after create the order and Created custom api for order listing.
Thanks

Post Reply