Questions About Order History API Response
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- PaoloLegaspi
- Posts: 35
- Joined: 07 Nov 2024, 15:02
Questions About Order History API Response
Hi! We’re working on the order history page for our frontend and ran into a couple of questions:
//Rebate screenshots
- For an ordered product that has a granted rebate value set up in the price panel, we noticed that in the JSON API response, order.product.rebate is showing "0.00" instead of the expected "59.00". Could you help us figure out why this might be happening?
- Also, would it be possible to include the product URL segment in the order.product response? It would really help us easily redirect users to the product details page for the ordered item.
//Rebate screenshots
- Attachments
-
- Screenshot 2024-12-26 at 3.54.51 PM.png (134.92 KiB) Viewed 13859 times
-
- Screenshot 2024-12-26 at 3.47.47 PM.png (149.74 KiB) Viewed 13859 times
Re: Questions About Order History API Response
The granted rebate value in the price item used for displaying the original price isn't stored in the order product item because rebate values there are discounts from coupon codes. The fetch the original price rebate and the product URL segment, use "...&include=order.product,product,price"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- PaoloLegaspi
- Posts: 35
- Joined: 07 Nov 2024, 15:02
Re: Questions About Order History API Response
Hi, thank you for getting back to us
We’ve tried your suggestion using this URL: http://localhost:8000/jsonapi/order?include=order.product,product,price We have some questions and concerns about the response:
We’ve tried your suggestion using this URL: http://localhost:8000/jsonapi/order?include=order.product,product,price We have some questions and concerns about the response:
- The JSON API does return the prices of the products (which is great!), but we’re having trouble identifying which product each price is linked to. In the response, all prices are under the included array, but there’s no ID to clearly map a price to its corresponding product.
- Our goal is to show both the original price and the discounted price (if there's a granted rebate) in the order history listing. Without this mapping, it’s challenging to display the correct information.
- Regarding the product data, when using include=product, the response only includes the product ID in the relationships array but doesn’t return the actual product details.
- Ideally, we’d like the product data (or at least the URL segment) to be included directly in the jsonapi/order route response. Since we rely on the URL segment to fetch or redirect to the product, having it in the response would eliminate the need for additional requests to retrieve product details. This would help streamline the process and enhance frontend performance.
Re: Questions About Order History API Response
In the JSON:API standard, all related items are referenced via the "relationships" key in the data items and the related items are stored in the "included" array. See https://aimeos.org/docs/latest/frontend ... -resources
You can simplify the returned structure of the JSON:API by using a JS package which maps the related items directly to the data like https://www.npmjs.com/package/json-api-models
You can simplify the returned structure of the JSON:API by using a JS package which maps the related items directly to the data like https://www.npmjs.com/package/json-api-models
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
