No value for key "item" found
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!
No value for key "item" found
Laravel framework version: 9.26.1
Aimeos Laravel version: * 2022.07.2
PHP Version: 8.1.9
Environment: Linux
Following the example here, I created a decorator named "Mydecorator" inside
<MY PLUGIN>/src/Admin/JQAdm/Common/Decorator/Mydecorator.php
https://aimeos.org/docs/latest/admin/jq ... nd-panels/
I overrode the save() method like in the example:
I configured <MY PLUGIN>/config/admin.php like this:
When attempting to test saving the product, I get the following error:
"No value for key 'item' found"
The error occurs on this line:
$item = $this->view()->item;
I want to implement an audit log for tracking who changed what in every module.
I have tried the package "owen-it/laravel-auditing", but it does not work, as Aimeos does not use Eloquent models.
Help would be appreciated, thank you.
Aimeos Laravel version: * 2022.07.2
PHP Version: 8.1.9
Environment: Linux
Following the example here, I created a decorator named "Mydecorator" inside
<MY PLUGIN>/src/Admin/JQAdm/Common/Decorator/Mydecorator.php
https://aimeos.org/docs/latest/admin/jq ... nd-panels/
I overrode the save() method like in the example:
Code: Select all
public function save() : ?string
{
$item = $this->view()->item;
// notifiy the 3rd party system
return $this->getClient()->save();
}
Code: Select all
return [
'jqadm' => [
'product' => [
'decorators' => [
'global' => [ 'Mydecorator' ]
]
]
],
'jsonadm' => [
],
];
"No value for key 'item' found"
The error occurs on this line:
$item = $this->view()->item;
I want to implement an audit log for tracking who changed what in every module.
I have tried the package "owen-it/laravel-auditing", but it does not work, as Aimeos does not use Eloquent models.
Help would be appreciated, thank you.
Re: No value for key "item" found
This is a mistake in the docs. Can you please try this instead:
Code: Select all
public function save() : ?string
{
$result = $this->getClient()->save();
$item = $this->view()->item; // assigned by inner objects
// notify the 3rd party system
return $result;
}
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
Re: No value for key "item" found
Thank you, this removes the error, but there is another problem.
Now that this line is above everything, I can't reach the state of the item before the change.
$result = $this->getClient()->save();
After save() is called, the item is already changed, right?
How can I get the attributes of the item before the actual change?
Now that this line is above everything, I can't reach the state of the item before the change.
$result = $this->getClient()->save();
After save() is called, the item is already changed, right?
How can I get the attributes of the item before the actual change?
Re: No value for key "item" found
You can only get the POST parameters using "$this->view()->param()" or "$this->view()->param( '<name>' )" but not set them and the item is assigned by the inner object so the options are limited for your use case.
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
Re: No value for key "item" found
Thank you, the best thing I can think of is:
1) Getting the product ID from the $_POST parameters
2) Querying the product to get the original values
3) While we are at it with the $_POST parameters, get the new values as well
4) Save the previous and changed values as JSONs in the database
4) Execute $this->getClient()->save();
I don't know how practical of a solution this is, I thought I could find a cleaner solution in the docs, thank you.
1) Getting the product ID from the $_POST parameters
2) Querying the product to get the original values
3) While we are at it with the $_POST parameters, get the new values as well
4) Save the previous and changed values as JSONs in the database
4) Execute $this->getClient()->save();
I don't know how practical of a solution this is, I thought I could find a cleaner solution in the docs, thank you.
Re: No value for key "item" found
The Changelog manager decorator in the aimeos-core package is much better suited for that:
https://github.com/aimeos/aimeos-core/b ... ngelog.php
You can create your own decorator that does something similar.
https://github.com/aimeos/aimeos-core/b ... ngelog.php
You can create your own decorator that does something similar.
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