Breadcrumbs Product hyperlink The Next CEO of Stack OverflowMy Breadcrumbs wont work when on a product pageBreadcrumbs do not contain linksRemoving home and all Categories from breadcrumbsMagento(1.9) Breadcrumbs not showingMagento display multiple breadcrumbs in product view pageMagento 2 Breadcrumbs CopyChanging breadcrumbs product name to an attributeaccount information breadcrumbs in magento 1.9Orders showing on account overview but not on historyHow To Remove Product Title from Breadcrumbs

Find a path from s to t using as few red nodes as possible

Free fall ellipse or parabola?

Cannot restore registry to default in Windows 10?

How can the PCs determine if an item is a phylactery?

Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?

How should I verify that an integer value passed in from argv won't overflow?

Horror film about a man brought out of cryogenic suspension without a soul, around 1990

What did the word "leisure" mean in late 18th Century usage?

Create custom note boxes

Mathematica command that allows it to read my intentions

That's an odd coin - I wonder why

Creating a script with console commands

Compensation for working overtime on Saturdays

What steps are necessary to read a Modern SSD in Medieval Europe?

A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?

Why doesn't Shulchan Aruch include the laws of destroying fruit trees?

Early programmable calculators with RS-232

Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?

Shortening a title without changing its meaning

Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?

Gauss' Posthumous Publications?

How to implement Comparable so it is consistent with identity-equality

Masking layers by a vector polygon layer in QGIS

Find the majority element, which appears more than half the time



Breadcrumbs Product hyperlink



The Next CEO of Stack OverflowMy Breadcrumbs wont work when on a product pageBreadcrumbs do not contain linksRemoving home and all Categories from breadcrumbsMagento(1.9) Breadcrumbs not showingMagento display multiple breadcrumbs in product view pageMagento 2 Breadcrumbs CopyChanging breadcrumbs product name to an attributeaccount information breadcrumbs in magento 1.9Orders showing on account overview but not on historyHow To Remove Product Title from Breadcrumbs










1















I need the breadcrumbs to hyperlink the current page i'm in..



For example



Home >> Category >> Product



usually, all parent categories hyperlinked. i wish to have product hyperlinked as well.



<?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.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Page
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Html page block
*
* @category Mage
* @package Mage_Page
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Page_Block_Html_Breadcrumbs extends Mage_Core_Block_Template

/**
* Array of breadcrumbs
*
* array(
* [$index] => array(
* ['label']
* ['title']
* ['link']
* ['first']
* ['last']
* )
* )
*
* @var array
*/
protected $_crumbs = null;

function __construct()

parent::__construct();
$this->setTemplate('page/html/breadcrumbs.phtml');


function addCrumb($crumbName, $crumbInfo, $after = false)

