-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Component: ModelEvent: mm20inIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: 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 validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: dev in progressReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Affects non-critical data or functionality and does not force users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
Preconditions (*)
Magento 2.3.3 & 2.3-develop
Steps to reproduce (*)
Check values in the catalog_product_entity
table before
- Load a product (type_id 'bundle') in a custom module ($model->load($entityId);)
- change any value ($model->setAnyValue('test');)
- save the product (model->save();)
You can use this code:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productFactory = $objectManager->create('\Magento\Catalog\Model\ProductFactory');
$product = $productFactory->create();
$sku = 'testbundle';
$product->load($product->getIdBySku($sku));
$product->setSku('Test1234');
$product->save();
Expected result (*)
- the fields 'has_options' and 'required_options' should not changed because there are no modifications in custom options or bundle options.
Actual result (*)
- the fields 'has_options' and 'required_options' has changed to 0 (before save it was 1) because in module-catalog/Model/Product.php in function 'beforeSave' the values for 'has_options' and 'required_options' was set to false. But i think this values should only changed if 'canAffectOptions()' returns true. Else 'canAffectOptions()' would not make any sense. See comment (Set false, ONLY if options have been affected by Options tab and Type instance tab)
My solution is to comment out '$this->setHasOptions(false);' ans '$this->setRequiredOptions(false);' at the beginning of beforeSave because this values will be set to false later by condition '} elseif ($this->canAffectOptions()) {'.
Metadata
Metadata
Assignees
Labels
Component: ModelEvent: mm20inIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: 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 validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: dev in progressReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Affects non-critical data or functionality and does not force users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it