I have a parent category SHOP and in shop, there are products. When I click on products, it goes on product description page. However, breadcrumb shows "home- > product1" instead of "home -> shop -> product1"
-
Do you have category paths enabled for product URLs in your admin: Store -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Use Categories Path for Product URLs? Try setting it to "Yes" if you don't.– LezJan 4, 2018 at 20:38
-
yes its already yes :( @Lez it work fine foe few minutes then start home -> product1 . link of website is 52.11.243.166– ephemeralJan 4, 2018 at 20:40
-
On local machine its aswell working good @Lez– ephemeralJan 4, 2018 at 20:43
-
I checked your site, and tried 5+ product pages. All show breadcrumbs fine: as home -> shop -> category -> product. Maybe it's just some specific product?– LezJan 4, 2018 at 21:16
-
@Lez I dont know why Option again went as NO , it happened 3 times. Now I have set and its working fine :D thanks for help. It was misleading me dont know why. as after selecting I didt verify either it is yes or no.– ephemeralJan 4, 2018 at 21:38
1 Answer
Possible Issue
This issue can occur when the full page cache caches a product page when visited from search or directly via the url.
As the breadcrumbs when visited from search do not show the full category path, the page will then be saved in the FPC with the breadcrumbs as Home > Product, even when later visited from a category.
Possible Solution
To overcome this I created a module which takes the deepest category path and uses that for breadcrumbs mainly so that users can see the path when searching for products.
In my case there was never breadcrumbs on products as page cache was warmed up from a sitemap and so similar to searching for products, directly viewing a product from URL showed no breadcrumbs.
This module below however replaces the default breadcrumbs behavior and should show breadcrumbs regardless once installed.
Issues
This will cause some incorrect paths if product in multiple categories and so will show wrong path for shallower path. This would of been the case in default Magento however depending which page was visited first.
Improvements
This could be improved to overcome the issue of incorrect paths when visited from another shallower category path however never got around to it as products were not listed in multiple categories in my case.
Ideally this needs to be modified to have breadcrumbs hole punched so they are always correct on category pages and then just replace search breadcrumbs with these new breadcrumbs for search.
-
great help. I have one more question, can we change path when we click on "related product " it took us to home ->productname . can it be changed ? Jan 8, 2018 at 12:03
-
This should change that product also. Test it see how it goes and let me know if you have issues and ill see if i can help further.– harriJan 8, 2018 at 12:04
-
I pasted this folder in app/code/harrigo and now this error showing Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Magento\Catalog\Block\Breadcrumbs Exception #1 (ReflectionException): Class Harrigo\EverCrumbs\Block\Breadcrumbs does not exist Jan 8, 2018 at 12:28
-
-
now path is app/code/harrigo/EverCrumbs/EverCrumbs-master and this happend Setup version for module 'Harrigo_EverCrumbs' is not specified Jan 8, 2018 at 12:31