4

Currently i've got products in a category sub of default for example:

Root -> Sub cat -> product

I've noticed that on the product page itself the breadcrumbs are working fine for some products and not for others. Some products will show the category and others wont show the category in the breadcrumb, they will either not show the category or they will show the category.

Something else i have come across is if I currently don't assign the product to default cat the following happens:

The product is assigned to default cat

The product has a sort order of 0 in the category list

The breadcrumbs don't show the category.

What is going on? Why is the breadcrumb breaking when it is either assigned to this Default cat ( which is the root cat btw ) and I don't get what is happening with the products where the category isn't being shown in the breadcrumb.

Magento is on 2.2 - I've reindexed - I've flushed cache.

I've also pulled all of my hair out - no just a joke.

* EDIT *

If anyone is having this issue, Full page cache is the culprit - disable this, flush cache and it should work how it is required.

  • 2
    i have the same problem but it seems its magento bug. It was reported here: github.com/magento/magento2/issues/7967 and its still open. – Anthony Dec 6 '17 at 13:21
  • 1
    Okay cool, so it is a bug & not just myself going mad. – andy jones Dec 6 '17 at 13:34
  • Is there a solution for this? I think it has something to do with Admin settings. Because like what you mentioned, it happens for some products and not others. In my case products that belong to two specific categories do not show full breadcrumbs, they only show Home > Product Name – Mohammed Joraid Jul 26 '18 at 2:29
  • If anyone is having this issue, Full page cache is the culprit - disable this, flush cache and it should work how it is required. – andy jones Jul 26 '18 at 6:55
0

NO, the full page cache is not the culprit.

DON'T DISABLE FULL PAGE CACHE.

The logic flow is clearly described in \Magento\Catalog\Helper\Data::getBreadcrumbPath() when it runs $category = $this->getCategory().

Just see the getCategory() code

/**
 * Return current category object
 *
 * @return \Magento\Catalog\Model\Category|null
 */
public function getCategory()
{
    return $this->_coreRegistry->registry('current_category');
}

It returns an object saved in the registry called current_category. If the object is not present, the breadcrumbs will be empty.

For example, if you make a first time access (clean browser and magento cache) to a product directly from search box, you will have that breadcrumbs will be empty because registry('current_category') was not setted.

Otherwise, if you make a first time access (clean browser and magento cache) to a product after visited its category, breadcrumbs will be present, because registry('current_category') was setted.

Then, every time you make a second visit to same product page you just see the same result, because FPC (FULL PAGE CACHE) JUST CACHE EVERY GET REQUEST AND RESPONSE WITH THE CONTENT OF THE FIRST TIME VISIT.

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.