$this->_prepareArray($crumbInfo, array('label', 'title', 'link', 'first', 'last', 'readonly'));
if ((!isset($this->_crumbs[$crumbName]))

protected function _toHtml()

$cat_id = "";

if (Mage::registry('current_product'))
$product_id = Mage::registry('current_product')->getId();
$obj = Mage::getModel('catalog/product');
$_product = $obj->load($product_id); // Enter your Product Id in $product_id

if ($product_id)
$categoryIds = $_product->getCategoryIds();
$cat_id = $categoryIds[0];


$category = Mage::getModel('catalog/category')->load($cat_id);
$cat_name = $category->getName();
$cat_url = $this->getBaseUrl().$category->getUrlPath();


if (is_array($this->_crumbs))
reset($this->_crumbs);
$this->_crumbs[key($this->_crumbs)]['first'] = true;
end($this->_crumbs);
$this->_crumbs[key($this->_crumbs)]['last'] = true;


if($cat_id)
$this->_crumbs['category'.$cat_id] = array('label'=>$cat_name, 'title'=>'', 'link'=>$cat_url,'first'=>'','last'=>'','readonly'=>'');
ksort($this->_crumbs);
$home = $this->_crumbs['home'];
unset($this->_crumbs['home']);
array_unshift($this->_crumbs,$home);


$this->assign('crumbs', $this->_crumbs);
return parent::_toHtml();




Thanks










share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    1















    I need the breadcrumbs to hyperlink the current page i'm in..



    For example



    Home >> Category >> Product



    usually, all parent categories hyperlinked. i wish to have product hyperlinked as well.



    <?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.
    *
    * DISCLAIMER
    *
    * Do not edit or add to this file if you wish to upgrade Magento to newer
    * versions in the future. If you wish to customize Magento for your
    * needs please refer to http://www.magentocommerce.com for more information.
    *
    * @category Mage
    * @package Mage_Page
    * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
    * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
    */

    /**
    * Html page block
    *
    * @category Mage
    * @package Mage_Page
    * @author Magento Core Team <core@magentocommerce.com>
    */
    class Mage_Page_Block_Html_Breadcrumbs extends Mage_Core_Block_Template

    /**
    * Array of breadcrumbs
    *
    * array(
    * [$index] => array(
    * ['label']
    * ['title']
    * ['link']
    * ['first']
    * ['last']
    * )
    * )
    *
    * @var array
    */
    protected $_crumbs = null;

    function __construct()

    parent::__construct();
    $this->setTemplate('page/html/breadcrumbs.phtml');


    function addCrumb($crumbName, $crumbInfo, $after = false)

    $this->_prepareArray($crumbInfo, array('label', 'title', 'link', 'first', 'last', 'readonly'));
    if ((!isset($this->_crumbs[$crumbName]))

    protected function _toHtml()

    $cat_id = "";

    if (Mage::registry('current_product'))
    $product_id = Mage::registry('current_product')->getId();
    $obj = Mage::getModel('catalog/product');
    $_product = $obj->load($product_id); // Enter your Product Id in $product_id

    if ($product_id)
    $categoryIds = $_product->getCategoryIds();
    $cat_id = $categoryIds[0];


    $category = Mage::getModel('catalog/category')->load($cat_id);
    $cat_name = $category->getName();
    $cat_url = $this->getBaseUrl().$category->getUrlPath();


    if (is_array($this->_crumbs))
    reset($this->_crumbs);
    $this->_crumbs[key($this->_crumbs)]['first'] = true;
    end($this->_crumbs);
    $this->_crumbs[key($this->_crumbs)]['last'] = true;


    if($cat_id)
    $this->_crumbs['category'.$cat_id] = array('label'=>$cat_name, 'title'=>'', 'link'=>$cat_url,'first'=>'','last'=>'','readonly'=>'');
    ksort($this->_crumbs);
    $home = $this->_crumbs['home'];
    unset($this->_crumbs['home']);
    array_unshift($this->_crumbs,$home);


    $this->assign('crumbs', $this->_crumbs);
    return parent::_toHtml();




    Thanks










    share|improve this question
















    bumped to the homepage by Community 6 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      1












      1








      1








      I need the breadcrumbs to hyperlink the current page i'm in..



      For example



      Home >> Category >> Product



      usually, all parent categories hyperlinked. i wish to have product hyperlinked as well.



      <?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.
      *
      * DISCLAIMER
      *
      * Do not edit or add to this file if you wish to upgrade Magento to newer
      * versions in the future. If you wish to customize Magento for your
      * needs please refer to http://www.magentocommerce.com for more information.
      *
      * @category Mage
      * @package Mage_Page
      * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
      * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
      */

      /**
      * Html page block
      *
      * @category Mage
      * @package Mage_Page
      * @author Magento Core Team <core@magentocommerce.com>
      */
      class Mage_Page_Block_Html_Breadcrumbs extends Mage_Core_Block_Template

      /**
      * Array of breadcrumbs
      *
      * array(
      * [$index] => array(
      * ['label']
      * ['title']
      * ['link']
      * ['first']
      * ['last']
      * )
      * )
      *
      * @var array
      */
      protected $_crumbs = null;

      function __construct()

      parent::__construct();
      $this->setTemplate('page/html/breadcrumbs.phtml');


      function addCrumb($crumbName, $crumbInfo, $after = false)

      $this->_prepareArray($crumbInfo, array('label', 'title', 'link', 'first', 'last', 'readonly'));
      if ((!isset($this->_crumbs[$crumbName]))

      protected function _toHtml()

      $cat_id = "";

      if (Mage::registry('current_product'))
      $product_id = Mage::registry('current_product')->getId();
      $obj = Mage::getModel('catalog/product');
      $_product = $obj->load($product_id); // Enter your Product Id in $product_id

      if ($product_id)
      $categoryIds = $_product->getCategoryIds();
      $cat_id = $categoryIds[0];


      $category = Mage::getModel('catalog/category')->load($cat_id);
      $cat_name = $category->getName();
      $cat_url = $this->getBaseUrl().$category->getUrlPath();


      if (is_array($this->_crumbs))
      reset($this->_crumbs);
      $this->_crumbs[key($this->_crumbs)]['first'] = true;
      end($this->_crumbs);
      $this->_crumbs[key($this->_crumbs)]['last'] = true;


      if($cat_id)
      $this->_crumbs['category'.$cat_id] = array('label'=>$cat_name, 'title'=>'', 'link'=>$cat_url,'first'=>'','last'=>'','readonly'=>'');
      ksort($this->_crumbs);
      $home = $this->_crumbs['home'];
      unset($this->_crumbs['home']);
      array_unshift($this->_crumbs,$home);


      $this->assign('crumbs', $this->_crumbs);
      return parent::_toHtml();




      Thanks










      share|improve this question
















      I need the breadcrumbs to hyperlink the current page i'm in..



      For example



      Home >> Category >> Product



      usually, all parent categories hyperlinked. i wish to have product hyperlinked as well.



      <?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.
      *
      * DISCLAIMER
      *
      * Do not edit or add to this file if you wish to upgrade Magento to newer
      * versions in the future. If you wish to customize Magento for your
      * needs please refer to http://www.magentocommerce.com for more information.
      *
      * @category Mage
      * @package Mage_Page
      * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
      * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
      */

      /**
      * Html page block
      *
      * @category Mage
      * @package Mage_Page
      * @author Magento Core Team <core@magentocommerce.com>
      */
      class Mage_Page_Block_Html_Breadcrumbs extends Mage_Core_Block_Template

      /**
      * Array of breadcrumbs
      *
      * array(
      * [$index] => array(
      * ['label']
      * ['title']
      * ['link']
      * ['first']
      * ['last']
      * )
      * )
      *
      * @var array
      */
      protected $_crumbs = null;

      function __construct()

      parent::__construct();
      $this->setTemplate('page/html/breadcrumbs.phtml');


      function addCrumb($crumbName, $crumbInfo, $after = false)

      $this->_prepareArray($crumbInfo, array('label', 'title', 'link', 'first', 'last', 'readonly'));
      if ((!isset($this->_crumbs[$crumbName]))

      protected function _toHtml()

      $cat_id = "";

      if (Mage::registry('current_product'))
      $product_id = Mage::registry('current_product')->getId();
      $obj = Mage::getModel('catalog/product');
      $_product = $obj->load($product_id); // Enter your Product Id in $product_id

      if ($product_id)
      $categoryIds = $_product->getCategoryIds();
      $cat_id = $categoryIds[0];


      $category = Mage::getModel('catalog/category')->load($cat_id);
      $cat_name = $category->getName();
      $cat_url = $this->getBaseUrl().$category->getUrlPath();


      if (is_array($this->_crumbs))
      reset($this->_crumbs);
      $this->_crumbs[key($this->_crumbs)]['first'] = true;
      end($this->_crumbs);
      $this->_crumbs[key($this->_crumbs)]['last'] = true;


      if($cat_id)
      $this->_crumbs['category'.$cat_id] = array('label'=>$cat_name, 'title'=>'', 'link'=>$cat_url,'first'=>'','last'=>'','readonly'=>'');
      ksort($this->_crumbs);
      $home = $this->_crumbs['home'];
      unset($this->_crumbs['home']);
      array_unshift($this->_crumbs,$home);


      $this->assign('crumbs', $this->_crumbs);
      return parent::_toHtml();




      Thanks







      magento-1.9 php breadcrumbs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 27 '18 at 5:30









      Ansar Husain

      1,715218




      1,715218










      asked Sep 8 '15 at 10:09









      user30913user30913

      62




      62





      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          3 Answers
          3






          active

          oldest

          votes


















          0














          You need to modify getBreadcrumbPath() in app/code/core/Mage/Catalog/Helper/Data as links are not added to the breadcrumb array by default.



          Do this with a rewrite that would look like



          ...
          <helpers>
          <catalog>
          <rewrite>
          <data>[Vendor]_[ModuleName]_Helper_Catalog_Data</data>
          </rewrite>
          </catalog>
          </helpers>
          ...


          in your config.xml and the following would be the rewritten class



          class [Vendor]_[ModuleName]_Helper_Catalog_Data extends Mage_Catalog_Helper_Data

          public function getBreadcrumbPath()

          parent::getBreadcrumbPath();
          if (array_key_exists('product', $this->_categoryPath))
          $this->_categoryPath['product']['link'] = $this->getProduct()->getProductUrl();


          return $this->_categoryPath;







          share|improve this answer






























            0














            Observe the proper event, perhaps something similar to (just guessing the event) core_block_abstract_to_html_before, (but perhaps something that would be less often observed) with a custom observer, similar to:



             <core_block_abstract_to_html_before>
            <observers>
            <df2k2_update_breadcrumb>
            <class>df2k2_page/observer</class>
            <method>updateBreadcrumbLink</method>
            </df2k2_update_breadcrumb>
            </observers>
            </core_block_abstract_to_html_before>


            Observer Class



             public function updateBreadcrumbLink(Varien_Event_Observer $observer)


            $breadcrumbsBlock = $observer->getEvent()->getBlock();

            if ($breadcrumbsBlock instanceof Mage_Page_Block_Html_Breadcrumbs)
            // Get the block, get the last breadcrumb item in the array
            // and simply check for registry('current_product') or 'current_category',
            // and set the last item's [`link`] element to either the product's url or the categories URL
            // example,
            if (is_array($breadcrumbsBlock->_crumbs))
            end($breadcrumbsBlock->_crumbs);
            $breadcrumbsBlock->_crumbs[key($breadcrumbsBlock->_crumbs)]['link']
            = Mage::getRegistry('current_product')->getUrl();
            // = Mage::helper('core')->getCurrentUrl();

            $breadcrumbsBlock->assign('crumbs', $breadcrumbsBlock->_crumbs);



            return $this;




            Once you set the link part for the last crumb item in the array of crumbs, then it will automatically render the item to include the linked URL.



            There is a lot of detail missing with logic and object checking for current_product and category... Essentially, if there exists a registry for current_product, use that... if current_category, use that... otherwise, simply do whatever you want, or nothing at all.



            If you don't wish to look up the details of the product/category.. just get the current URL and set the ['link'] element to the current URL.








            share|improve this answer
































              0














              <?php if($crumbs && is_array($crumbs)): ?>
              <div class="breadcrumbs">
              <ul>
              <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
              <li class="<?php echo $_crumbName ?>">
              <?php if($_crumbInfo['link']): ?>
              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
              <?php elseif($_crumbInfo['last']): ?>
              <?php // i have add link code here as below ?>
              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong></a>
              <?php else: ?>
              <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
              <?php endif; ?>
              <?php if(!$_crumbInfo['last']): ?>
              <span>/ </span>
              <?php endif; ?>
              </li>
              <?php endforeach; ?>
              </ul>
              </div>
              <?php endif; ?>


              edit above code in



              app/design/frontend/[Your-theme]/[Your-package]/template/page/html/breadcrumbs.phtml





              share|improve this answer

























              • typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                – df2k2
                Apr 15 '18 at 7:04











              • yes breadcrums.phtml

                – Yogesh Trivedi
                Apr 24 '18 at 9:35











              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f82283%2fbreadcrumbs-product-hyperlink%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              You need to modify getBreadcrumbPath() in app/code/core/Mage/Catalog/Helper/Data as links are not added to the breadcrumb array by default.



              Do this with a rewrite that would look like



              ...
              <helpers>
              <catalog>
              <rewrite>
              <data>[Vendor]_[ModuleName]_Helper_Catalog_Data</data>
              </rewrite>
              </catalog>
              </helpers>
              ...


              in your config.xml and the following would be the rewritten class



              class [Vendor]_[ModuleName]_Helper_Catalog_Data extends Mage_Catalog_Helper_Data

              public function getBreadcrumbPath()

              parent::getBreadcrumbPath();
              if (array_key_exists('product', $this->_categoryPath))
              $this->_categoryPath['product']['link'] = $this->getProduct()->getProductUrl();


              return $this->_categoryPath;







              share|improve this answer



























                0














                You need to modify getBreadcrumbPath() in app/code/core/Mage/Catalog/Helper/Data as links are not added to the breadcrumb array by default.



                Do this with a rewrite that would look like



                ...
                <helpers>
                <catalog>
                <rewrite>
                <data>[Vendor]_[ModuleName]_Helper_Catalog_Data</data>
                </rewrite>
                </catalog>
                </helpers>
                ...


                in your config.xml and the following would be the rewritten class



                class [Vendor]_[ModuleName]_Helper_Catalog_Data extends Mage_Catalog_Helper_Data

                public function getBreadcrumbPath()

                parent::getBreadcrumbPath();
                if (array_key_exists('product', $this->_categoryPath))
                $this->_categoryPath['product']['link'] = $this->getProduct()->getProductUrl();


                return $this->_categoryPath;







                share|improve this answer

























                  0












                  0








                  0







                  You need to modify getBreadcrumbPath() in app/code/core/Mage/Catalog/Helper/Data as links are not added to the breadcrumb array by default.



                  Do this with a rewrite that would look like



                  ...
                  <helpers>
                  <catalog>
                  <rewrite>
                  <data>[Vendor]_[ModuleName]_Helper_Catalog_Data</data>
                  </rewrite>
                  </catalog>
                  </helpers>
                  ...


                  in your config.xml and the following would be the rewritten class



                  class [Vendor]_[ModuleName]_Helper_Catalog_Data extends Mage_Catalog_Helper_Data

                  public function getBreadcrumbPath()

                  parent::getBreadcrumbPath();
                  if (array_key_exists('product', $this->_categoryPath))
                  $this->_categoryPath['product']['link'] = $this->getProduct()->getProductUrl();


                  return $this->_categoryPath;







                  share|improve this answer













                  You need to modify getBreadcrumbPath() in app/code/core/Mage/Catalog/Helper/Data as links are not added to the breadcrumb array by default.



                  Do this with a rewrite that would look like



                  ...
                  <helpers>
                  <catalog>
                  <rewrite>
                  <data>[Vendor]_[ModuleName]_Helper_Catalog_Data</data>
                  </rewrite>
                  </catalog>
                  </helpers>
                  ...


                  in your config.xml and the following would be the rewritten class



                  class [Vendor]_[ModuleName]_Helper_Catalog_Data extends Mage_Catalog_Helper_Data

                  public function getBreadcrumbPath()

                  parent::getBreadcrumbPath();
                  if (array_key_exists('product', $this->_categoryPath))
                  $this->_categoryPath['product']['link'] = $this->getProduct()->getProductUrl();


                  return $this->_categoryPath;








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 8 '15 at 10:53









                  SmartieSmartie

                  2,8001727




                  2,8001727























                      0














                      Observe the proper event, perhaps something similar to (just guessing the event) core_block_abstract_to_html_before, (but perhaps something that would be less often observed) with a custom observer, similar to:



                       <core_block_abstract_to_html_before>
                      <observers>
                      <df2k2_update_breadcrumb>
                      <class>df2k2_page/observer</class>
                      <method>updateBreadcrumbLink</method>
                      </df2k2_update_breadcrumb>
                      </observers>
                      </core_block_abstract_to_html_before>


                      Observer Class



                       public function updateBreadcrumbLink(Varien_Event_Observer $observer)


                      $breadcrumbsBlock = $observer->getEvent()->getBlock();

                      if ($breadcrumbsBlock instanceof Mage_Page_Block_Html_Breadcrumbs)
                      // Get the block, get the last breadcrumb item in the array
                      // and simply check for registry('current_product') or 'current_category',
                      // and set the last item's [`link`] element to either the product's url or the categories URL
                      // example,
                      if (is_array($breadcrumbsBlock->_crumbs))
                      end($breadcrumbsBlock->_crumbs);
                      $breadcrumbsBlock->_crumbs[key($breadcrumbsBlock->_crumbs)]['link']
                      = Mage::getRegistry('current_product')->getUrl();
                      // = Mage::helper('core')->getCurrentUrl();

                      $breadcrumbsBlock->assign('crumbs', $breadcrumbsBlock->_crumbs);



                      return $this;




                      Once you set the link part for the last crumb item in the array of crumbs, then it will automatically render the item to include the linked URL.



                      There is a lot of detail missing with logic and object checking for current_product and category... Essentially, if there exists a registry for current_product, use that... if current_category, use that... otherwise, simply do whatever you want, or nothing at all.



                      If you don't wish to look up the details of the product/category.. just get the current URL and set the ['link'] element to the current URL.








                      share|improve this answer





























                        0














                        Observe the proper event, perhaps something similar to (just guessing the event) core_block_abstract_to_html_before, (but perhaps something that would be less often observed) with a custom observer, similar to:



                         <core_block_abstract_to_html_before>
                        <observers>
                        <df2k2_update_breadcrumb>
                        <class>df2k2_page/observer</class>
                        <method>updateBreadcrumbLink</method>
                        </df2k2_update_breadcrumb>
                        </observers>
                        </core_block_abstract_to_html_before>


                        Observer Class



                         public function updateBreadcrumbLink(Varien_Event_Observer $observer)


                        $breadcrumbsBlock = $observer->getEvent()->getBlock();

                        if ($breadcrumbsBlock instanceof Mage_Page_Block_Html_Breadcrumbs)
                        // Get the block, get the last breadcrumb item in the array
                        // and simply check for registry('current_product') or 'current_category',
                        // and set the last item's [`link`] element to either the product's url or the categories URL
                        // example,
                        if (is_array($breadcrumbsBlock->_crumbs))
                        end($breadcrumbsBlock->_crumbs);
                        $breadcrumbsBlock->_crumbs[key($breadcrumbsBlock->_crumbs)]['link']
                        = Mage::getRegistry('current_product')->getUrl();
                        // = Mage::helper('core')->getCurrentUrl();

                        $breadcrumbsBlock->assign('crumbs', $breadcrumbsBlock->_crumbs);



                        return $this;




                        Once you set the link part for the last crumb item in the array of crumbs, then it will automatically render the item to include the linked URL.



                        There is a lot of detail missing with logic and object checking for current_product and category... Essentially, if there exists a registry for current_product, use that... if current_category, use that... otherwise, simply do whatever you want, or nothing at all.



                        If you don't wish to look up the details of the product/category.. just get the current URL and set the ['link'] element to the current URL.








                        share|improve this answer



























                          0












                          0








                          0







                          Observe the proper event, perhaps something similar to (just guessing the event) core_block_abstract_to_html_before, (but perhaps something that would be less often observed) with a custom observer, similar to:



                           <core_block_abstract_to_html_before>
                          <observers>
                          <df2k2_update_breadcrumb>
                          <class>df2k2_page/observer</class>
                          <method>updateBreadcrumbLink</method>
                          </df2k2_update_breadcrumb>
                          </observers>
                          </core_block_abstract_to_html_before>


                          Observer Class



                           public function updateBreadcrumbLink(Varien_Event_Observer $observer)


                          $breadcrumbsBlock = $observer->getEvent()->getBlock();

                          if ($breadcrumbsBlock instanceof Mage_Page_Block_Html_Breadcrumbs)
                          // Get the block, get the last breadcrumb item in the array
                          // and simply check for registry('current_product') or 'current_category',
                          // and set the last item's [`link`] element to either the product's url or the categories URL
                          // example,
                          if (is_array($breadcrumbsBlock->_crumbs))
                          end($breadcrumbsBlock->_crumbs);
                          $breadcrumbsBlock->_crumbs[key($breadcrumbsBlock->_crumbs)]['link']
                          = Mage::getRegistry('current_product')->getUrl();
                          // = Mage::helper('core')->getCurrentUrl();

                          $breadcrumbsBlock->assign('crumbs', $breadcrumbsBlock->_crumbs);



                          return $this;




                          Once you set the link part for the last crumb item in the array of crumbs, then it will automatically render the item to include the linked URL.



                          There is a lot of detail missing with logic and object checking for current_product and category... Essentially, if there exists a registry for current_product, use that... if current_category, use that... otherwise, simply do whatever you want, or nothing at all.



                          If you don't wish to look up the details of the product/category.. just get the current URL and set the ['link'] element to the current URL.








                          share|improve this answer















                          Observe the proper event, perhaps something similar to (just guessing the event) core_block_abstract_to_html_before, (but perhaps something that would be less often observed) with a custom observer, similar to:



                           <core_block_abstract_to_html_before>
                          <observers>
                          <df2k2_update_breadcrumb>
                          <class>df2k2_page/observer</class>
                          <method>updateBreadcrumbLink</method>
                          </df2k2_update_breadcrumb>
                          </observers>
                          </core_block_abstract_to_html_before>


                          Observer Class



                           public function updateBreadcrumbLink(Varien_Event_Observer $observer)


                          $breadcrumbsBlock = $observer->getEvent()->getBlock();

                          if ($breadcrumbsBlock instanceof Mage_Page_Block_Html_Breadcrumbs)
                          // Get the block, get the last breadcrumb item in the array
                          // and simply check for registry('current_product') or 'current_category',
                          // and set the last item's [`link`] element to either the product's url or the categories URL
                          // example,
                          if (is_array($breadcrumbsBlock->_crumbs))
                          end($breadcrumbsBlock->_crumbs);
                          $breadcrumbsBlock->_crumbs[key($breadcrumbsBlock->_crumbs)]['link']
                          = Mage::getRegistry('current_product')->getUrl();
                          // = Mage::helper('core')->getCurrentUrl();

                          $breadcrumbsBlock->assign('crumbs', $breadcrumbsBlock->_crumbs);



                          return $this;




                          Once you set the link part for the last crumb item in the array of crumbs, then it will automatically render the item to include the linked URL.



                          There is a lot of detail missing with logic and object checking for current_product and category... Essentially, if there exists a registry for current_product, use that... if current_category, use that... otherwise, simply do whatever you want, or nothing at all.



                          If you don't wish to look up the details of the product/category.. just get the current URL and set the ['link'] element to the current URL.









                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 15 '18 at 8:22

























                          answered Apr 15 '18 at 8:03









                          df2k2df2k2

                          734310




                          734310





















                              0














                              <?php if($crumbs && is_array($crumbs)): ?>
                              <div class="breadcrumbs">
                              <ul>
                              <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
                              <li class="<?php echo $_crumbName ?>">
                              <?php if($_crumbInfo['link']): ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
                              <?php elseif($_crumbInfo['last']): ?>
                              <?php // i have add link code here as below ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong></a>
                              <?php else: ?>
                              <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                              <?php endif; ?>
                              <?php if(!$_crumbInfo['last']): ?>
                              <span>/ </span>
                              <?php endif; ?>
                              </li>
                              <?php endforeach; ?>
                              </ul>
                              </div>
                              <?php endif; ?>


                              edit above code in



                              app/design/frontend/[Your-theme]/[Your-package]/template/page/html/breadcrumbs.phtml





                              share|improve this answer

























                              • typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                                – df2k2
                                Apr 15 '18 at 7:04











                              • yes breadcrums.phtml

                                – Yogesh Trivedi
                                Apr 24 '18 at 9:35















                              0














                              <?php if($crumbs && is_array($crumbs)): ?>
                              <div class="breadcrumbs">
                              <ul>
                              <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
                              <li class="<?php echo $_crumbName ?>">
                              <?php if($_crumbInfo['link']): ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
                              <?php elseif($_crumbInfo['last']): ?>
                              <?php // i have add link code here as below ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong></a>
                              <?php else: ?>
                              <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                              <?php endif; ?>
                              <?php if(!$_crumbInfo['last']): ?>
                              <span>/ </span>
                              <?php endif; ?>
                              </li>
                              <?php endforeach; ?>
                              </ul>
                              </div>
                              <?php endif; ?>


                              edit above code in



                              app/design/frontend/[Your-theme]/[Your-package]/template/page/html/breadcrumbs.phtml





                              share|improve this answer

























                              • typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                                – df2k2
                                Apr 15 '18 at 7:04











                              • yes breadcrums.phtml

                                – Yogesh Trivedi
                                Apr 24 '18 at 9:35













                              0












                              0








                              0







                              <?php if($crumbs && is_array($crumbs)): ?>
                              <div class="breadcrumbs">
                              <ul>
                              <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
                              <li class="<?php echo $_crumbName ?>">
                              <?php if($_crumbInfo['link']): ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
                              <?php elseif($_crumbInfo['last']): ?>
                              <?php // i have add link code here as below ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong></a>
                              <?php else: ?>
                              <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                              <?php endif; ?>
                              <?php if(!$_crumbInfo['last']): ?>
                              <span>/ </span>
                              <?php endif; ?>
                              </li>
                              <?php endforeach; ?>
                              </ul>
                              </div>
                              <?php endif; ?>


                              edit above code in



                              app/design/frontend/[Your-theme]/[Your-package]/template/page/html/breadcrumbs.phtml





                              share|improve this answer















                              <?php if($crumbs && is_array($crumbs)): ?>
                              <div class="breadcrumbs">
                              <ul>
                              <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
                              <li class="<?php echo $_crumbName ?>">
                              <?php if($_crumbInfo['link']): ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
                              <?php elseif($_crumbInfo['last']): ?>
                              <?php // i have add link code here as below ?>
                              <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong></a>
                              <?php else: ?>
                              <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                              <?php endif; ?>
                              <?php if(!$_crumbInfo['last']): ?>
                              <span>/ </span>
                              <?php endif; ?>
                              </li>
                              <?php endforeach; ?>
                              </ul>
                              </div>
                              <?php endif; ?>


                              edit above code in



                              app/design/frontend/[Your-theme]/[Your-package]/template/page/html/breadcrumbs.phtml






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited May 7 '18 at 18:09









                              MagentoAaron

                              388115




                              388115










                              answered Sep 8 '15 at 10:27









                              Yogesh TrivediYogesh Trivedi

                              1,94711424




                              1,94711424












                              • typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                                – df2k2
                                Apr 15 '18 at 7:04











                              • yes breadcrums.phtml

                                – Yogesh Trivedi
                                Apr 24 '18 at 9:35

















                              • typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                                – df2k2
                                Apr 15 '18 at 7:04











                              • yes breadcrums.phtml

                                – Yogesh Trivedi
                                Apr 24 '18 at 9:35
















                              typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                              – df2k2
                              Apr 15 '18 at 7:04





                              typo: breadcrums.phtml -- breadcrumbs.phtml, yes?

                              – df2k2
                              Apr 15 '18 at 7:04













                              yes breadcrums.phtml

                              – Yogesh Trivedi
                              Apr 24 '18 at 9:35





                              yes breadcrums.phtml

                              – Yogesh Trivedi
                              Apr 24 '18 at 9:35

















                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f82283%2fbreadcrumbs-product-hyperlink%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                              Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                              How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2