Magento 2.1.1
Add lots of custom options to a simple product
Save product
Save product again (even without touching anything)
Product must be saved without error messages.
Error message appears: "Invalid option value".
The error message is extremely unhelpful.
Hi @woakley
We cannot reproduce this issue as described. Please provide the detailed steps(custom options type and value) we must follow to reproduce this issue.
I am getting this exact same error. I add a configurable product,
Add in multiple colors (around 30 colors) Click save. Everything is fine.
If i go back into the product and try to either upload an image or not even change anything, I get invalid option when saving. This is extremely painful, and the only way I can add products is by adding them in once, and not modifying them in the future because I am unable to save them.
I'm using CE 2.1.1
Also importing custom options from another product does not seem to work at all.
I have 40 colors of products and I have to manually type them one by one because the import options isn't working.
This is actually so bad, I can't add in any products because of this error. I cant duplicate products, import options or anything. It is extremely difficult adding in 40 colors manually for 500 products.
_Update_
After removing everything, reinstalling from the github source this bug appear gone. Which leads me to believe this bug only exists in the packages downloaded from the website, not the github repository. Maybe I am wrong but reinstalling from github source vs the package on the website, it appears to be gone. I will do more testing, and post more information today.
_Update_
After adding in two products, one with 72 colors and 3 sizes. I went back to try to modify the price of one of the sizes and receive this error again. Now I am unable to change any more product.
This is a fresh installation, the only thing I have done is import the tax rates, and add 2 products.
I am unable to modify anything in existing products now because this error occurs.
I am 100% this is a bug. I have no issues modifying the products the first few times until now. Now I am unable to change anything.
if (!$this->validateOptionValue($value)) {
$messages['option values'] = 'Invalid option value.';
}
in app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php
I'm not very familiar with this code, Why is it doing this? What is the invalid option that is being thrown? I am trying to change an added option of "Size", Large from 5 to 10 and it throws an error.
With the values
Medium -> 5
Large -> 5 <-This should be 10.
Wish I had more time to debug this error...
OK, this is strongly relate to issue #6711
It is the pagination of custom options that stops the product from saving.
Steps to reproduce
Add more than 20 custom options to a product option so pagination occurs
Save product
Reload product
Save product again (even without touching anything)
Expected result
Product must be saved without error messages.
Actual result
Error message appears: "Invalid option value".
Note that you can get the product to save successfully if and only if you go through all pages of custom options.
If you have additional page(s) of options which you do not view, Magento assumes that all the values are blank and will therefore refuse to save the product.
Every save on a Bundleproduct will update all Option_Ids + Option_Values.
In the Front-End all values from select/option-fields will change.
This is critical if you use the REST API intensively. Every previous fetched Bundle/Option-Combination will get invalid.
@miakusha: we only got select-fields.
Some Options in this Bundle got >30 possible select-values/ virtual products.
I am having this same issue and am not able to make any progress on my site. Any update as to when it will be fixed? Is there a workaround? I am currently on version 2.1.1
The only workaround is to go through all 'pages' of custom options each time you want to update the product. This is extremely inconvenient.
Update?
Hi @woakley
We have created MAGETWO-62197 for internal tracking.
Please correct this bug, please please...
I have this bug too. Version 2.1.5.
Hi, we are experiencing this issue also, very frustrating when you have a product with lots of custom options.
Any update on this? Solutions or quick fix is to go through every page from every custom option. Than you can save the product without errors.
@PieterCappelle I dont understand your quick fix.
We to are having trouble with this.
@andrewgolrang When you have a product with more than 20 values for a custom options Magento adds pagination to this option. See screenshot attached. Below right, pagination. If you want to save this product you have to go through every page of every custom option of that product.
Technical explantion, Magento is using dynamic rows to load this behaviour, if you don't open the second, or third page, the input fields are not added to the HTML. When you save the product those options aren't in the POST values. In the POST Magento is checking if the values are equal but they aren't, because they are not added to the HTML. So the quick fix for now is to go through every page of every custom option and then you can save the product.
Sorry for bad english :-)
@PieterCappelle
Thank you. This worked.
But it doesn't work when I want to remove a value under customizable
options. Then it says "Invalid option" again. And I tried to remove those
that I wanted and then open up all of the pages but it still didn't work.
Is there any way to solve that?
Very frustrating situation: problem persists éven with version 2.1.6 :(
Another temporary solution is to override the page size for the dynamic rows UI component. Create a module that overrides /vendor/magento/module-ui/view/base/web/js/dynamic-rows/dynamic-rows.js
and set pageSize
on line 20 to a higher value.
@johnegraham2
God bless you!!
It's custom option pagination issue in magento 2.1.x, so if you go to till last page of custom option pagination then product will be saved.
As per @johnegraham2 - increase pagination size, great :)
@saurabhsharma1383 It's not a decision when you have 1000 values per option. Increasing pagination size will lead to product page load time issue.
@veloraven Do you have any updates?
We are having the same issue. We are able to save the options by paging through, but we discovered that as time goes on, the options on secondary pages get jumbled out of order. We want our site to look polished, so this is unacceptable.
Can I get details on how to override the page size?
I am not a .js programmer, but I was looking at the file mentioned above: /vendor/magento/module-ui/view/base/web/js/dynamic-rows/dynamic-rows.js to maybe change the pageSize...
Dreamweaver ID'd a syntax error near the end on line 727 "this.recordData(utils.copy(this.default));" It is in the Restore value to default section.
There is no "this.default" defined anywhere above this line, but there is "this.defaultRecord." Could this be the issue? The same call for "this.default" occurs again on line 741.
Can someone knowledgeable in .js check on this?
Hello Magento programmers?
As it's a short-term workaround to modify the page size with magento hopefully resolving the issue in an upcoming release in the near future you can just do the quick and dirty (preferably with source control) and modify the value directly in the /vendor/magento/module-ui/view/base/web/js/dynamic-rows/dynamic-rows.js file. Just search in the file for "pageSize: 20" or go to line 71 and change it to some value that will work better for you. Obviously being a js file don't forget to do all the other things you need to do to make sure it comes through to the frontend. If you have bundling and minification turned off just check in incognito. Worked fine for me.
This is frutrating. I was not having any problems until 2 weeks ago. I am having the same issue as described above. When I try to save a new product sometimes it saves and sometimes it doesn't, WE NEED A FIX!
still happening with 2.1.7 haha
The problem still persists in 2.1.8, unfortunately.
Shuffling through all pages of custom options - for each custom option - does solve the problem, but is both inconvenient and unintuitive for those not aware of the issue.
@woakley, thank you for your report.
The issue is already fixed in 2.2.0
Hi, is it possible to tell me in which commit this has been fixed? Has this been backported to 2.1 branch? If I you can give me the commit I will backport to 2.1 branch. Thanks!
Also what is annoying about pagination is that you can only organize options in any kind of order ONLY on the page they are on - you can't drag an option back or forward through pages. That means if I have products that I want to list alphabetically and end up inserting a new options 2 months later that needs to be in the "A"s, I can't add a new option in the A page because a new option adds to the END of the last page. This leaves me with having to manually rename ALL the options by 1-2 fields, which is extremely annoying.
My suggestion is to allow pagination for those who don't want long load times, but allow people to adjust the number of items on each page, so that every month or so when one needs to shuffle things around they can select "show 200 items" so that one can drag\drop all the way up the list if necessary.
The issue happened again when the simple product was "save&duplicate" in MCE2.2
Same issue, any update solutions for this?
Still exists for the MCE 2.2.1
Still exists for the MCE 2.2.3
I have the same issue in magneto 2.1.7 , I have fixed this issue using code modification in file vendor/magento/module-catalog/Model/Product/Option/Validator/Select.php
With following code on line no 74:
protected function isValidOptionPrice($priceType, $price, $storeId)
{
// we should be able to remove website values for default store fallback
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $priceType === null && $price === null) {
return true;
}
if (!$priceType && !$price) {
return true;
}
if (!$this->isInRange($priceType, $this->priceTypes) || $this->isNegative($price)) {
return false;
}
return true;
}
Was fixed and is now back on 2.2.3 and 2.2.4
I have the same issue on 2.2.3 even with less than 20 options. For instance, one product has only 11 options and they are all able to be shown on the same page ("1 of 1") and still Magento does not allow the product to be saved!
Please help
@sumitvgupta the fix you had mentioned in for 2.1.7 is the code being used in 2.2.3 and the error still persists. Please update.
Thank you
Still error issue exists in Magento2.2.3
@Sharmilasrini95 @ywsw
Can you please give me the credential so can check that if you don't mind or You can give the Video.
I had checked it in my local in with 2.2.4 and 2.2.3 it's working fine.
Thank you.
This Issue still occurring in 2.1.13 also.
@sumitvgupta your code fixed the issue for me in 2.1.13.
Having the same issue in 2.2.3 with less than 20 options (no pagination) need to click save and then save again to save a product.
Hey. @ibecmattb,
Can you please upload the video for that issue.
So I can see the exect issue. Because I have checked as per your comment and it's working fine.
Here is screen recording:
Looks like you need to open the custom options tab and then re-save.
This is still happening in 2.2.6
The same problem in 2.1.5.
I tried the solution provided by @sumitvgupta (Thanks, BTW) to no avail.
I'am f**d because due to a required extension I cannot upgrade Magento.
Ideas? Please, @sumitvgupta?
In my case the problem was a 0 in Option, then I write Size 0 and then all work fine
Any updates on this? I have the same issue in 2.3.0, none of the workarounds/code fixes work.
Error when save product "Invalid option type" Still exists for the MCE 2.3.5 .please help me fix this error.
Most helpful comment
Still exists for the MCE 2.2.3