Order.id not found

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

Order.id not found

Post by adityabanerjee » 17 Apr 2020, 16:56

Hi Aimeos,

I am trying to get the order by id i.e order id 1. But it is throwing an exception -:

Aimeos\MShop\Exception

Item with ID "1" in "order.id" not found

My code-:


$context = app( 'aimeos.context' )->get();
$cntl = \Aimeos\Controller\Frontend::create( $context, 'order' )->uses(
['order/base', 'order/base/address', 'order/base/coupon',
'order/base/product', 'order/base/service'] );


echo "<pre>";
print_r($cntl->get('1'));
die;

I have checked that the order with order id 1 exists and also checked the database table.

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

Re: Order.id not found

Post by aimeos » 19 Apr 2020, 07:53

You must be logged in as customer who created the order to retrieve its order details.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

unknow76616
Posts: 48
Joined: 30 Apr 2023, 12:46

Re: Order.id not found

Post by unknow76616 » 06 Jun 2024, 10:38

Code: Select all

{
//in webhook contraller
$context = app('aimeos.context')->get();
$manager = \Aimeos\MShop::create($context, 'order');
$order = $manager->get($orderId);
}
i still got "order.id" not found ( even id is exsit )
Is it possible to retrieve an order without requiring user login? , Because it's system callbacks ( webhook )

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

Re: Order.id not found

Post by aimeos » 07 Jun 2024, 10:06

alababdiy wrote: 06 Jun 2024, 10:38

Code: Select all

{
//in webhook contraller
$context = app('aimeos.context')->get();
$manager = \Aimeos\MShop::create($context, 'order');
$order = $manager->get($orderId);
}
Your code is correct and should return the order if the ID exists and if the site ID matches with the one from the context locale object (check the last condition).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

unknow76616
Posts: 48
Joined: 30 Apr 2023, 12:46

Re: Order.id not found

Post by unknow76616 » 08 Jun 2024, 09:05

Is there a way to force $context to set a specific site ID so I can limit my search to orders within that site or all sites?

i try to make reset order SiteID on $context by this line
$context->setLocale( app( 'aimeos.locale' )->getBackend( $context, $siteID ) );

but still showing Item with ID "XXX" in "order.id" not found


[ UPDATE , SOLVED ]

I should pass $siteCode instead $siteID :
$context->setLocale( app( 'aimeos.locale' )->getBackend( $context, $siteCode ) );

Post Reply