order product

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!
yong
Posts: 43
Joined: 10 Apr 2019, 12:55

order product

Post by yong » 04 Jul 2019, 12:21

Hi, please what is the function (manager and item declaration ) to have the products item of an order ;
i'm using aimeos-laravel version 2018.10 in windows 10

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

Re: order product

Post by aimeos » 04 Jul 2019, 13:29

Where do you want to sort the products?

In the Frontend Controller it's the sort() method:
https://github.com/aimeos/ai-controller ... #L157-L164

In the MShop library you can sort by using:

Code: Select all

$filter = $manager->createSearch();
$filter->setSortations( [$filter->sort( '+', 'product.label' )] );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

yong
Posts: 43
Joined: 10 Apr 2019, 12:55

Re: order product

Post by yong » 04 Jul 2019, 13:42

Which manager i have to use ! i want the complete path for declaring the manager

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

Re: order product

Post by aimeos » 04 Jul 2019, 13:44

2019.x:

Code: Select all

$manager = \Aimeos\MShop::create( $context, 'product' );
2018.x:

Code: Select all

$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

yong
Posts: 43
Joined: 10 Apr 2019, 12:55

Re: order product

Post by yong » 04 Jul 2019, 14:17

please, i mean u don't understand ! i have an order ID for a customer and i want for that order id (or item ) all the products of the customer order.

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

Re: order product

Post by aimeos » 04 Jul 2019, 14:25

That's something totally different:

Code: Select all

$orderItem = \Aimeos\MShop::create( $context, 'order' )->getItem( '<id>' );
$orderBaseItem = \Aimeos\MShop::create( $context, 'order/base' )->getItem( $orderItem->getBaseId(), ['order/base/product'] );
$orderProductItems = $orderBaseItem->getProducts();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

yong
Posts: 43
Joined: 10 Apr 2019, 12:55

Re: order product

Post by yong » 04 Jul 2019, 14:34

It seem this is not working for 2018.x version

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

Re: order product

Post by aimeos » 04 Jul 2019, 14:36

For 2018.10:

Code: Select all

$orderItem = \Aimeos\MShop\Factory::createManager( $context, 'order' )->getItem( '<id>' );
$orderBaseItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->getItem( $orderItem->getBaseId(), ['order/base/product'] );
$orderProductItems = $orderBaseItem->getProducts();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

yong
Posts: 43
Joined: 10 Apr 2019, 12:55

Re: order product

Post by yong » 04 Jul 2019, 15:38

Thanks ! it's helpful

Post Reply