Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Adding a link to the task bar

Adding a link to the task bar

Locked

Views: 4,259

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
28 Aug 2006, 8:43 PM
#1
chrisj avatar

chrisj

Zen Follower

Join Date:
Aug 2006
Posts:
104
Plugin Contributions:
0

Adding a link to the task bar

At the top of the Index page there is a task bar that shows "Home" and "Log In".

How/where can I go to add a link before the word "Home". Which file, please. Thanks.

28 Aug 2006, 9:41 PM
#2
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Adding a link to the task bar

Its inside /includes/your-template/common/tpl_header.php

you can add link inside the navMain div box line 44 (before the Home link);

<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li> insert your link here </li>
    ...

Just be sure that not to add too may links, otherwise the div box will explode.

29 Aug 2006, 1:46 AM
#3
chrisj avatar

chrisj

Zen Follower

Join Date:
Aug 2006
Posts:
104
Plugin Contributions:
0

Re: Adding a link to the task bar

Wellll, I tried to add the code and it didn't work, so I tried to undo it, and now my index page is all messed up.

I believe I need a new copy of common/tpl_header.php sent to me.

Can someone attach this file to a Private Message to me, please? thanks.

Or give me a suggestion.

29 Aug 2006, 2:34 AM
#4
corrado444 avatar

corrado444

New Zenner

Join Date:
Aug 2006
Posts:
20
Plugin Contributions:
0

Re: Adding a link to the task bar

Take the file from the original installation

29 Aug 2006, 4:06 AM
#5
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Adding a link to the task bar

How did you add the code, it should be inside php syntax,

example:

link to internal page, example 'Specials' page:

<li><a href="<?php echo zen_href_link('specials')?>">Specials</a></li>

link to external page, example 'Google':

<li><a href="<?php echo 'http://www.google.com'?>">Google</a></li>

Make sure you always create 'override' template folder and files when you work on any template files modification, so that if something goes wrong, you just remove the 'override' files and the original file at work again.

By this method no matter how you do the modification and make 'mistakes' you have nothing to worry about. The original files still safe, leave it untouch.

Check here for first step in customizing your site

http://www.zen-cart.com/forum/showthread.php?t=36567

29 Aug 2006, 1:07 PM
#6
chrisj avatar

chrisj

Zen Follower

Join Date:
Aug 2006
Posts:
104
Plugin Contributions:
0

Re: Adding a link to the task bar

Thank you for your assistance. However, I have several questions.

First of all you stated it's inside
" /includes/your-template/common/tpl_header.php".

I have classicx template. I only see the common file at
" /includes/classic/common/tpl_header.php

Are you saying I should have
"/includes/classicx/common/tpl_header.php" ?

Because I don't have that.
If I should have that , how do I add it?

Secondly, you stated "you can add link inside the navMain div box line 44 (before the Home link)" and then you show this:

<div id="navMainWrapper"> <div id="navMain"> <ul class="back"> <li> insert your link here </li> ...

Are you showing me all the code I need to add? Or are you showing me what line 44 show look like and I just add <li>insert link here</li> ?

Because line 44 in the tpl_header.php file looks like this:

<td align="right" valign="top" width="35%" class="headerNavigation">

You stated "(before the Home link)". I don't see the Home link.

Should I add the following code:

"<div id="navMainWrapper">

<div id="navMain"> <ul class="back"> <li> insert your link here </li> ... "

after this line:

<td align="right" valign="top" width="35%" class="headerNavigation"> ?

I appreciate your assistance, but it really wasn't that clear to me.

Thanks in advance for your reply and clarification.

29 Aug 2006, 3:49 PM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding a link to the task bar

Copy tpl_header.php from /template_default/common/ to /classicx/common/ .

Line numbers are often unreliable; your link code should go on a new line after the "<ul class="back">":

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?>

("HEADER_TITLE_CATALOG" will dsiplay in your site header as "Home" or whatever you set it to.)

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li>your code</li>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?>

and follow instructions above on php coding.

