Page 1 of 1

Getting order details

Posted: 17 Apr 2020, 11:59
by adityabanerjee
Hi Aimeos,

I want to get the order details. I want to get the order details in a controller method of Laravel and pass it to a view. Could you please tell me how could I get the order details in the Laravel controller method? What would be the query? Is there a built-in method to get order details? Please assist.

Thank you

Aditya Banerjee

Re: Getting order details

Posted: 19 Apr 2020, 07:44
by aimeos
You can retrieve orders using the Aimeos order frontend controller if you are logged in as the customer who have placed the order. Use these code for example (2020.x version):

Code: Select all

// get the context which includes the database connection
$context = app( 'aimeos.context' )->get();
// create the order frontend controller
$cntl = \Aimeos\Controller\Frontend::create( $context, 'order' );
// pass the parts you want to fetch for the orders:
$cntl->uses( ['order/base', 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'] );
// search() returns the order items
foreach( $cntl->search() as $item ) {
 // getBaseItem() returns the basket
  $base = $item->getBaseItem();
}
You can find the interface for the objects here:
- https://github.com/aimeos/ai-controller ... /Iface.php
- https://github.com/aimeos/aimeos-core/b ... /Iface.php
- https://github.com/aimeos/aimeos-core/b ... /Iface.php