Item Save Error (Product, Service, Attribute, etc)

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!
mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Item Save Error (Product, Service, Attribute, etc)

Post by mohal_04 » 09 Oct 2018, 17:43

Laravel: 5.6
Aimeos: 2018.07
PHP: 7.1.18

Hi again,

So, we are facing a weird error when we try to save any item, e.g. Product, Service, or Attribute.

Error:
No value for key "item" found, E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\View\Standard.php:119
I have looked into code for 2 days but unable to find the reason for this error. The closest I am able to get is the following line of code:
$manager->saveItem( clone $view->item );
The above line of code is from ./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Service/Standard.php file. I think in $view->item, item is empty but why is it empty?

Actually, almost a month ago one of our developer accidentally pushed old code into our repository. Though I have updated Aimeos since then but I am not sure if that is the cause of the issue.

Can you guys please provide some wisdom on this? The log is also not capturing any error. :(

Thanks!

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

Re: Item Save Error (Product, Service, Attribute, etc)

Post by aimeos » 10 Oct 2018, 17:58

Questions:
- Did you overwrite the service manager?
- Did you add a sub-panel to the service panel?
- Did you changed the templates of the service panel and/or sub-panels?

If you know it occurs around the

Code: Select all

$manager->saveItem( clone $view->item );
code, check if $view->item is available after calling fromArray() to see if it's missing there or if the problem is in the loop over the sub-panel classes.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: Item Save Error (Product, Service, Attribute, etc)

Post by mohal_04 » 12 Oct 2018, 10:45

aimeos wrote:Questions:
- Did you overwrite the service manager?
- Did you add a sub-panel to the service panel?
- Did you changed the templates of the service panel and/or sub-panels?

If you know it occurs around the

Code: Select all

$manager->saveItem( clone $view->item );
code, check if $view->item is available after calling fromArray() to see if it's missing there or if the problem is in the loop over the sub-panel classes.
Hi,

Thank you very much for your help! I have fixed the issue. I had to update two files, i.e. ./ext/my-extension/admin/jqadm/templates/service/item-price-standard.php & ./ext/my-extension/admin/jqadm/src/Admin/JQAdm/Service/Price/Mystandard.php with their updated copies. One of the developer from my team made few changes in those files to show some extra fields. So, when we updated Aimeos from 2018.04 to 2018.07 many files changed in Aimeos extensions but we didn't update our extension. Anyhow, I have fixed the issue.

Thanks again!

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: Item Save Error (Product, Service, Attribute, etc)

Post by mohal_04 » 12 Nov 2018, 04:53

aimeos wrote:Questions:
- Did you overwrite the service manager?
- Did you add a sub-panel to the service panel?
- Did you changed the templates of the service panel and/or sub-panels?

If you know it occurs around the

Code: Select all

$manager->saveItem( clone $view->item );
code, check if $view->item is available after calling fromArray() to see if it's missing there or if the problem is in the loop over the sub-panel classes.
Hi,

So, I previously solved this issue for Services but I am unable to resolve it for Product save. I have debugged code and it seems the Stock sub-client is unable to find "item" against its "view." Can you guide me from where Stock Client is getting the view?

Any help would be appreciated, we have been struggling to resolve this for a week now.

Thanks!

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

Re: Item Save Error (Product, Service, Attribute, etc)

Post by aimeos » 12 Nov 2018, 21:29

The product item is passed here to the stock client:
https://github.com/aimeos/ai-admin-jqad ... d.php#L239
The view got the product item here:
https://github.com/aimeos/ai-admin-jqad ... d.php#L517
The save() method of product stock client is called:
https://github.com/aimeos/ai-admin-jqad ... d.php#L124
Entries from the product stock panels are saved here:
https://github.com/aimeos/ai-admin-jqad ... d.php#L315

Then, the process flow returns to the save() method of the product client and it redirects to the get() method here:
https://github.com/aimeos/ai-admin-jqad ... d.php#L245
You are now in another request, view has no values assigned yet but this is done now there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L190
The stock template doesn't use "$this->item" even if it exists so my guess is your problem is in your overwritten stock template:
https://github.com/aimeos/ai-admin-jqad ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply