Create a $manager to get products details of a stored order!
Posted: 26 May 2019, 12:19
I think it is a simple question. Everything is in the title : I'm still beginning with Aimeos and I would like to access all products details of a given stored order using my own controller.
I was hoping that retrieving the order details adding ['product'] domain in the criteria then access it with getProducts() was the correct way to do that but it wasn't.
Here is the code I used:
CODE: SELECT ALL
$obid = 1;
$context = app()->make('\Aimeos\Shop\Base\Context')->get();
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'order.base.id', $obid ) );
$order = $manager->searchItems($search,['text', 'price', 'attribute', 'product']);
$order_products = $order[$obid]->getProducts();
$order is well set but $order_products is an empty array.
Using ->getProducts() is probably naïve
I probably misunderstood something, I couldn't find anything in the documentation and on this forum to help me.
I suppose too that using :
I was hoping that retrieving the order details adding ['product'] domain in the criteria then access it with getProducts() was the correct way to do that but it wasn't.
Here is the code I used:
CODE: SELECT ALL
$obid = 1;
$context = app()->make('\Aimeos\Shop\Base\Context')->get();
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'order.base.id', $obid ) );
$order = $manager->searchItems($search,['text', 'price', 'attribute', 'product']);
$order_products = $order[$obid]->getProducts();
$order is well set but $order_products is an empty array.
Using ->getProducts() is probably naïve
I probably misunderstood something, I couldn't find anything in the documentation and on this forum to help me.
I suppose too that using :