-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: 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 developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
Preconditions (*)
- I tried on magento 2.3.1.
- Fresh and developer instances.
Steps to reproduce (*)
- The problem is that you cannot update the order of a group in an attribute set by repository. It does not have support for it.
Basically, I am trying to update the groups of some attribute set via rest api.
The code asks for a specific format
{ "group": { "attribute_group_id": "string", "attribute_group_name": "string", "attribute_set_id": 0, "extension_attributes": { "attribute_group_code": "string", "sort_order": "string" } } }
But it does not work. When I debugged what was being received by the site, it returned:
(vendor/magento/module-eav/Model/Attribute/GroupRepository.php::save())
2019-07-09T09:06:01+00:00 INFO (6): Array
( [attribute_group_name] => Product Details [attribute_group_id] => 336 [attribute_set_id] => 39 )
While my posted data was:
2019-07-09T08:46:02+00:00 INFO (6): Array
( [group] => Array ( [attribute_group_name] => Product Details [extension_attributes] => Array ( [sort_order] => 1 [attribute_group_code] => product-details ) [attribute_group_id] => 336 [attribute_set_id] => 39 ) )
After the repository saves the group (calls resource->save()), it returns:
2019-07-09T09:06:01+00:00 INFO (6): Array ( [attribute_group_name] => Product Details [attribute_group_id] => 336 [attribute_set_id] => 39 [attribute_group_code] => product-details [sort_order] => 83 )
Which is normal, because in the group model, in beforeSave, there is
(vendor/magento/module-eav/Model/ResourceModel/Entity/Attribute/Group.php::_beforeSave())
if (!$object->getSortOrder()) { $object->setSortOrder($this->_getMaxSortOrder($object) + 1); }
Expected result (*)
- To be able to set the order of some attribute groups
Actual result (*)
- Saving an attribute group by its repository auto-increments its old order.
Metadata
Metadata
Assignees
Labels
Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: 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 developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release