magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Category URL Path issue in multi-store #38627

Open Nuranto opened 6 months ago

Nuranto commented 6 months ago

Preconditions and environment

Steps to reproduce

  1. Create 2 stores ( default = 1, other_store = 2), same category root assigned.
  2. Create this category tree :
    • Cat A (url key = a in default view. url key = other_a in store 2)
      • Cat AB (url key = b in default view)
  3. Check catalog_category_entity_varchar table where attribute_id = (ID of url_path) and category_id = (ID of cat AB). You should see : a/b for store 0 and other-a/b for store 2.
  4. Check frontend canonical url for store2 - AB category page. You should see https://.../other-a/b
  5. Change url_key for cat AB, in default view, for b2
  6. Check again catalog_category_entity_varchar table where attribute_id in (ID of url_path) and category_id = (ID of cat AB).
  7. Check again canonical url for store2 AB category page.

Expected result

Actual result

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 6 months ago

Hi @Nuranto. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 6 months ago

Hi @engcom-Bravo. 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: :point_down:

m2-assistant[bot] commented 6 months ago

Hi @engcom-Dash. 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: :point_down:


engcom-Dash commented 6 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 6 months ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 6 months ago

Hi @engcom-Dash, here is your Magento Instance: https://b2c4c630e425172c56bb24d1a3bcaca5.instances-prod.magento-community.engineering Admin access: https://b2c4c630e425172c56bb24d1a3bcaca5.instances-prod.magento-community.engineering/admin_e95b Login: b0cf1897 Password: bd03976aface

engcom-Dash commented 6 months ago

Hi @Nuranto

Thanks for reporting and collaboration.

Verified the issue on magento 2.4 dev instance but the issue is not reproduceable.

Steps to reproduce

  1. Create 2 stores ( default = 1, other_store = 2), same category root assigned.
  2. Create this category tree : Cat A (url key = a in default view. url key = other_a in store 2) and Cat AB (url key = b in default view)
  3. Check catalog_category_entity_varchar table where attribute_id = (ID of url_path) and category_id = (ID of cat AB). You should see : a/b for store 0 and other-a/b for store 2.
  4. Check frontend canonical url for store2 - AB category page. You should see https://.../other-a/b
  5. Change url_key for cat AB, in default view, for b2
  6. Check again catalog_category_entity_varchar table where attribute_id in (ID of url_path) and category_id = (ID of cat AB).
  7. Check again canonical url for store2 AB category page.

We are seeing the below results :

a/b2 for store 0 and other-a/b2 for store 2. Url of category = https://.../other-a/b2, Canonical : https://.../other-a/b2

Please refer the screenshots attached. Let us know if we have missed anything.

38627_store0 38627_store2
Nuranto commented 6 months ago

I did more test, on several projects I'm working on. Also tried with all third-extensions disabled. I can reproduce the issue in all cases. I tried to change some configuration, but cannot manage to find the missing step to reproduce :/

Capture d’écran 2024-04-22 à 14 47 49

I also checked the code, i don't saw anywhere the code that updates the url_path on all stores. There's src/vendor/magento/module-catalog-url-rewrite/Model/Category/Plugin/Category/UpdateUrlPath.php but it only deals with new categories (if ($category->isObjectNew()) and src/vendor/magento/module-catalog-url-rewrite/Observer/CategoryUrlPathAutogeneratorObserver.php but it only deals with children.

I guess I'm missing something...

m2-assistant[bot] commented 6 months ago

Hi @engcom-Delta. 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: :point_down:

engcom-Delta commented 6 months ago

Hi @Nuranto,

Verified the issue on 2.4-develop and it is reproducible.

Hence, Confirming the issue.

Steps to reproduce:-

1.Create 2 stores ( default = 1, other_store = 1), same category root assigned. 2.Create this category tree : 3.Cat A (url key = a in default view. url key = other-a in store 1) Cat AB (url key = b in default view) 4.Check catalog_category_entity_varchar table where attribute_id = (ID of url_path) and category_id = (ID of cat AB). You should see : a/b for store 0 and other-a/b for store 2. 5.Check frontend canonical url for store2 - AB category page. You should see https://.../other-a/b 6.Change url_key for cat AB, in default view, for b2 7.Check again catalog_category_entity_varchar table where attribute_id in (ID of url_path) and category_id = (ID of cat AB). 8.Check again canonical url for store2 AB category page.

Please refer the attached screenshot.

Created one store other than default store

Screenshot 2024-04-25 at 10 58 24 PM

Same category assigned

Screenshot 2024-04-25 at 11 00 36 PM

Category A created and given url key = a in default view

Screenshot 2024-04-25 at 4 06 35 PM

url key = other-a in store 1 view

Screenshot 2024-04-25 at 4 09 41 PM

Category AB created and given url key = b in default view

Screenshot 2024-04-25 at 9 12 47 PM

Check catalog_category_entity_varchar table , a/b for store 0 and other-a/b for store 1.

Screenshot 2024-04-25 at 4 10 55 PM

frontend canonical url for store2 - AB category page. You should see https://.../other-a/b

Screenshot 2024-04-25 at 9 44 56 PM

Change url_key for cat AB, in default view, for b2

Screenshot 2024-04-25 at 9 46 11 PM

Check catalog_category_entity_varchar table

Screenshot 2024-04-25 at 3 59 41 PM

frontend canonical url for store2 - AB category page

Screenshot 2024-04-25 at 10 55 32 PM
github-jira-sync-bot commented 6 months ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 6 months ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 6 months ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 6 months ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 6 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11859 is successfully created for this GitHub issue.

m2-assistant[bot] commented 6 months ago

:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

github-jira-sync-bot commented 6 months ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-11859

github-jira-sync-bot commented 6 months ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-11859

github-jira-sync-bot commented 6 months ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-11859

digitalrisedorset commented 6 months ago

@magento I am working on this

engcom-Bravo commented 4 months ago

Hello,

Internal team has started to work on it

Thanks