Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AaronKaa opened this issue Mar 13, 2018 · 14 comments · Fixed by #27304
Closed

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

AaronKaa opened this issue Mar 13, 2018 · 14 comments · Fixed by #27304
Assignees
Labels
Component: Url Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@AaronKaa
Copy link

AaronKaa commented Mar 13, 2018

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.

@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Mar 13, 2018
@AaronKaa
Copy link
Author

This looks like it could be related to issue #7298

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Mar 14, 2018

Hi @AaronKaa. Thank you for report.
We can not reproduce the issue.
Can you confirm that the issue is reproducing on clean magento installation?
Thanks

@AaronKaa
Copy link
Author

I cant confirm that - the store itself has been updated from magento 2.1.5 and the data was imported via rest api (I should have mentioned that in the initial post), at this point were almost ready to go live with a new store.

@AaronKaa
Copy link
Author

We've found that editing the category using the api doesn't have this effect so we're going to do it that way for now.

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Mar 14, 2018

@AaronKaa please more describe steps to reproduce the issue

@AaronKaa
Copy link
Author

We imported all of the categories and products via the REST API on version 2.1.5
Upgraded to 2.2.2
Tried to edit a category via both the web interface and the REST API and both produce the same results
Making a new category via the web interface and editing it doesn't have the same effect

@Lycanite
Copy link

Lycanite commented Mar 15, 2018

I'm working with AaronKaa on this project. I think it's related to products added via the REST API.
For example, if you add a category with a parent category like this:
{ "category": { "name": "Test", "is_active": true, "include_in_menu": true, "level": LEVEL, "position": 0, "parent_id": PARENT_ID, "custom_attributes": [{ "attribute_code": "url_key", "value": "test" }] } }

The url is at first correct, so say the parent category was called "Example" with the url key "example" we'd get: "/example/test".

But if we then try to change the url key of the test category either in the backend or via the api to something like "test-changed" we'd expect the new url path to be "/example/test-changed" but instead it becomes just "/test". So it looks like the url path is being set as the url key. This is happening with deeper categories as well.

Categories that were created manually in the backend and not with the api do not produce this result and work correctly however.

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Mar 15, 2018

Hi @AaronKaa and @Lycanite
We were able to reproduce this issue by following steps:

  1. Create any category on second level (with parent_id =2).
    Name: Test category 1, Url key: test-category-1.
  2. Crete sub category in "Test category 2" with level = 2 by res api:
{
	"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"
path: "/test-category-1/test-category-2-changed"

Actual result:

Category "Test category 2" has attribute values:
url_key: "test-category-2-changed"
path: "test-category-2-changed"

@magento-engcom-team magento-engcom-team added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Mar 15, 2018
@magento-engcom-team
Copy link
Contributor

@AaronKaa, thank you for your report.
We've acknowledged the issue and added to our backlog.

@AaronKaa
Copy link
Author

Looking at this further Ive found that the issue is the category level - manually re-setting the level to its correct value in the database and regenerating the urls fixed the issue

@engcom-Echo engcom-Echo removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Dec 30, 2019
@engcom-Echo engcom-Echo self-assigned this Dec 30, 2019
@m2-assistant
Copy link

m2-assistant bot commented Dec 30, 2019

Hi @engcom-Echo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Echo engcom-Echo added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Component: Url Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Dec 30, 2019
@ghost ghost unassigned engcom-Echo Dec 30, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Echo
Thank you for verifying the issue. Based on the provided information internal tickets MC-30130 were created

Issue Available: @engcom-Echo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@sergiy-v sergiy-v self-assigned this Mar 16, 2020
@m2-assistant
Copy link

m2-assistant bot commented Mar 16, 2020

Hi @sergiy-v. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@sergiy-v sergiy-v linked a pull request Mar 16, 2020 that will close this issue
4 tasks
magento-engcom-team added a commit that referenced this issue Mar 21, 2020
…op expedited

Accepted Community Pull Requests:
 - #27298: Implement ActionInterface for `cms/page/view` (by @lbajsarowicz)
 - #27116: Add Italy States (by @WaPoNe)
 - #26748: #26745 add method setAdditionalInformation to OrderPaymentInte… (by @antoninobonumore)
 - #27336: fixed My account Address Book Additional Address Entries table issue #27335 (by @abrarpathan19)
 - #27263: #26708 Fix: ORDER BY has two similar conditions in the SQL query (by @vasilii-b)
 - #27304: FIX #14080 Added improvements to Category repository (save method) (by @sergiy-v)
 - #27214: Mark AbstractAccount as DEPRECATED for Magento_Customer controllers (by @lbajsarowicz)
 - #27292: Magento_Bundle / Remove `cache:flush` and extract Tests to separate files (by @lbajsarowicz)


Fixed GitHub Issues:
 - #26708: ORDER BY has two similar conditions (reported by @Usik2203) has been fixed in #27263 by @vasilii-b in 2.4-develop branch
   Related commits:
     1. 1e1ebd3
     2. df35dda
     3. b816334
     4. a61d92a
@magento-engcom-team
Copy link
Contributor

Hi @AaronKaa. Thank you for your report.
The issue has been fixed in #27304 by @sergiy-v in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Url Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants