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.56k stars 9.32k forks source link

Root Category Unaccessible via Frontend #36684

Open Stoyvo opened 1 year ago

Stoyvo commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. Navigate to Admin -> Catalog -> Categories
  2. Select the Root category
  3. Observe the SEO settings and URL Key
  4. Attempt to navigate to this URL Key via frontend

Expected result

A root category has a URL Key option in admin, root category should be visible on frontend.

Actual result

404 page

Additional information

Work-Around: Create a subcategory under Root Category, and store all categories under the 1st level subcategory.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @Stoyvo. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 1 year 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 year ago

Hi @Stoyvo,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.

As per magento devdocs we cannot access Root Category.

Screenshot 2022-12-30 at 1 06 50 PM

Kindly go through with doc https://experienceleague.adobe.com/docs/commerce-admin/catalog/categories/category-root.html. Kindly let us know if you are still facing any issue.

Thanks

Stoyvo commented 1 year ago

Hi @Stoyvo,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.

You confirmed there is an issue or there is not an issue?

As per magento devdocs we cannot access Root Category.

Screenshot 2022-12-30 at 1 06 50 PM

This is why I have a bug report. The admin panel has SEO panel and URL Key configurations for root categories that do not work.

Which is the bug? 1) Frontend not working with Root Category URL (configurable via admin) 2) Admin displaying category options for Root Category when they should not be accessible. (Why show SEO configurations if it isn't used anywhere....?)

engcom-Bravo commented 1 year ago

Hi @Stoyvo,

Thanks for your update.

This is not a bug it is expected behaviour of Magento.

As per the Magento devdocs Root category(Default category) does not appear on navigation of the store that's why we are not able to access Root category(Default Category).

If we remove SEO section for Root Category(default category) it will effect when we creating subcategories.

As you mentioned if we create sub category for Particular Root category which is not default category we can access that category via Frontend.

Thanks.

Stoyvo commented 1 year ago

So... Why is there admin configuration for this when there's no functionality associated? It doesnt make sense that Admin options exist and they do nothing.

engcom-Bravo commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

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

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo, here is your Magento Instance: https://22f1265e5087d7f910c7bc18f9c4654c.instances.magento-community.engineering Admin access: https://22f1265e5087d7f910c7bc18f9c4654c.instances.magento-community.engineering/admin_2462 Login: 3b26d1cd Password: b325ec5e679b

engcom-Bravo commented 1 year ago

Hi @Stoyvo,

Thanks for your update.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible.

Steps to reproduce

1.Navigate to Admin -> Catalog -> Categories 2.Select the Root category 3.Observe the SEO settings and URL Key 4.Attempt to navigate to this URL Key via frontend

Since we have SEO configuration in root category(default category) in admin we are not able to access via frontend.

It is working fine for when we create subcategories.

Hence confirming this issue.

Thanks.

github-jira-sync-bot commented 1 year ago

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

m2-assistant[bot] commented 1 year 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.

hostep commented 1 year ago

This issue is not valid in my opinion.

Magento was designed in such a way that root categories can not be displayed on the frontend. As to why a url key field is present in root categories in the backoffice: it's probably because then they don't need to add extra code and logic just to hide it and make it not required for root categories which would make the code a lot more complex. My advise: just ignore the url key field and all the other fields that are related to displaying in the frontend for root categories.

If there really is a bug here, it's in the documentation itself, where they shouldn't say:

The root has a name, but no URL key, and does not appear in the top navigation of the store.

But should say:

The root has a name. And although it has a URL key, it's not being used in the frontend, and the root category does not appear in the top navigation of the store.

But that should be reported over here: https://github.com/AdobeDocs/commerce-admin.en/issues

FY0u11 commented 1 year ago

But why the root category is not accessible via frontend? Let's say I have a product attribute ('color' for example) and I have a list of all colors on the homepage under the title 'Shop by Colors'. And when I'm clicking on the specific color from the list I want to be redirected on a default category with this particular color selected as a filter. I don't want to be redirected on some specific category, because 'color' is a product attribute that is 'above' all the categories.

brandontamm commented 4 months ago

@hostep - What would be the harm in Magento was designed in such a way that root categories can be displayed on the frontend?

If no harm, then why on earth would this decision be made? Shop all is an actual configuration: catalog_settings

which makes zero sense if it can't be used on the primary / root category to allow users top-level access to just filter for their results.

That's the point of filtering, isn't it?

hostep commented 4 months ago

Just use the workaround specified in the opening post if you want to be able to display all products on a single page.

Also, the "Allow all products per page" setting applies to the pager component of product listings on the frontend, to add an option for the users to pick "all" in the dropdown of the amount of products to show on a single page. This is not really related to this issue here.