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

Compilation of a 2d array and a 1d array

Early programmable calculators with RS-232

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

How dangerous is XSS

Gauss' Posthumous Publications?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

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

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

Does int main() need a declaration on C++?

Why does freezing point matter when picking cooler ice packs?

What day is it again?

Can this transistor (2n2222) take 6V on emitter-base? Am I reading datasheet incorrectly?

Are British MPs missing the point, with these 'Indicative Votes'?

Calculate the Mean mean of two numbers

How do I keep Mac Emacs from trapping M-`?

Is it a bad idea to plug the other end of ESD strap to wall ground?

How to pronounce fünf in 45

Create custom note boxes

Is it reasonable to ask other researchers to send me their previous grant applications?

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

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

Why can't we say "I have been having a dog"?

Strange use of "whether ... than ..." in official text

"Eavesdropping" vs "Listen in on"



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 4 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 4 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 4 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 4 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

                              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

                              Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

                              Aasi (pallopeli) Navigointivalikko