Open
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
Gate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentMay be fixed according to the position in the backlog.The issue has been reproduced on latest 2.3 releaseAffects non-critical data or functionality and does not force users to employ a workaround.Issue related to Developer Experience and needs help with Triage to Confirm or Reject it