Page 1 of 1

Max number of options

Posted: Thu Sep 19, 2019 10:46 pm
by goodguyssigns
When I enter over a certain nubmer of optionsI get his error

Undefined index: option_value_id in /admin/model/catalog/product.php on line 241

I have tried setting max_input_vars as high as 190000 to see if the suggested changes fixes it, but it does not.

We have an option for color that may have as many as 60 colors. Are there any other settings to avoid this issue.

Re: Max number of options

Posted: Thu Sep 19, 2019 11:42 pm
by opencartmart
goodguyssigns wrote:
Thu Sep 19, 2019 10:46 pm
I have tried setting max_input_vars as high as 190000 to see if the suggested changes fixes it, but it does not.
How did you increase? Make sure it has increased properly. If you are increasing using php.ini, try adding in .user.ini file because configuration file may be different depending on php configuration.

Create a php file info.php and add following code and upload it on the admin directory. Then access it using browser to check the current of max_input_vars

Code: Select all

<?php
phpinfo();
?>

Re: Max number of options

Posted: Fri Sep 20, 2019 12:36 am
by goodguyssigns
Thank you:

The server is running nginx+php-fpm
PHP version is 7.2
In php.ini, I have (only changed to 190000 for testing)

max_input_vars = 9000

In admin/controller/product/edit, I added
echo count($this->request->post, COUNT_RECURSIVE) - count($this->request->post);
This gives me 1108 on the failed posts. Posts under 1000 work as expected.

In /etc/php-fpm.d/www.conf, I added
php_value[max_input_vars] = 10000

In /etc/nginx/fastcgi_params, I added
fastcgi_param PHP_VALUE max_input_vars=9000;

For each change, nginx and php-fpm were issues a full stop and check to ensure the process was actually stopped before starting again.

There are no user.ini or directory level php.ini files

Is there anything in the code which limits form fields or array recursion?
Are there any other locations I can look for?

Re: Max number of options

Posted: Fri Sep 20, 2019 12:50 am
by goodguyssigns
I added aa .user.ini file under admin

ini_get() gives me


number of posted fields = 1108
post_max_size = 100M
max input vars = 9001 - this is from the .user.ini I added to /admin
post_max_size in bytes = 100M
Notice: Undefined index: option_value_id in ****/admin/model/catalog/product.php on line 241

Re: Max number of options

Posted: Fri Sep 20, 2019 8:17 am
by letxobnav
instead of fiddling with the numbers you do not understand, output the post variables to the error log and see if they are cut-off.

Re: Max number of options

Posted: Fri Sep 20, 2019 5:25 pm
by paulfeakins
goodguyssigns wrote:
Fri Sep 20, 2019 12:50 am
max input vars = 9001 - this is from the .user.ini I added to /admin
Try increasing this to 100000 and verifying that it has taken effect first before trying again.