-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Event: distributed-cdDistributed Contribution DayDistributed Contribution DayFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasebug report
Description
Certain permutations of product custom options are impossible to save. For example,
- First save a product with a custom option dropdown of two values with differing fields:

- Now try to save the second value to be identical to the first, like so:

- Notice that many of the values are not saved correctly. For me, this time around only the SKU was problematic, but you will have problems saving any number of these fields.
This is because
- the abstract resource model generates the
UPDATEquery based on differences between the new data array being saved and the preexisting$object->storedDataarray. code reference - the OptionValue model loops through
setDatacommands to save multiple OptionValue instances, hencestoredDataproperty refers to the previously saved Value instance, which is set during the previoussetData()->..->save() iteration. code reference
So, 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 the save. This will set the proper storedData property onto the model.
dmanners
Metadata
Metadata
Assignees
Labels
Event: distributed-cdDistributed Contribution DayDistributed Contribution DayFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasebug report