Skip to content

"Use Categories Path for Product URLs" not working for intermediate categories #12662

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

Closed
AymericJoubert opened this issue Dec 13, 2017 · 13 comments
Assignees
Labels
Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 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

Comments

@AymericJoubert
Copy link

AymericJoubert commented Dec 13, 2017

When using category path for product url, there is no generated url key for intermediate categories. In the url key table you can find one url rewrite for 1st level category and one for last level category.

This seems to work only on the last level category.

Preconditions

  1. Magento 2.1.10 with sample data
  2. PHP7

Steps to reproduce

  1. Enable product url by categories in Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Use Categories Path for Product URLs
  2. On the frontend, click on Women > Tops in the main menu

Expected result

  1. For the product "Selene Yoga Hoodle", the url_key is "women/tops-women/selene-yoga-hoodle.html"

Actual result

  1. The url_key is "catalog/product/view/id/1113/s/selene-yoga-hoodie/category/21/"
@magento-engcom-team magento-engcom-team added 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 labels Dec 13, 2017
@orlangur
Copy link
Contributor

Is this issue relevant for 2.2.x by the way?

@AymericJoubert
Copy link
Author

Same issue on magento 2.2.2-dev fresh install.

@magento-engcom-team
Copy link
Contributor

@AymericJoubert, thank you for your report.
We've created internal ticket(s) MAGETWO-85642 to track progress on the issue.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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 labels Dec 14, 2017
@orlangur
Copy link
Contributor

#mageconf

@magento-engcom-team
Copy link
Contributor

@orlangur thank you for joining. Please accept team invitation here and self-assign the issue.

@sanchezcodes
Copy link

Hey guys any update on this issue? or some way to get around?

@AymericJoubert
Copy link
Author

Up :)
This is really annoying in prod environments...
Any update ?

@ghost
Copy link

ghost commented Feb 7, 2018

Best, is there a solution we have the same issue in prod our prod environment....
This magento 2 is out now for too long to have issues like this. Even extension developers are walking behind the versions. Almost all extensions there are are outdated and we run from one to the second issue and so on. It is a shame magento is still fully in beta even with version 2.2.2 Hoping for a quick solution. Solutions like this take ages even if there are 20 posts from the same issue. We can not wait for the next version change with this. Content is depending on these clean URL's. Again a quick solution would be nice.

@orlangur
Copy link
Contributor

Why anyone need to switch "Use Categories Path for Product URLs" on prod?

some way to get around?

@lasg125 the problem here is that URL rewrites cannot be recreated from nowhere. Unlike the switch of suffix (like .html), changing this option requires removal/creation of additional URL rewrites.

As a workaround you can re-save all products programmatically. As a permanent solution most likely some kind of similar asynchronous operation is needed, it is not possible immediately after you change setting via Admin UI in case of a big catalog.

@ghost
Copy link

ghost commented Feb 13, 2018

@lasg125

We tried a lot of solutions (after a back-up of the database) but nothing seems to work on magento 2.2.2

Our last solution was this one : https://github.com/olegkoval/magento2-regenerate_url_rewrites

For now it seems to work and we hope it will stay like this.

Hope it helps, many thanks to Oleg Koval (which provides this for free.)

@leegold
Copy link

leegold commented Nov 1, 2018

For me I couldn't replicate the issue above on 2.2.6, but I landed here by replicating (and then treating) the symptoms described.

The setting "Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Use Categories Path for Product URLs" only generates aliases for Categories of which the product is directly assigned to, and will not generate aliases for products that are only members of categories via the Category setting "Is Anchor".

For example, the category tree below:

-> Appliances
--> Kitchen
---> Toasters

You might set "Appliances" and "Kitchen" to both be Anchor Categories, and only assign the product to the Toasters category, and let "Is Anchor" automatically define your Toasters are also within both "Kitchen" and "Appliances".

For me this resulted in my Product URLs not getting Category Paths for the categories "Appliances" and "Kitchen", but getting Category Paths for the Product URLs auto-aliased for the "Toasters" path.

Hope someone finds this useful.

@ghost ghost unassigned orlangur Sep 27, 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.
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.


@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
Copy link
Contributor

Hello All

I am not able to reproduce this issue on the 2.4-develop branch by provided steps.

Testing scenario:

Preconditions
Magento 2.4 with sample data

Steps to reproduce:

  1. Enable product url by categories in Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Use Categories Path for Product URLs
  2. On the frontend, click on Women > Tops in the main menu

Result
For the product "Selene Yoga Hoodle", the url_key is "women/tops-women/selene-yoga-hoodle.html"
Screenshot_51
Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines
if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 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
Projects
None yet
Development

No branches or pull requests

7 participants