Opencart Product Option Value Limit How many option values can be in option in Opencart

  • A+
所属分类:Opencart相关

f you’re like me you have an OpenCart site with thousands of possible option values for individual product options. Mine resulted from a large import of data. After which, I was no longer able to remove or add more option values (eg: too many fields in the form).

Many people think this is a limitation of OpenCart, which is not the case… the issue resides in your server’s PHP configuration. Specifically with PHP’s max_input_vars and post_max_size directives.

This is what was in my server’s php.ini file…

max_input_vars = 1000;
post_max_size = 8M;

So I updated the settings as follows…

max_input_vars = 5000;
post_max_size = 16M;

I hate modifying those settings as it opens the site up for potential DDoS attacks, but it’s better than taking it upon myself to rewrite “admin/controller/catalog/option.php” 🙁

When it’s all said and done, this may not be an OpenCart bug , but it is definitely a design flaw of options administration. The first mention of the issue I found is more than a few years old. OC devs passing blame instead of implementing a simple solution is not uncommon. OpenCart could paginate the option values administration just like they do with every other area where many records are likely to solve this common problem.

Errors that were present prior to applying the above fix (mostly for people searching this topic)…

Notice: Undefined index: option_value_description in /admin/controller/catalog/option.php
 Warning: Invalid argument supplied for foreach() in /admin/controller/catalog/option.php

5 THOUGHTS ON “OPENCART OPTION VALUE LIMITS (IMPOSED BY SERVER)”

  1. Ron Miller

    Hi Robert,

    I’m a novice… how do I access my server’s php.ini file? My site is not hosted locally but through a remote service provider. Is it available through cPanel or ?

    Thanks!
    Ron

    REPLY
    1. admin

      You should have access to that via cPanel. If your cPanel is a recent version, look under: Software > MultiPHP INI Editor

      REPLY
  2. Mohammed Nahian

    Hello,i have checked my php.ini in my cpanel,there is no max_input_vars or post_max_size availabe……..so what should i do now?? I have the problem that is i cant add more than 7 options to a produc where i need to add 20 options…..in another product i have managed to add 9 options,but can’t add more than 9 options…thanks

    REPLY
    1. admin

      Add them 😉

      REPLY
  3. Thomas

    Thank you for this tip, it worked for me

    OpenCart worked fine until 96 product options, adding 97th option maked the admin panel displaying error

    adding to php.ini as you wrote:
    max_input_vars = 5000;
    post_max_size = 16M;
    solved this problem immediatelly

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: