How to get customer with orders ?

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!
MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: How to get customer with orders ?

Post by MikaelNazarenko » 28 Aug 2020, 15:19

I have updated aimeos core with command:

Code: Select all

 composer require aimeos/aimeos-core:2019.10.31
but getBaseItem still not exists ((

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

Re: How to get customer with orders ?

Post by aimeos » 29 Aug 2020, 08:20

You are right. Unfortunately, the "getBaseItem()" method isn't available in 2019.10 despite my thought. Thus, the code must be

Code: Select all

$manager = \Aimeos\MShop::create( $context, 'order' );
$search = $manager->createSearch();
$search->setConditions( $search->combine( '&&', [
	$search->compare( '==', 'order.statuspayment', 4 ),
	$search->compare( '==', 'order.base.customerid', [1, 2, 3] )
] ) );
$orderItems = $manager->searchItems( $search, ['order/base', 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'] );

$baseIds = [];
foreach( $orderItems as $orderItem ) {
	$baseIds[] = $orderItem->getBaseId();
}

$manager = \Aimeos\MShop::create( $context, 'order/base' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'order.base.id', baseIds ) );
$baskets = $manager->searchItems( $search, ['order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'] );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply