Admin order decorator - Service attributes not updating after $client->save()
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!
Admin order decorator - Service attributes not updating after $client->save()
Laravel framework version: 9.52.4
Aimeos Laravel version: ~2022.10
PHP Version: 8.2.4
Environment: Linux
I can't seem to get the updated service attributes inside the admin order decorator.
Config:
Decorator:
Aimeos Laravel version: ~2022.10
PHP Version: 8.2.4
Environment: Linux
I can't seem to get the updated service attributes inside the admin order decorator.
Config:
Code: Select all
'admin' => [
'jqadm' => [
'order' => [
'decorators' => [ 'MyDecorator' ],
],
],
]
Code: Select all
namespace Aimeos\Admin\JQAdm\Common\Decorator;
class MyDecorator
extends \Aimeos\Admin\JQAdm\Common\Decorator\Base
{
public function save() : ?string
{
$view = $this->view();
$client = $this->getClient();
// Copy the resource so $view->item is available
$client->copy();
$item_original = $view->item;
$return = $client->save();
$item_changed = $view->item;
$payment_original = $item_original->getService( 'payment' )->first();
$payment_changed = $item_changed->getService( 'payment' )->first();
$payment_attributes_original = $payment_original->getAttributeItems(); // Gets current (not updated) attributes
$payment_attributes_changed = $payment_changed->getAttributeItems() // Does not return the updated attributes
return $return;
}
}
Re: Admin order decorator - Service attributes not updating after $client->save()
Another problem is that the invoice payment status change is also not reflected when executing $client->save().
I'm trying to get the old and new values of every order element before and after it has been changed in the admin.
I'm trying to get the old and new values of every order element before and after it has been changed in the admin.
Re: Admin order decorator - Service attributes not updating after $client->save()
The save() method stores the updated data in the database but doesn't update the items. If you need the updated items in the end, you have to fetch them from the database.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Admin order decorator - Service attributes not updating after $client->save()
Thanks, that seems to have been the case.