Getting order details
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!
-
- Posts: 44
- Joined: 05 Oct 2019, 06:42
Getting order details
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
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
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):
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
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();
}
- 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, give us a star
If you like Aimeos, give us a star