29 Aug 2006, 3:56 PM
#8
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Adding a link to the task bar

First of all you need to create an 'override' folder and files, so leave the folder /classic/ or /template_default/ untouch. The basic of work is better from /template_default/ not from /classic/

Step 1:
Create a brand new folder example -> /mytemplate/
so there will be new folder at /includes/templates/mytemplate/

Step 2:
Create its subfolders such as -> mytemplate/common/
mytemplate/css/ and mytemplate/images/
these subfolders are the clone of the original subfolders from /template_default/

Step 3:
copy all the files that you want to change from /template_default/, in this case tpl_header.php from /template_default/common/tpl_header.php to /mytemplate/common/tpl_header.php

Those step above are basic step in creating override folder & files, it applies to every files that you want to CHANGE, just grab the copy from /template_default/ and paste it in /mytemplate/, and start work on that copied files. No need to copy file that you dont want to change.

By this method you leave the original files untouch and ZenCart will detect any override files and process it instead.

Now you can work on the files you just copied, inthis case -> tpl_header.php from the brand new folder /mytemplate/common/

If you copy correctly from /template_default/ you will see tpl_header.php line 44 will start like below, I copy the entire Header Navigation Div box and insert the 'specials' link that we want to put there.

<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
    <ul class="back">
    <li><a href="<?php echo zen_href_link('specials')?>">Specials</a></li>
<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>
</ul>
</div>
<div class="navMainSearch forward"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
<br class="clearBoth" />
</div>

If you see below the 'special' link that we just inserted, there is HEADER_TITLE_CATALOG which means 'Home'

So in your header will look something like this

Special Home Login

'specials' menas it will link to this page:

http://www.yourdomain.com/index.php?main_page=specials

If you want to change the link 'special' to another page/products, simply mouseover or go to any page and see the link that pointed there in your browser address,

example the privacy page:

http://www.yourdomain.com/index.php?main_page=privacy

so you can replace to ```php

<li><a href="<?php echo zen_href_link('privacy')?>">Privacy</a></li> ``` to make link to Privacy page for an example.

Hope this helps, please update your progress

29 Aug 2006, 4:22 PM
#9
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Adding a link to the task bar

WARNING !!!!

when you copy/paste links from your cart please remember that if the link contains the zenid to NOT paste it into your new code.

If you use a URL with a zenid= into a hard coded link you are going to have a TON of pissed customers with lots of errors in your orders such as customer orders sent to the wrong account - logins going to the wrong accounts, etc.

29 Aug 2006, 7:29 PM
#10
chrisj avatar

chrisj

Zen Follower

Join Date:
Aug 2006
Posts:
104
Plugin Contributions:
0

Re: Adding a link to the task bar

Thanks so much for taking the time to assist me. Really appreciate the clarification.

I created a new template folder and sub-folder common, and copied tpl_header.php into it.

However, when I added <li><a href="<?php echo 'http://www.mywebhomepage.com'?>">Home</a></li>

and Refreshed the main Zen page, it didn't appear. So I added that line to template_default and now it appears. I don't know why, but I've accomplished what I set out to do.

Thanks again.

30 Aug 2006, 12:34 AM
#11
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Adding a link to the task bar

editedt: sorry double post

30 Aug 2006, 12:35 AM
#12
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Adding a link to the task bar

It means your custom template not active yet.

The one being active now is still template_default, that's why ZenCart always call the files from inside it.

To activate your custom template go to Tools -> Template selection -> click the custom folder you just created.

After that any changes you made from your custom-template will reflect directly in your ZenCart appearance.

17 Jan 2007, 3:47 AM
#13
ericny avatar

ericny

Zen Follower

Join Date:
Jan 2007
Posts:
100
Plugin Contributions:
0

Re: Adding a link to the task bar

Thank you to everyone for their suggestions above on adding regular pages to the header.

However, how do i go about adding an EZ page link to the header. For example I created About Us page as an easy page and would like to have a link to it show up after Home and Log In.
Thank you