Getting order details

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!
adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Getting order details

Post by adityabanerjee » 17 Apr 2020, 11:59

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

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

Re: Getting order details

Post by aimeos » 19 Apr 2020, 07:44

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply