Skip to content

Category path is the same as key producing duplicate URL issue #14080

Closed
@AaronKaa

Description

@AaronKaa

Preconditions

Magento 2.4
Ubuntu 18.04

Steps to Reproduce

  1. Create any category on second level (with parent_id =2).
    Name: Test category 1, Url key: test-category-1.
  2. 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".

  1. 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)

screen shot 2018-03-13 at 12 35 48

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.

Metadata

Metadata

Assignees

Labels

Component: UrlFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions