Zen Cart Logo
Forums / Basic Configuration / Removing the "Home" link from breadcrumbs

Removing the "Home" link from breadcrumbs

Locked

Views: 10,199

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
11 May 2006, 4:17 PM
#1
cupcake avatar

cupcake

New Zenner

Join Date:
May 2006
Location:
Pacific Northwest (Canada Jr.)
Posts:
25
Plugin Contributions:
0

Removing the "Home" link from breadcrumbs

Hi again! I've previously posted as "Audra" but I lost access to my account with the board switch.

Anyway- I'm happily working my way through installing and customizing the new version of Zen Cart. Everything is going great! I'm excited to have such possibilities at hand.

I've been able to find a few of the issues I've had in new posts but haven't found an answer to this one yet! I found a few close ones in the archived messages, but not exactly what I'm looking for.

I'd like to remove just the "Home" and its following separator from the breadcrumbs. I attempted this by leaving the "Home" in english.php blank, but then I lose the "Home" link in the navigation bar. I want to keep the Nav Bar one.

Then I tried commenting out the home link in the breadcrumbs.php file

if ($this->_trail[$i]['title'] == HEADER_TITLE_CATALOG) {
		$trail_string .= '  <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . $this->_trail[$i]['title'] . '</a>';
        } else {
		$trail_string .= '  <a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>';
        }
      } else {
        $trail_string .= $this->_trail[$i]['title'];
      }

      if (($i+1) < $n) $trail_string .= $separator;
      $trail_string .= "\n";
    }

and I get this error:
Parse error: syntax error, unexpected T_ELSE in /home/.../includes/classes/breadcrumb.php on line 59

I'd just like to lose the home link in breadcrumbs. I don't want to disable breadcrumbs altogether. Any ideas where to do this? Please don't tell me it's in admin and I'm just missing it! :blush:

19 May 2006, 4:53 AM
#2
cupcake avatar

cupcake

New Zenner

Join Date:
May 2006
Location:
Pacific Northwest (Canada Jr.)
Posts:
25
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

Just checking in to see if there's an answer for this yet?

19 May 2006, 3:15 PM
#3
danielcor avatar

danielcor

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

This was easy enough for me to figure out, as I had just been looking at the file in question for a different purpose.

All you have to do is add the following code:

if ($this->_trail[$i]['title'] == 'Home')
{
continue;
}

prior to:

if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link']) && !$skip_link ) {

19 May 2006, 9:30 PM
#4
rotozuk avatar

rotozuk

New Zenner

Join Date:
Apr 2006
Posts:
27
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

Yep, works like a charm!

20 May 2006, 3:42 PM
#5
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Removing the "Home" link from breadcrumbs

or you could do it in includes -> templates -> YOURTEMPLATE -> common -> tpl_main_page.php and not play around with the Core Code

just add

<!-- bof  breadcrumb -->
<?php if (DEFINE_BREADCRUMB_STATUS == '1' && ($current_page!='index' || (int)$cPath>0 )) { ?>    <div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
<?php } ?>
<!-- eof breadcrumb -->
20 May 2006, 3:47 PM
#6
danielcor avatar

danielcor

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

clydejones:

or you could do it in includes -> templates -> YOURTEMPLATE -> common -> tpl_main_page.php and not play around with the Core Code

just add

<!-- bof breadcrumb --> <?php if (DEFINE_BREADCRUMB_STATUS == '1' && ($current_page!='index' || (int)$cPath>0 )) { ?> <div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div> <?php } ?> <!-- eof breadcrumb -->

While I am all for not modifying core files....    This recommendation doesn't do what is being asked.   Your code removes the breadcrumbs completely under certain conditions.
21 May 2006, 3:46 PM
#7
cupcake avatar

cupcake

New Zenner

Join Date:
May 2006
Location:
Pacific Northwest (Canada Jr.)
Posts:
25
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

Thank you! It worked perfectly! Exactly what I needed. :)

I really appreciate your help!

ETA: I also try not to edit core when and where I can avoid it, but I clicked through every Admin option I could think of, and didn't see any easy way in the template overrides system to do this.

21 May 2006, 4:30 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Removing the "Home" link from breadcrumbs

The "right" way to remove just the "Home" link from the breadcrumbs is this:

  1. copy /includes/init_includes/init_add_crumbs.php to the includes/init_includes/overrides folder.

  2. Edit includes/init_includes/overrides/init_add_crumbs.php
    You simply need to comment-out line 15, like this:```php
    //$breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT));


Thus no need to hack core files !
26 Aug 2008, 8:18 PM
#9
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

Still a good answer this "overrides" version. Thanks a lot!

21 Mar 2009, 12:55 AM
#10
edwardtilbury avatar

edwardtilbury

Zen Follower

Join Date:
Sep 2007
Posts:
169
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

DrByte = clean answer!

I didn't feel too save not using the override system, thanks for the answer, worked perfectly!

22 Mar 2009, 3:58 PM
#11
ianbailie avatar

ianbailie

New Zenner

Join Date:
Mar 2009
Posts:
4
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

Was just reading through this thread as I was wanting to do the same thing and I came up with the following solution. In the line that Dr. Byte recommended commenting out above, I changed it to read

$breadcrumb->add('Shop', zen_href_link(FILENAME_DEFAULT));

So that it reads shop, not home. I also added a new line above it as follows:

$breadcrumb->add('Home', 'http://www.example.com');

Which means my breadcrumb now has Home :: Shop - both linking to the right place :clap:

6 May 2010, 3:53 PM
#12
corditreasures avatar

corditreasures

Zen Follower

Join Date:
Jan 2010
Posts:
141
Plugin Contributions:
0

Re: Removing the "Home" link from breadcrumbs

when i commented out the code the bar resized to a thin line so i deleted the override but when i read post by ianbailie i think its a good ideo not to remove it but change it. Thanks!

6 May 2010, 5:28 PM
#13
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Removing the "Home" link from breadcrumbs

corditreasures:

when i commented out the code the bar resized to a thin line so i deleted the override but when i read post by ianbailie i think its a good ideo not to remove it but change it. Thanks!Depends on what you are trying to do.. ianbailie's solution is a tad off topic for this post since the OP wanted to know how to REMOVE the "Home" link altogether (for which DrBye posted a solution). ianbailie's solution tells you how to CHANGE the "Home" link text to read something else.. (symantics perhaps, but a HUGE difference)