How to Attach Customer ID to Orders?

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!
User avatar
PaoloLegaspi
Posts: 24
Joined: 07 Nov 2024, 15:02

How to Attach Customer ID to Orders?

Post by PaoloLegaspi » 12 Dec 2024, 04:10

Hi,
We're trying to display customer orders on the profile page, but it's returning null. We discovered that customer IDs are not being attached to the order data when a user places an order, so they aren't saved in the database. How can we ensure the customer ID is linked to the order? We are using Jsonapi

Thanks!

Code: Select all

Aimeos version: Aimeos Headless 2024.07.*
PHP version: 8.2
Environment: Mac

User avatar
PaoloLegaspi
Posts: 24
Joined: 07 Nov 2024, 15:02

Re: How to Attach Customer ID to Orders?

Post by PaoloLegaspi » 13 Dec 2024, 00:41

In our checkout flow (using JSON:API):

1. The customer logs in. (JWT auth)
2. They add products to the basket. (Gets added to basket)
3. The customer provides a delivery address. (Gets added to basket)
4. The customer provides a payment address. (Gets added to basket)
5. They pick a payment service and delivery service. (Gets added to basket)
6. Finally, they place the order and get redirected to payment (Montonio).

For some reason, the customerid isn’t getting attached to the created orders, and I’m not sure what we’re missing or doing wrong. Any ideas?

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

Re: How to Attach Customer ID to Orders?

Post by aimeos » 13 Dec 2024, 09:40

Can you please upgrade to 2024.10 and then, execute:

Code: Select all

composer req aimeos/ai-cient-jsonapi:2024.10.x-dev
This commit should add the customer ID automatically to the order now:
https://github.com/aimeos/ai-client-jso ... b817edaf36
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply