So when Google visits a page in our Magento stores Google caches the page with no breadcrumbs.
This is because Google cahces the page as if it’s a direct hit to the product page.
For example, if you copy a product URL, close your browser, open browser and paste the URL back into the address bar there’s NO BREADCRUMBS.
I would like to find a way to show the breadcrumbs on a page such as this. Possibly a way of generating the breadcrumbs for ALL categories that the product is listed in, LIKE EBAY - Look at eBay’s breadcrumbs:
I am very interested in this feature as well. We we’re having problems with Google and Bing visitors getting confused and sort of “lost”. After doing a week of analysis using heatmaps, we realized that over half of the people who landed on a product page clicked the Home breadcrumb… and then left.
I believe they we’re looking for the category of the product to browse similar things, but of course, that isn’t there. We’ve researched all over for a solution, but have been unsuccessful. We posted a job to oDesk about it but not a single provider responded.
You have my support on this. Please keep us updated on it, even if you don’t find a solution.
Is this resolved yet?!?!?! Freakin breadcrumbs are an older technology - but still a critical part of getting customers deeper into the catalog set and providing seo friendly links that can be crawled. Anymore most customers are coming into a particular product page, so every chance to get them deeper in the website versus just hitting the “back” button should be used. Anyone have a workaround or extension or something for this?
Note: I’ve tried and tried to create a module that overrides Mage_Catalog_Block_Breadcrumbs but Mage/Catalog/Block/Category/View.php and Mage/Catalog/Block/Product/View.php both create blocks using this class ( $this->getLayout()->createBlock(’catalog/breadcrumbs’); ) and apparently you cannot rewrite a block that is created through code. This is 1.4.1. But, this works, so I wasn’t about to go overriding both of those…
Edit FIxed a problem where the lays category wasn’t showing
if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setTitle(join($this->getTitleSeparator(), array_reverse($title))); }
$lastCrumbClass = 'current'; // Determine what the last path name is: category or product. If product get it's parent category. // We're on a product page if ($product = Mage::registry('current_product')) { $categories = $product->getCategoryCollection()->load();
Thanks for providing this code Nikola99! Even though it does not work for me, I could not have done this alternative solution without your solution. I hope my solution will prove more general.
Some background:
A product may exist in more than one category.
If a product is directly referenced by URL, the breadcrumb trail can’t show a category path because there is no unique path of categories to the product. However, from the customer\’s perspective, any path is better than none so its better to just get the first appropriate path rather than show no path.
My solution just ensures that if a product is known then the current category will be set to the first category found that the product is in if there is no category currently available. This yields a category for the breadcrumb trail if we’re looking at a product (on the assumption that all products are in at least one category).
To do this I have specialized the default catalog helper to return a product category in cases where there is no current category but there is a product (from which a ‘reasonable’ category may be selected.
Here is the solution (thanks again Nikola99 for making this process nice and clear):
Enable your module as per Nikola99\’s instructions. We\’re gonig to extend the Data.php helper in catalog with one function so create
app/code/local/[yourtheme]/Catalog/Helper/Data.php
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_Catalog * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */
/** * Return current category object * * @return Mage_Catalog_Model_Category|null */ public function getCategory() { // // If there is a current category then return it (currently default behaviour) $current_category = Mage::registry('current_category'); if ($current_category) return $current_category; // // If there is a current product use that to provide a // current category $current_product = $this->getProduct(); if ($current_product){ $categories = $current_product->getCategoryCollection()->load(); foreach ($categories as $category) { if($category) { return Mage::getModel('catalog/category')->load($category->getId()); } } } // // Default behaviour return parent::getCategory(); } } ?>
Now extend the active module’s config.xml to include the rewrite for the standard catalog helper class:
I also can’t get this to work in 1.5. I can add Nikola\’s original code to breadcrumbs.phtml and that works, but I can’t get Nikola\’s module to work. Has anyone got this module to work in 1.5? From what I can see, Nikola\’s instructions are quite clear, so there’s not a lot that could go wrong, which makes me wonder if this works in 1.5. Can anyone help?