1

While creating the configuration products in magento2.2.2 I am facing the “Invalid Form Key. Please refresh the page” error. I have google regarding this error and I have found the solution to increase the value of max_input_vars PHP configurable variable. I have increased this value but the problem is not solved.

While creating the configurable product almost 40000 associated product is generated and now I have set the max_input_vars value to 3075000 but the problem is not solved.

Anyone please help me to fix this issue.

Narayan
  • 1,670
  • 1
  • 19
  • 37

2 Answers2

0
  1. Honestly, i don't think you will be able to create 40001 products in just one time.
  2. Then, associate 40000 products to a configurable one from admin product page, looks also something hard.

If you have developper skills, I recommend you to script all of this. Programatically create products is easy.

Btw, you will need to increase php max_excecution_time if you script don't use PHP Cli (When you run php command line, or CRON, there will be no maximum execution time.)

Usually, i run thoses scripts from Magento CRON to keep a 2mn php max_excecution_time.

Antoine Martin
  • 618
  • 8
  • 21
  • I am new to Magento2 can you please provide me any hint how to process all this 40K associative product via script. – Narayan Jul 11 '19 at 09:45
  • Ok. I think I finded some good process for you. Have you try this Magento 2 feature ? https://amasty.com/knowledge-base/magento-2-import-configurable-products.html – Antoine Martin Jul 11 '19 at 09:50
  • Hm. It's very weird : this import page only contains a few input fields. Your problem doesn't seem to be related to `max_input_var` php option, but related to form_key or session. Are you working with `http://localhost/` url ? Have you tried with Chrome AND Firefox ? If you are using Redis, can you flush it ? If you are not using Redis, can you empty the var/session folder please ? – Antoine Martin Jul 11 '19 at 10:02
  • I have tried on both localhost & server. Also I have tried on Chrome, firefox normal as well as private window. and before start this I have also clear the var/ session, var/cache, var/page_cache folders. But same problem :( – Narayan Jul 11 '19 at 10:18
  • OK, next questions :) Can you paste a phpinfo();die; at the top your pub/index.php file please ? Then tell me values of : `max_file_uploads`, `max_input_vars` and `post_max_size` please ? – Antoine Martin Jul 11 '19 at 10:47
  • please check php configuration value `max_file_uploads = 20, max_input_vars=3075000, post_max_size = 32M` – Narayan Jul 12 '19 at 03:56
0

40,000 variations on configurable product will take too long to load on the admin, besides, are you displaying 40,000 options on frontend to the customer? I suggest you review your solution on this, this is a design issue.

  • Yes we need all this 40K options in fronend for this we have already created the custom design. – Narayan Jul 11 '19 at 09:46
  • 1
    Then probably just create them via a script, a cron or console. Then when create the configurable product use an observer or plugin to assign them to it. Also you will face a browser crash when loading the product page if it has 40,000 variations so I think not to load them from admin on the product edit page on that particular product. – Alaa Al-Maliki Jul 11 '19 at 09:55