Get product details with basket

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Tantacula
Posts: 1
Joined: 16 Dec 2022, 11:43

Get product details with basket

Post by Tantacula » 16 Dec 2022, 12:01

Is it possible to get additional product information (product,attribute,media) from get request to jsonapi/basket and from post request for adding product to basket? I tried to use "include=product" param but with no luck. I inspected templates/client/jsonapi/basket/standard.php file and found next block:

Code: Select all

		if( $product = $orderProduct->getProductItem() )
		{
			$entry['relationships']['product']['data'][] = ['type' => 'product', 'id' => $product->getId()];
			$result = array_merge( $result, $this->jincluded( $product, $fields ) );
		}
getProductItem method returns null in my scenarios.

Laravel 9.43
"aimeos/aimeos-laravel": "2022.10.4",
"aimeos/ai-client-jsonapi": "2022.10.2",
"aimeos/aimeos-core": "2022.10.7"

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

Re: Get product details with basket

Post by aimeos » 19 Dec 2022, 09:20

Unfortunately, the basket endpoint manages a serialized representation of the (future) order and doesn't store any related items (and doesn't fetch them too). Only if the basket is stored and becomes an order, you are able to retrieve the original product of each order product item along with other related items to the product.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply