-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Forward Port PR-14344] Fix generating product URL rewrites for anchor categories #26784
[Forward Port PR-14344] Fix generating product URL rewrites for anchor categories #26784
Conversation
(cherry picked from commit 63111ed)
Hi @hostep. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
…l on the category repository. This is not testing for the bugfix but makes sure that when not passing the storeId param in the tested code, the test starts complaining.
Hi @hostep. It would be awesome to have this fix finally merged. But considering the number of talks/attempts, it will be fair to cover this fix using a functional test. Could I kindly ask you to do that? Thank you! |
I agree @rogyar! Due to me not having much time free and having very little experience with writing tests, somebody else may pick this up if they want. |
Thanks for the test @engcom-Echo! But I'm confused, since it doesn't seem to be testing the generated url rewrites of products belonging to categories of at least 2 levels deep. Also: why is the parent_id, path & level of those categories with ids 3 & 4 different on a different storeview, that seems like a mistake? |
… forward-port-pr-14344
Hi @hostep. Thanks for your comment. The test checks this code if we use the parameters of $storeId.
These fixtures are a little scary but in my opinion, we should check the code for different use $storeId - that's exactly what I saw an important change. |
Ok thanks for the feedback! In my opinion, we should also test if the generated url_rewrites are correct, as that's the purpose of this PR, see #11615 for what the correct values should be in this case. Could we add a test for that as well? Thanks! |
I will take care of functional test coverage. |
Thanks for the MFTF test @engcom-Echo! I think I understand how it works. But just to be clear: this test is failing on the code as it was before this fix, right? And shouldn't we also test the <amOnPage url="{{category.url_key_custom_store}}/{{subCategory.url_key_custom_store}}/{{product.urlKey}}2.html" stepKey="goToProductPage"/>
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="seeProductNameInStoreFront"/> (I'm not sure how the url is build when you should be on a different store in MFTF though) Thanks! |
e5d909c
to
560d464
Compare
@magento run all tests |
*/ | ||
--> | ||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="StorefrontAssertProductRewriteUrlSubCategoryActionGroup"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @engcom-Echo. Could I ask you to rename the action group in order to follow the general naming rules, please? So we have
AssertStorefrontProductRewriteUrlSubCategoryActionGroup
in the result.
Please, check the technical guidelines (part 11.3.5).
Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" extends="ChangeSeoUrlKeyForSubCategoryActionGroup"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use the area prefix (Admin|Storefront) for this action group. If we have all action groups prefixed correctly, it's much easier to find and reuse an action group in the future.
Thank you!
Hi @rogyar, thank you for the review. |
*/ | ||
public function testGenerate(): void | ||
public function testGenerate(string $expect): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what input should the result change?
I see expectation attribute, but there's not context attribute.
@magento run Functional Tests EE |
…tes for anchor categories #26784
Hi @hostep, thank you for your contribution! |
@hostep seems like at least a part of this PR is present in 2.3.6; https://github.com/magento/magento2/blob/2.3.6/app/code/Magento/CatalogUrlRewrite/Model/Product/AnchorUrlRewriteGenerator.php#L70 Edit; guess that's the only actual application code part that is involved. The rest of the files in this PR are test-related. |
Ah nice find @peterjaap ! It was added in MC-32810: [Magento Cloud] - Incorrect URL Rewrites for non-default websites after upgrade to 2.3.4 (what a silly description, this has been a bug for many years) However, it seems to consist of two changes and only one of them is done in 2.4-develop not the other. Fix one: 2.3.6 vs 2.4-develop => missing in 2.4 So this is again a weird thing and maybe somebody forgot to do something here. @slavvka, @chernenm, @sdzhepa: can we figure this out please? Was that first change in |
(cherry picked from commit 63111ed)
Description (*)
This is a forward port of #14344 to 2.4-develop
This replaces #20826 which is stuck because the author is no longer responding for a few months.
Previous attempts at fixing this issue were done in #7667 & #22212
FOR THE MAINTAINERS: if this gets approved, can you please please please backport this to Magento 2.3, because the change is already in Magento 2.2, and by this PR also in 2.4, so it should also be part of 2.3, so we have consistent behavior over all these major Magento versions.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)