Problem on saving variants on a selection product

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!
ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Problem on saving variants on a selection product

Post by ajrmzcs » 03 Oct 2018, 17:26

Hello,

Laravel: 5.6.
Aimeos: 2018.07.
OS: Centos7.

When creating a selection product and before saving adding a variant (child product) and then click on save. The Selection product is added but the variant is not saved loosing the changes.

If you try to add the variant product once again when selection product is already created (on first attempt) and click save the child product is created without a problem.

Is this a expected behavior? or maybe admins should be able to create a selections product and its variants click on save only once?

Thank you very much for your help :)

Regards,

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

Re: Problem on saving variants on a selection product

Post by aimeos » 04 Oct 2018, 10:54

Thank you for your bug report. We can confirm the issue and already made a fix:
https://github.com/aimeos/ai-admin-jqad ... 38d3423a33

It will be part of the 2018.10 version released next week.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Problem on saving variants on a selection product

Post by ajrmzcs » 16 Oct 2018, 20:48

Hello there,

I've just exceuted composer update upgrade my aimeos/laravel installation to 2018.10 (2018.10.2) for testing selection products. Im getting the same reported error: When creating a selection product with 2 variants and then update the variants with price, stock, etc, the custom variant attribute disappears and have to be added again.

Thank you very much for your help.

Regards,

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

Re: Problem on saving variants on a selection product

Post by aimeos » 17 Oct 2018, 11:34

Think that was a different issue we've fixed this week. The new release of the admin interface is now available so can you execute "composer update" and try again?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Problem on saving variants on a selection product

Post by ajrmzcs » 17 Oct 2018, 19:13

Hi there!!

After running composer update as you suggested, we are getting the following error when clicking on product detail:

htmlspecialchars() expects parameter 1 to be string, array given on vendor/aimeos/aimeos-core/lib/mwlib/src/MW/View/Helper/Encoder/Standard.php Line 55. With the demo data.

Logging then content of $value, we found this before code breaks:

[2018-10-17 11:59:35] dev.INFO: array (
0 => '/stock?s_prodcode%5B0%5D=demo-article',
)
[2018-10-17 11:59:35] dev.ERROR: htmlspecialchars() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): htmlspecialchars() expects parameter 1 to be string, array given at .../vendor/aimeos/aimeos-core/lib/mwlib/src/MW/View/Helper/Encoder/Standard.php:59)

For now, i was able to fix this issue by adding an is_array check like this:

if (is_array($value)) {
return htmlspecialchars( $value[0], ENT_QUOTES, 'UTF-8' );
} else {
return htmlspecialchars( $value, ENT_QUOTES, 'UTF-8' );
}

We are wondering if this is a bug in the core or maybe is related to some of our customization?

As always, thank you very much for help.

Regards,

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Problem on saving variants on a selection product

Post by ajrmzcs » 17 Oct 2018, 20:25

Hi there...

We also tested, with demo data the product/selection variants problems and bug is still there... when you edit any attribute on the variant product (price and stock in our case), the variant attributes disappears on parent product:
Screenshot from 2018-10-17 15-21-04.png
Screenshot from 2018-10-17 15-21-04.png (49.97 KiB) Viewed 3129 times
Thanks.

Regards,

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

Re: Problem on saving variants on a selection product

Post by aimeos » 21 Oct 2018, 11:57

ajrmzcs wrote: For now, i was able to fix this issue by adding an is_array check like this:

if (is_array($value)) {
return htmlspecialchars( $value[0], ENT_QUOTES, 'UTF-8' );
} else {
return htmlspecialchars( $value, ENT_QUOTES, 'UTF-8' );
}

We are wondering if this is a bug in the core or maybe is related to some of our customization?
That might be related to the items/promo header templates you've overwritten. The new ones look like this:
https://github.com/aimeos/ai-client-htm ... andard.php

Reason: Instead of one URL, there are now several stock URLs to prevent problems with length of HTTP URLs if you have a lot of articles where stock levels should be fetched for.

Such kind of changes are the reason why you should only overwrite those templates you really need to change and don't copy all to your own extension.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: Problem on saving variants on a selection product

Post by aimeos » 21 Oct 2018, 12:00

ajrmzcs wrote: We also tested, with demo data the product/selection variants problems and bug is still there... when you edit any attribute on the variant product (price and stock in our case), the variant attributes disappears on parent product:
Does your products have a lot of attributes or other data? We've seen missing data after saving if the value of max_input_vars is too low. But the admin interface of the 2018.10 release should warn you about that ...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Problem on saving variants on a selection product

Post by ajrmzcs » 23 Oct 2018, 19:41

Hi, thanks for your response.
Does your products have a lot of attributes or other data? We've seen missing data after saving if the value of max_input_vars is too low. But the admin interface of the 2018.10 release should warn you about that ...
No. I tested on a fresh aimeos installation with demo data a got the same error. (When editing and saving any child product. The parent's variant attribute disappears).

Please help.

Thanks a lot.

Regards,

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

Re: Problem on saving variants on a selection product

Post by aimeos » 23 Oct 2018, 21:50

Just to be sure: Can you list the steps and the SKUs of the demo products you are editing to get the error? Maybe with a screenshot of the product before and after its variant attributes are lost?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply