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.49k stars 9.29k forks source link

Category Rewrites are generating even if config is disabled #39070

Open sheepfy opened 1 month ago

sheepfy commented 1 month ago

Preconditions and environment

The old version had this if statements: if ($this->isCategoryRewritesEnabled()) {

https://github.com/magento/magento2/blob/2.4.6-p1/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php

Checking now the 2.4.7-p1 version, seems that the generation logic was moved into a separate method: private function generateCategoryUrls(int $storeId, Product $product, ObjectRegistry $categories): array

But the IF statement was forgot to be added. (Also if checking the other category generation method "generateCategoryUrlsInStoreGroup", that one contains the IF statement)

https://github.com/magento/magento2/blob/2.4.7-p1/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php

Steps to reproduce

Set the admin config: catalog/seo/generate_category_product_rewrites to 0 (it should be by default set to 0) Save a product/create a product and then check the url rewrites

Note that in order to trigger the url generation, you need to have data changes on the product. For example, do change visibility from Catalog, Search to Catalog to trigger it

Expected result

Have only product rewrite

Actual result

Have category rewrites + product rewrite image

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @sheepfy. 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 1 month 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:

engcom-Bravo commented 1 month ago

Hi @sheepfy,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Screenshot 2024-08-21 at 16 21 20 Screenshot 2024-08-21 at 16 22 19

Having category rewrites + product rewrite

Hence Confirming the issue.

Thanks.

github-jira-sync-bot commented 1 month ago

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

m2-assistant[bot] commented 1 month ago

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

rogerdz commented 1 month ago

same https://github.com/magento/magento2/issues/38317