4

where it Is made Breadcrumb Array in Magento 2.3.1?

In Detail page has show Breadcrumb but i m not able to find where it Is made Breadcrumb Array

enter image description here

Can somebody help me?

Thanks

1

For product page breadcrumbs loading from

https://github.com/magento/magento2/blob/2.3/app/code/Magento/Catalog/view/frontend/web/js/product/breadcrumbs.js

function _resolveCategoryUrl

Basically the code is checking if category path included in url then its creating breadcrumbs path from url, otherwise it will check for referral url and if referral is category url then it will find category title and url from menu dropdown

See function _resolveCategoryCrumbs

So if category is not included in menu then it won't show breadcrumbs!

0

There are quite a few places. Breadcrumbs are used almost identical as they were in Magento 1.

The module responsible with them is: Magento_Theme. They are added to the layout in:

vendor/magento/module-theme/view/frontend/layout/default.xml

Block:

vendor/magento/module-theme/Block/Html/Breadcrumbs.php

Template:

vendor/magento/module-theme/view/frontend/templates/html/breadcrumbs.phtml

Now, each module that renders pages, can modify/add what breadcrumbs they want.

As I can see, you are interested in product page. That is rendered "_prepareLayout()" from:

vendor/magento/module-catalog/Block/Breadcrumbs.php

If you want to find them all, just search all the magento vendor module for:

->addCrumb(

0

for product page, https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml

it is calling below js file https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/view/frontend/web/js/product/breadcrumbs.js

and it is creating json from below file https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php#L104

hope it will clear your doubts.

  • i know that but how to made Array and where? – Savan Patel May 14 at 8:28
  • updated answer @SavanPatel – Sunil Patel May 14 at 8:41
  • i know all three file you said me but how it work to create a array? – Savan Patel May 14 at 8:47
  • it is passing json into js file and js file do process, you just need to debug that js file – Sunil Patel May 14 at 8:52

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.