Page 1 of 1

Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Sun Jul 14, 2019 4:58 pm
by Kiu
Hello everybody,

I have already posted this error via GitHub and was referred to this forum, because I am not a programmer but a user/shop owner.

I respect the work of the developers very much and don't want to waste their time...but would also like to help to correct this error ... because we use only products with many options in our shop and it is therefore very important for us that this works reliably.
Can someone write to me what I need to do, to give the developers the information they need? Here is the history of the topic that I had at GitHub.
____________________________

What version of OpenCart are you reporting this for?
Latest Master from GitHub

Describe the bug
Adding products with several options (in the "Option"-Tab) is not possible properly. If I add many options (let's say >3), only a few of them are saved.
In my test, I added two products:
Product 1 saved 3 options (of 8 options, that were configured during adding)
Product 2 saved 2 options (of 4 options, that were configured during adding)

Also, adding the missing options, AFTER saving the product is not possible.

To Reproduce
Steps to reproduce the behavior:


Go to Catalog/Options and add several Options (I added 8 options with Textfield, Text, Radio and so on)
Go to Calalog/Products and add a products with the options above
Go to Frontend and try to add the products or go to Catalog/Products again. In both cases, not all options are saved.

Expected behavior
Every selected option should be saved with the product.

Server / Test environment (please complete the following information):

Deployed to a web server
PHP version 7.3
Firefox
Version [latest]

___________________________________
Answer from Straighlight:
When re-adding the product options, troubleshoot the posted array on the browser and see which array keys or values might have an issue, according to this incident report.
__________________________________
My question
What do I need to do, to give the developers the information they need?

Thanks in advance
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Sun Jul 14, 2019 6:15 pm
by straightlight
No OC version posted. Forum rules. Not a bug. The max post size in your php.ini file must be increased.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Sun Jul 14, 2019 9:36 pm
by Kiu
Hello Straightlight,

thanks a lot for your reply.
Regarding your comment "No OC version posted": I used the latest Master from GitHub.
Regarding your comment "Not a bug. The max post size in your php.ini file must be increased.": I added the line
"post_max_size = 999M" to the php.ini, but this doesn't make any difference in the behaviour. It's still not possible to add more than three options to a product.

If you (or any other) has suggestions to this, I will help by trying everything :-)
As I use a test-environment, it's also no problem to share the credentials, so it might be easier to get this issue.

Kind regards
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Sun Jul 14, 2019 9:44 pm
by straightlight
Contact your host if no effects after increasing the max post size . It's not an OC issue.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Sun Jul 14, 2019 11:58 pm
by Kiu
Hello Straightlight,

I just wanted to report, that I contacted my provider. They wrote, that changed in php.ini are not taken into account and that I have to change the .htaccess

I uncommented these lines:
php_value post_max_size 999M
php_value max_execution_time 200
php_value max_input_time 200

...but these changes don't change the behaviour.

Kind regards
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Mon Jul 15, 2019 4:33 am
by straightlight
Then keep notifying them about it since they're the ones who handles support for your server as well as providing those instructions.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Mon Jul 15, 2019 6:14 pm
by victorj
When multiple options are nog saved Then max input variables value needs to be increased.

Ad this tot your htaccess file, of ask your hoster tot change it in PHP settings.

max_input_vars = 100000

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Mon Jul 15, 2019 6:19 pm
by straightlight
victorj wrote:
Mon Jul 15, 2019 6:14 pm
When multiple options are nog saved Them max input variables value needs to be increased.

Ad this tot your htaccess file, of ask your hoster tot change it in PHP settings.

max_input_vats = 100000
Even I can't understand what's written there nor have I ever seen max_input_vats before ...

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Mon Jul 15, 2019 8:01 pm
by letxobnav
if you exceed the default max_input_vars of 1000 you would get a warning in your server logs.
Mind you that is the number of post variables, if you exceed 1000, you are doing something really stupid with OC.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 9:50 pm
by Kiu
Hello Straighlight, hello letxobnav,

thanks for your suggestions.
@straightlight: I contacted my provider by phone and the guy looked at my settings and told me, that the variables are working in .htaccess
@letxobnav: I also added your "php_value max_input_vars 1000" into the .htaccess

The issue is still there.

But now, the things are going strange:
I tried a few things ...
As I said, I had initially created nine options and then tried to create products with these options.
I have noticed now, that the problem does not seem to have anything to do with the NUMBER of options. Because I can easily create five of these options ... but the other four options are not accepted.
Even if I create a complete new product with only ONE option (and this is one of the non-functioning options), that does not work.
The error does not appear at the "product-tab" level, but at the "option-tab" level.
I had already suspected, that it is something with the "type" of an option ... but for example, two of the options with type "text" are working, but one is not.
Do you have ideas / suggestions for this?

Thanks and kind regards
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 9:56 pm
by straightlight
@straightlight: I contacted my provider by phone and the guy looked at my settings and told me, that the variables are working in .htaccess
In .htaccess, perhaps, but what about in php.ini or user.ini file?
I have noticed now, that the problem does not seem to have anything to do with the NUMBER of options. Because I can easily create five of these options ... but the other four options are not accepted.
In your admin/controller/catalog/product.php file, in your edit() method,

find:

Code: Select all

$this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
add above:

Code: Select all

echo "<pre />\n";
print_r($this->request->post);
echo "</pre>\n";
exit;
Then, go to your admin products edit form page and play with your product options. Then, save the form. You will notice an array. Please post this array afterwards.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 10:49 pm
by Kiu
Hello Straightlight,

I added the code above
$this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
to admin/controller/catalog/product.php and saved it.
Then, I went back to admin and opened one of the products and wanted to add a "non-working" option. I saved the product, but don't see any array.
After saving, I'm redirected to the main Product-Folder and can see the message:
Success: You have modified products!

I hope, you can help?!

Thanks and kind regards
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 11:24 pm
by straightlight
It's possible that you are using an OCMod extesnion that also uses that file under your storage/modification/admin/controller/catalog/product.php file. You'll need to do the same steps there but don't use the refresh button in the modifications this time.

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 11:31 pm
by Kiu
Hello Straightlight,

I use a "fresh" installation from the Github-OC-Master from last week. I didn't installed any extension.
I checked the storage-folder, which is completely empty (only index-file)

If it's helpful, you can get the credentials at any time, as this is a test-environment.
If you have other suggestions, I will try my best to help (as this might be a bug).

Kind regards
Kiu

Re: Products -> Not all "Options" are saved, also cannot be added afterwards

Posted: Thu Jul 18, 2019 11:38 pm
by straightlight
Using the Github version is not stable. It is still on a development stage at this time - especially with the product options since a mass load of features are being modified in there. I would not suggest to use it at this time.