0

How do I add category to breadcrumbs on products page so it says Home -> Category -> Lenovo Thinkpad

From the Admin panel I've set

Use Categories Path for Product URLs -> YES

But it only affected my url path.

Even thow I go directly to Rootategory -> Components -> Lenovo Thinkpad It stil says Home -> Lenovo ThinkPad

I've already checked this:

enter image description here

2
0

The inclusion of categories in the breadcrumbs is the default behavior in Magento > 2.3, however, it is tightly coupled with categories' 'Include in menu' option. If you choose not to include the category in the menu, then it will not show up in the breadcrumbs trail.

Also, if you directly access the product (and not navigate through categories to get to it), then it will show no category breadcrumbs trail (which is actually correct, you didn't use the categories, so there is no reason to have them in the breadcrumbs).

However, if you are not using Magento>2.3, then you will have to customly add the breadcrumbs. I found this module https://github.com/EaDesgin/magento2-full-path-category-product-breadcrumb which might help you with this. I didn't use it myself, but looks promissing.

5
  • Hi, could you help answer this. I checked the function getFilteredCollection, in: github.com/EaDesgin/…
    – Jimmy
    Mar 16 '21 at 10:00
  • it loads all the category with condition in, my questions is does it slow when the categories are enormous?
    – Jimmy
    Mar 16 '21 at 10:01
  • 1
    hi there, well i didn't try this module myself as already mentioned, and i am not sure how this will impact your environment. but you could install blackfire.io and profile the performance of the pages so that you have a clearer view. Mar 16 '21 at 10:06
  • I haven't installed it either, I just want to know by looking at the code :D Blackfire is gold, thanks for your help!
    – Jimmy
    Mar 16 '21 at 10:09
  • 1
    you are most welcome! i hope you sort it out :) i just checked that class and honestly that IN condition should not be a problem, it's just searching through the list of category IDs that the current product is assigned to, shouldn't be an issue. Mar 16 '21 at 10:12
0

In this tutorial, I will show you how to display products of a specific category on a home page.

  • Step 1: Please go to the Magento 2 admin panel > Product > Categories

  • Step 2: Open the desired category then find the category ID like below image. Please take note of the category ID value, you will need to use in the next step.

  • Step 3: In Magento 2 admin panel, please go to Content > Elements > Page > Choose desired Homepage

  • Step 4.Open the content tab and insert the following HTML code

    {{block type=”catalog/product_list” category_id=”4″ template=”catalog/product/list.phtml”}}

If you want to display a specific number of column in product listing, you can use the following code:

{{block type=”catalog/product_list” column_count=”4″ category_id=”4″ template=”catalog/product/list.phtml”}}
  • Step 5. Open Content > Elements > Blocks > Add New Blocks
  • Step 6. Specify Block name as “catalog/product_list” allow the Block by choosing the YES/No for “Enable Block”
2
  • The image you reference in your answer is missing.
    – paj
    Mar 15 '21 at 15:10
  • and this is relevant to the current question how? Mar 17 '21 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.