How to get customer with orders ?
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: How to get customer with orders ?
I have updated aimeos core with command:
but getBaseItem still not exists ((
Code: Select all
composer require aimeos/aimeos-core:2019.10.31
Re: How to get customer with orders ?
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, give us a star
If you like Aimeos, give us a star