Description
Preconditions
Magento 2.4
Ubuntu 18.04
Steps to Reproduce
- Create any category on second level (with parent_id =2).
Name: Test category 1, Url key: test-category-1. - Create sub category in "Test category 2" with
level = 2
by res api:
/V1/categories
{
"category": {
"name": "Test category 2",
"parent_id":"3", /* Test category 1 */
"is_active":"true",
"include_in_menu": true,
"level":"2",
"custom_attributes": [{ "attribute_code": "url_key", "value": "test-category-2" }]
}
}
At now we have the url_key: "test-category-1" and path: "/test-category-1/test-category-2".
- Change the url key of the Test category 2 either in the backend or via the api to something like "test-category-2-changed"
Expected result:
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
url_path: "/test-category-1/test-category-2-changed"
Actual result:
Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
url_path: "test-category-2-changed"
Note
When I try to change a category url key, it changes the path to be identical which results in an error being raised and short category urls which don't include its parent, it has now affected categories that I haven't explicitly changed/saved.
(table catalog_category_entity_varchar
)
As you can see from the screen shot (with url_key, attribute_id 117 and url_path, attribute_id 118) the mens-footwear category has been affected but not the womens-footwear category.