-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom option values do not save correctly #5067
Comments
Hello @samtay , could you please advise me if you have any errors upon saving the product with identical values in custom option? What Magento version are you using? Thanks, |
No, see the above code references, this fails silently. Occurs on latest version. |
@samtay thanks for the details, I've created internal ticket MAGETWO-54516 to investigate this issue. Best, |
Can anyone from magento tell when this bug will be fixed? Really guys, you have had 1+ year to fix it but this bug still exists in your recent 2.2 release. Here is hotfix - just modify Magento\Catalog\Model\Product\Option\Value::saveValues method:
|
@samtay, thank you for your report. |
Here is a module with clone based workaround mentioned in my previous comment: |
Hi @samtay. Thank you for your report.
The fix will be available with the upcoming 2.2.6 release. |
Hi @samtay. Thank you for your report. The fix will be available with the upcoming 2.3.0 release. |
[TSG] Fixes for 2.3 (pr87) (2.3.4-develop)
Certain permutations of product custom options are impossible to save. For example,
This is because
UPDATE
query based on differences between the new data array being saved and the preexisting$object->storedData
array. code referencesetData
commands to save multiple OptionValue instances, hencestoredData
property refers to the previously saved Value instance, which is set during the previoussetData()->..->save() iteration
. code referenceSo, those two reasons result in any identical OptionValue fields not able to be saved consecutively, causing the bug shown in steps 1-3.
I think it is rather odd/lazy that the option value model does not have its own resource model.. it seems like a poor idea to just loop through
$this->setData()->save()
calls. But, if you want to fix this quickly, just issue a$this->load($this->getOptionTypeId())
before thesave
. This will set the properstoredData
property onto the model.The text was updated successfully, but these errors were encountered: