Update the order status value

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!
User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Update the order status value

Post by ahmed31916 » 27 May 2022, 20:16

Hello,

This query updates the status delivery for the order number 2, but it doesn't store the value in the database.

Code: Select all

\Aimeos\MShop::create( $this->context(), 'order' )->get(2)->setStatusDelivery(2);


Why?

marnel
Posts: 13
Joined: 12 Feb 2022, 21:21

Re: Update the order status value

Post by marnel » 29 May 2022, 00:22

Still trying to understand all of this like you but can you try this ?
I think it will work

Code: Select all

$s = \Aimeos\MShop::create( $this->context(), 'order' );
$order = \Aimeos\MShop::create( $this->context(), 'order' )->get(2);
$order->setStatusDelivery(2);
$s->save($order);

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Update the order status value

Post by ahmed31916 » 29 May 2022, 04:33

Thanks for your contribution.
The same result.

this is the debug result:

Code: Select all

    "order.id" => "2"
    "order.baseid" => "2"
    "order.siteid" => "1.3."
    "order.channel" => ""
    "order.datepayment" => "2022-05-24 06:30:54"
    "order.datedelivery" => null
    "order.statuspayment" => "5"
    "order.statusdelivery" => 2
    "order.relatedid" => ""
    "order.ctime" => "2022-05-24 06:26:32"
    "order.mtime" => "2022-05-24 06:30:54"
    "order.editor" => "Paul Mcpherson"
    ".statusdelivery" => "4"
statusdelivery changed but doesn't stored in the database.

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

Re: Update the order status value

Post by aimeos » 29 May 2022, 07:16

@marnel is right, you have to call the save() method to store the modified items.

In a multi-site setup, you also need to make sure that the currently used site is the same as the site (siteid) of the item.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Update the order status value

Post by ahmed31916 » 29 May 2022, 09:40

thanks @aimeos, thanks @marnel.
It works after changing the context site locale.

Post Reply