Zen Cart Logo
Forums / Addon Templates / Remove/edit items in nav bar

Remove/edit items in nav bar

Views: 3,358

Results 1 to 20 of 22
16 Feb 2013, 10:35 PM
#1
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Remove/edit items in nav bar

I am using the template Emeralda on my site (http://www.livingtowers.com/coopstore) and I would like to edit or remove some of the options in the nav bar along the top. Right now you'll see there is Home - New Products - Specials - Featured Products - My Account. Where can I a) change these titles and b) change the page it goes to when you click it.

Thanks to EVERYONE for their help so far. The store has been running now for a little over a week and is doing exactly what I want it too. I have one or two small modules to install but it is almost complete!

17 Feb 2013, 11:39 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Remove/edit items in nav bar

If this is similar to other templates by 12leaves, then the header navigation elements are in:

includes/templates/emerelda/templates/tpl_top_nav.php

18 Feb 2013, 3:26 AM
#3
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Sadly that file doesn't exist. Any other suggestions?

18 Feb 2013, 3:48 AM
#4
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

Use the Developers Toolkit to search for: header_bar_ls_active

I found that by looking at the raw HTML "source" of your page (I used Firebug in Firefox, but Chrome/Safari have an "Inspect" option as well) and seeing what div your menu is contained in. Chances are you'll find that id mentioned in your templates, thus it'll be something that'll show up by searching for it.

18 Feb 2013, 5:03 AM
#5
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Thanks! HTML and CSS are still very new to me but I will search for that and attempt to edit in the morning.

18 Feb 2013, 12:38 PM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Remove/edit items in nav bar

The menu bar is in:

includes/templates/emeralda/common/tpl_header.php .

The code that is relevant is:-

<!--bof-header navigation bar display-->
<div id="header_bar">
	<div id="header_bar_ls<?php if ($this_is_home_page) { ?>_active<?php } ?>"><a href="<?php echo HTTP_SERVER . DIR_WS_CATALOG; ?>"><?php echo HEADER_TITLE_CATALOG; ?></a></div>
	<ul id="nav_bar_content">
		<li><?php echo zen_image($template->get_template_dir('nav_delim.gif', DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'nav_delim.gif', ''); ?></li>
		<?php
		if ($current_page_base == 'products_new') $products_new_page='item_active'; else $products_new_page = 'products_new';
		if ($current_page_base == 'specials') $specials_page = 'item_active';  else $specials_page = 'products_specials';
		if ($current_page_base == 'featured_products') $featured_products_page = 'item_active'; else $featured_products_page='products_featured';
		
		if ($current_page_base == 'account' || $current_page_base == 'login' || $current_page_base == 'account_edit' || $current_page_base == 'address_book' || $current_page_base == 'account_password' || $current_page_base == 'account_newsletters' || $current_page_base == 'account_notifications') $account_page = 'item_active'; else $account_page = 'account';
		?>
				<li id="<?php echo $products_new_page;?>"><a href="index.php?main_page=products_new"><?php echo HEADER_NEW_PRODUCTS;?></a></li>

				<li><?php echo zen_image($template->get_template_dir('nav_delim.gif', DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'nav_delim.gif', ''); ?></li>

				<li id="<?php echo $specials_page;?>"><a href="index.php?main_page=specials"><?php echo HEADER_SPECIALS;?></a></li>

				<li><?php echo zen_image($template->get_template_dir('nav_delim.gif', DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'nav_delim.gif', ''); ?></li>

				<li id="<?php echo $featured_products_page;?>"><a href="index.php?main_page=featured_products"><?php echo HEADER_FEATURED_PRODUCTS;?></a></li>

				<li><?php echo zen_image($template->get_template_dir('nav_delim.gif', DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'nav_delim.gif', ''); ?></li>

				<li id="<?php echo $account_page;?>"><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_MY_ACCOUNT;?></a></li>
	</ul>
	<div id="header_bar_rs"></div>

	<div id="navMainSearch">
		<?php
		  $content = "";
		  $content .= zen_draw_form('quick_find_header', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');
		  $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
		  $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();

		  $content .= '<input class="button-search-header float-left" type="image" src="' . $template->get_template_dir('', DIR_WS_TEMPLATE, $current_page_base,'images') . '/search_button.png' . '" value="Search" /><div class="input_div">'. zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 142px" class="search_input" value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"').'</div>';
		  $content .= "</form>";
		  echo($content);
		?>
	</div>
</div>
<!--eof-header navigation bar display-->
5 Mar 2013, 8:46 PM
#7
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

If I wanted to change the text from "Specials" to "Household" what would I need to change?

Am I right in assuming that I replace the bold text below with the URL to Household page?

<li id="<?php echo $specials_page;?>"><a href="**index.php?main_page=specials**"><?php echo HEADER_SPECIALS;?></a></li>
5 Mar 2013, 10:20 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

DeeL:

If I wanted to change the text from "Specials" to "Household" what would I need to change?

Am I right in assuming that I replace the bold text below with the URL to Household page?

<li id="<?php echo $specials_page;?>"><a href="**index.php?main_page=specials**"><?php echo HEADER_SPECIALS;?></a></li>

No. You would find the definition for HEADER_SPECIALS in your language files, and update that text there.

6 Mar 2013, 2:36 AM
#9
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Thanks. I apologize now for not getting this, it's all still very new to me but I am trying to learn! I found the file and have successfully changed the text that appears in the nav bar (in admin.../includes/languages/emeralda/english.php._ However I am not sure what I need to change to change the page it goes to when it is clicked.

Below are the locations "HEADER_SPECIALS" appears.

/home/content/78/10039978/html/coopstore/adminu.../includes/languages/emeralda/english.php

Line #47 : define('HEADER_SPECIALS', 'Fruit');

/home/content/78/10039978/html/coopstore/adminu.../includes/templates/emeralda/common/tpl_header.php

Line #172 : <li id="<?php echo $specials_page;?>"><a href="index.php?main_page=specials"><?php echo HEADER_SPECIALS;?></a></li>

/home/content/78/10039978/html/coopstore/includes/languages/abby_template/english.php

Line #47 : define('HEADER_SPECIALS', 'Specials');

/home/content/78/10039978/html/coopstore/includes/languages/emeralda/english.php

Line #47 : define('HEADER_SPECIALS', 'Specials');

/home/content/78/10039978/html/coopstore/includes/templates/abby_template/common/tpl_header.php

Line #172 : <li id="<?php echo $specials_page;?>"><a href="index.php?main_page=specials"><?php echo HEADER_SPECIALS;?></a></li>

/home/content/78/10039978/html/coopstore/includes/templates/emeralda/common/tpl_header.php

Line #172 : <li id="<?php echo $specials_page;?>"><a href="index.php?main_page=specials"><?php echo HEADER_SPECIALS;?></a></li>

6 Mar 2013, 3:38 AM
#10
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

DeeL:

If I wanted to change the text from "Specials" to "Household" what would I need to change?

Am I right in assuming that I replace the bold text below with the URL to Household page?

<li id="<?php echo $specials_page;?>"><a href="**index.php?main_page=specials**"><?php echo HEADER_SPECIALS;?></a></li>

If your goal is to change the displayed text on the clickable link as seen by the customer from saying "Specials" (note the uppercase S ) to "Household" then no, you wouldn't touch the main_page=specials part, because all you indicated you wanted to change was the text displayed to the customer.
Since the text displayed to the customer is the part where <?php echo HEADER_SPECIALS; ?> is found, that means all you need to change is the language definition for HEADER_SPECIALS in the language file.

Now, if you're actually after something completely different such as adding a bunch of links to pages that don't already have names in Zen Cart, then the answer is very different because the question is actually different.

Can you please clarify what you're actually wanting to do?

6 Mar 2013, 3:46 AM
#11
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Sorry for not being clear enough. Reading back through a post a made earlier I missed a point. I want to change the text shown in the nav bar (ie from Specials to Household for example) and also change the URL that they go to when they click on it (this I didn't really explain too well before). I just want it to go to a page that already exists (either an existing category or an EZ Page).

6 Mar 2013, 4:11 AM
#12
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

The format of a link is:
<a href="PUT THE URL HERE">text to click on here</a>

So, make whatever change you need in your template to accomplish that end result.

For the "PUT THE URL HERE", put in the URL to the page you want them to go to.
If your site is truly unilingual then just type in the actual "text to click on here" instead of adding the advanced support for multiple languages.

15 Mar 2013, 11:04 PM
#13
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Thanks for your help. I have figured out how to amend the header in the bar and the target URL. How difficult is it to add a new item to the Nav bar?

15 Mar 2013, 11:32 PM
#14
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

Judging from the tpl_header.php code you posted earlier, it's as simple as adding another item:```

<li><a href="URL">Text To Click On</a></li> ```
16 Mar 2013, 12:09 AM
#15
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

One of the existing 'Headers' there right now had this as the code in the tpl_header.php file

<li id="<?php echo $products_new_page;?>"><a href="index.php?main_page=products_new"><?php echo HEADER_NEW_PRODUCTS;?></a></li>

If I add what you suggested where do I add the rest of the code, and what syntax, to get the header I want to appear on the bar?

<li><a href="URL">Text To Click On</a></li>

If I wanted to add another header that says "Seedlings" what code do I need to copy and amend in what files?

16 Mar 2013, 12:24 AM
#16
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

Same file. Add it immediately before or after the one you quoted.

<li><a href="whatever the URL is to your seedlings page">Seedlings</a></li>

You don't need to use any PHP like <?php echo HEADER_SOMETHING_SOMETHING;?> if you're not needing to make your page multilanguage-friendly. So, in my example that's why I just said "Seedlings" instead of adding any PHP at all.

16 Mar 2013, 1:11 AM
#17
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

Oh great. There's me making things way more complicated than they are. Will give it a go! :) Thanks as always! I appreciate you helping me.

16 Mar 2013, 1:17 AM
#18
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Remove/edit items in nav bar

I tried that. It didn't work. I added the following but it didn't add another heading in the nav bar.

<li><a href="index.php?main_page=index&cPath=17">Seedlings</a></li>
16 Mar 2013, 7:04 AM
#19
drbyte avatar

drbyte

Sensei

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

Re: Remove/edit items in nav bar

Did you perhaps change the wrong tpl_header.php file? Your changes need to be in the one that's in the folder which contains the template you've got active on your site.

20 Mar 2013, 12:24 AM
#20
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Remove/edit items in nav bar

The <li> tags are given an ID (which is parsed into the tag depending on whether it is active or idle.)

It MIGHT be that the visibility / position of the <li> is governed by CSS... (The fact that the template author has gone to the trouble of assigning an ID suggests this may be the case.)

So you MIGHT need to add an ID to your <li> tag, then see what CSS is controlling the other <li> tags, and write a declaration that mimics their behaviour.