1

when you navigate to an item that was in a 3rd level category, if you copy that url and go to a completely different product in a completely different 3rd level category and then paste in the URL you copied only the product name in the breadcrumbs is updated, the category path wont change

ie go to Men's, Clothing, Coats, Men's Coat 1, the Breadcumbs will say something like "Home > Men's > Clothing > Coats > Men's Coat 1",

copy the URL than go to Women's, Footwear, Heels, Women's Heel 1, the breadcrumb will be "Home > Women's > Footwear> Heels > Women's Heel 1"

Now if you paste the URL you copied from the Coat, the Breadcrumbs will be "Home > Women's > Footwear> Heels > Men's Coat 1" which isn't correct

i set up a clean build of magento without any of the extensions and duplicated the test and it did the same so it's obviously a problem with magento, i'm wondering if there already exists a way to fix this

UPDATE: my current solution that i am using now is to rebuild the breadcrumbs when a customer enters the product view which is hardly efficient so i still want to know if there is a better why

6
  • Do you use EE version? It looks like FPC issue. Apr 23 '13 at 9:09
  • @Zyava yeh, it's Enterprise, i dont know what FPC is though
    – Memor-X
    Apr 24 '13 at 0:59
  • Full Page Cache Apr 24 '13 at 15:29
  • What version of Enterprise are your on? Also, do you have cache * FPC enabled? Do you have URL rewrites enabled?
    – kab8609
    May 9 '13 at 14:34
  • 1
    ...and developer mode (Mage::getIsDeveloperMode()) is false?
    – benmarks
    May 10 '13 at 1:24
3

Now if you paste the URL you copied from the Coat, the Breadcrumbs will be "Home > Women's > Footwear> Heels > Men's Coat 1" which isn't correct

In my experience this is local to 1.11EE - This is due to the fact that Magento uses the cookie value from LAST_CATEGORY. I requested a patch from EE support for this and they provided one to me. I'd be surprised if this wasn't fixed in 1.12.

While I don't have the patchfile at the moment, an SVN diff yielded the following:

Index: app/code/core/Enterprise/PageCache/Model/Processor/Default.php
===================================================================
--- app/code/core/Enterprise/PageCache/Model/Processor/Default.php  (revision 717)
+++ app/code/core/Enterprise/PageCache/Model/Processor/Default.php  (revision 718)
@@ -103,6 +103,7 @@
          */
         if ($container && !Mage::getIsDeveloperMode()) {
             $container = new $container($this->_placeholder);
+            $container->setProcessor(Mage::getSingleton('enterprise_pagecache/processor'));
             $blockContent = $matches[1];
             $container->saveCache($blockContent);
         }
Index: app/code/core/Enterprise/PageCache/Model/Container/Breadcrumbs.php
===================================================================
--- app/code/core/Enterprise/PageCache/Model/Container/Breadcrumbs.php  (revision 717)
+++ app/code/core/Enterprise/PageCache/Model/Container/Breadcrumbs.php  (revision 718)
@@ -51,6 +51,10 @@
     protected function _renderBlock()
     {
         $productId = $this->_getProductId();
+
+        /** @var $product null|Mage_Catalog_Model_Product */
+        $product = null;
+
         if ($productId) {
             $product = Mage::getModel('catalog/product')
                 ->setStoreId(Mage::app()->getStore()->getId())
@@ -60,6 +64,12 @@
             }
         }
         $categoryId = $this->_getCategoryId();
+
+        if ($product !== null && !$product->canBeShowInCategory($categoryId)) {
+            $categoryId = null;
+            Mage::unregister('current_category');
+        }
+
         if ($categoryId && !Mage::registry('current_category')) {
             $category = Mage::getModel('catalog/category')->load($categoryId);
             if ($category) {
@@ -68,7 +78,7 @@
         }

         //No need breadcrumbs on CMS pages
-        if (!$categoryId) {
+        if (!$productId && !$categoryId) {
             return '';
         }

Index: app/code/core/Enterprise/PageCache/Model/Observer.php
===================================================================
--- app/code/core/Enterprise/PageCache/Model/Observer.php   (revision 717)
+++ app/code/core/Enterprise/PageCache/Model/Observer.php   (revision 718)
@@ -546,6 +546,10 @@
      */
     public function updateProductInfo(Varien_Event_Observer $observer)
     {
+        if (!$this->isCacheEnabled()) {
+            return $this;
+        }
+
         $paramsObject = $observer->getEvent()->getParams();
         if ($paramsObject instanceof Varien_Object) {
             if (array_key_exists(Enterprise_PageCache_Model_Cookie::COOKIE_CATEGORY_ID, $_COOKIE)) {
Index: app/code/core/Mage/Catalog/Helper/Product.php
===================================================================
--- app/code/core/Mage/Catalog/Helper/Product.php   (revision 717)
+++ app/code/core/Mage/Catalog/Helper/Product.php   (revision 718)
@@ -307,6 +307,8 @@
             if ($product->canBeShowInCategory($lastId)) {
                 $categoryId = $lastId;
             }
+        } elseif (!$product->canBeShowInCategory($categoryId)) {
+            $categoryId = null;
         }

         if ($categoryId) {
@@ -322,9 +324,7 @@
         try {
             Mage::dispatchEvent('catalog_controller_product_init', array('product' => $product));
             Mage::dispatchEvent('catalog_controller_product_init_after',
-                            array('product' => $product,
-                                'controller_action' => $controller
-                            )
+                array('product' => $product, 'controller_action' => $controller)
             );
         } catch (Mage_Core_Exception $e) {
             Mage::logException($e);
1
  • 1
    works well in a clean version of magento 1.11, when you go from one product to another via url the second product doesn't have the category path in the breadcrumbs, problem is that even after i remove my changes in the development copy it still showing the wrong category path but this would probably be because of a local module as it works in a clean version of magento, thanks for your help
    – Memor-X
    Jun 4 '13 at 23:31

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.