If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Header Nav Code Modification

Header Nav Code Modification

Locked

Started by mattys on 18 Oct 2006, 4:16 PM · Views: 3,073

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
18 Oct 2006, 4:16 PM
#1
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Header Nav Code Modification

Hello

I am working on my site, it is here http://www.sorce.co.uk/logo-golf-balls/

I would like all the nav links, like 'log on', 'my account', 'shopping cart', 'checkout', etc., to show, even though you may not have added anything to basket, for example.

Can anyone advise which code in tpl_header.php to alter to achieve this?

Help very much appreciated!

18 Oct 2006, 4:54 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Header Nav Code Modification

First insure that you are using the overrides, or make a copy of the tpl_header.php file in the event this does not work.

In this file, in the or under <!--bof-navigation display--> the first "if" or about 5 lines below the bof is this line:

<?php if ($_SESSION['customer_id']) { ?>

and comment this out or remove it. This should display the li's without checking if a session is active

Zen-Venom Get Bitten

18 Oct 2006, 6:54 PM
#3
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

Hey Kobra

Thanks for getting back to me.

I took the <?php // if ($_SESSION['customer_id']) { ?> line out from tpl_header.php, uploaded, but now shows an error page:

Parse error: parse error, unexpected '}' in c:\domains\sorce.co.uk\wwwroot\logo-golf-balls\includes\templates\arch_shoppe\common\tpl_header.php on line 114

Any ideas?

Another realted question: How do i center this header nav? I can't seem to locate the correct bit of css to do this

18 Oct 2006, 7:19 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Header Nav Code Modification

Sorry that did not work....I only "hack" at php and why I cautioned to make copies.

Centering the header nav?? We discussing the nav bar or the text contained within it?

Zen-Venom Get Bitten

18 Oct 2006, 7:26 PM
#5
clydejones avatar

clydejones

Deceased

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

Re: Header Nav Code Modification

Since that line of code is part of an "if/else" statement, just removing the one line will generate the error you are getting.

You'll need to change the whole section as follows:

<?php if ($_SESSION['customer_id']) { ?> /* delete this line */
    <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 { /* delete this line */
        if (STORE_STATUS == '0') {
?> /* delete this line */
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?> /* delete the highlighted character */

<?php if ($_SESSION['cart']->count_contents() != 0) { ?> /* delete this line */
    <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 }?> /* delete this line */

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

18 Oct 2006, 8:00 PM
#6
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

No worries, I am much like yourself, a bit of a hacker, but i really appreciate your input.

Its the same text links that i am trying to work with here - i am just thinking that if i CAN'T show all links (but i'm sure there must be a way somehow, there has to be!?) the links that are there would look better centre aligned.

See what i mean?

18 Oct 2006, 8:03 PM
#7
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

hey clydejones

i thought that might be the case

i will give it a go and report back

18 Oct 2006, 8:36 PM
#8
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

Thanks Clyde

That worked.

The only bit i had problems with was this bit, line 7 (before code is deleted):

?> /* delete this line */

When i uploaded the modified code, I got an error, some kind of parse problem and a mention of a missing ```


So, i just put that bit of code back and it seems to be working, all links are now displayed.

I hope this is ok and doesn't casue any problems down the line.

Cheers for all the help, things seem to be going fairly well, nice bit of kit!
18 Oct 2006, 8:52 PM
#9
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

still stumped on how to now centre the links

i added text-align centre to the code below but still not centering

#navMainWrapper, #navSuppWrapper, #navCatTabsWrapper {
	margin: 0em;
	background-color: #FFFFFF;
	font-weight: bold;
	color: #F5F4C5;
	height: 1%;
	}
18 Oct 2006, 9:29 PM
#10
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

ok, centered

i found:

.back {
	float: none;
	}

and:

#navMain ul, #navSupp ul, #navCatTabs ul {
	margin: 0;
	padding: 0em;
	list-style-type: none;
	text-align: center;
	}

in stylesheet.css

and changed to what they are as shown above

.back is the class added to the <ul>:

<ul class="back">

This had a 'left float' on it, so i changed it 'none'. This then freed up #navMain, so i added a text-align:center to that and it worked.

I'm not sure what the long term affects will be by changing the .back class, in stylesheet.css, from float: left, to float: none, will have to wait and see

18 Oct 2006, 9:47 PM
#11
clydejones avatar

clydejones

Deceased

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

Re: Header Nav Code Modification

That "back" declaration is used by several other tpl files so I'd redo it in your stylesheet and just delete

class="back" from the ul in your tpl_header.php file.

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

18 Oct 2006, 10:09 PM
#12
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Header Nav Code Modification

sorted, sound advice, cheers