Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Create account and login to the header


Aragon127

Recommended Posts

You mean in the navigation bar?

 

If so, you can add this in front of the Log Off:

 

<?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>  |  ') : ''); ?>

 

This will disappear when on the login or create pages, as well as disappear after logged in.

Link to comment
Share on other sites

In /catalog/includes/header.php is the navigation bar.

 

It looks something like this:

 

  <tr class="headerNavigation">

   <td class="headerNavigation">  <?php echo $breadcrumb->trail(' » '); ?></td>

   <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

 </tr>

 

You want to change it to something like this:

 

    <td align="right" class="headerNavigation"><?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>  |  ') : ''); ?><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

 

NOTE: that is just the <td> portion of the part to be changed. :D

Link to comment
Share on other sites

  • 3 weeks later...

hi,

 

i added the code to header.php and it gave me additional link "login" on the naviagation bar :)

 

i want to do a little more :D

 

1)i would like to add one more link "create Account" on navigation when visitor is as "guest"

 

2)remove "My Account" when user is as "guest"

 

hoping for some help

 

thank you

Link to comment
Share on other sites

The idea of the create account link for a guest is fine, but sometimes that guest has an account and wants to go to My Account ... I think you might be better off with a create account link that shows when not logged in and disappears when logged in, and leave the My Account always there.

Link to comment
Share on other sites

thats true only when i dont have "login" link on the navigation

 

when user is as guest, the links on navigation should be

 

Create account

Login

Cart Contents

Checkout

 

when user logs in, then it should be

 

My Account

Logoff

Cart Containts

Checkout

 

possible?

 

thanks for reply

Link to comment
Share on other sites

if i always keep "my account" it will make 5 links on the navigation

 

1) Create Account

2) login

3) My Account

4) Cart Content

5) Checkout

 

if i remove "My Account" from guest page and "Create Account" from user page then it makes 4

 

i can remove "create Account" from the navigation but since i dont want to put the welcome mesg "welcome Guest..bla...bla" guest user wouldnt know where to create account

 

i need to go 3 level deep in categories which means that the path of the product and 5 links, it would make the navigation bar a mess

 

also, is there any contibution with the help of which i can add an additional menu on top of this navigation bar? i want that menu to highlight what page user is viewing, as yahoo and hotmail uses in inbox

 

thank you

Link to comment
Share on other sites

Another option is the loginbox that Audrey wrote for the right or left column.

 

You can also code this to not show on login/create account pages. It already appears/disappears based on if the customer is logged in.

 

This would eliminate the need for the Login on the navigation bar, as an alternative.

Link to comment
Share on other sites

Hi,

 

"Login/Create Account" wouldnt work as it doesnt reduce any character.

 

what linda sugessted makes sense.

 

i think rather then putting login box in column, i would put "My Account" just on top of "shopping Cart" in right hand column (as it always stays there) and put "Create Account" in navigation.

 

but how do this? any help with code?

 

thank you

Link to comment
Share on other sites

Hi,

 

i did changes as i wanted in navigation and it works, but being a PHP ignorant i dont know what i did with the code is okay or not...

 

can anyone compare and check please??

 

before it was

<td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

 

and now it is

 

<td align="right" class="headerNavigation"><?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>  |  ') : ''); ?><?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_CREATE_ACCOUNT) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_CREATE_ACCOUNT . '</a>  |  ') : ''); ?><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  | <?php } ?> <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

 

thank you

 

Hatim

Link to comment
Share on other sites

  • 4 years later...

I know this is from 2002, but I inserted the code in the box above and it gave me a cute little box, which is great, but I don't need the checkout or shopping bag part.

 

I also need to edit the text, but every time I touch the code, whether it be to change the order or edit whatever, the darn thing errors on me.

 

http://annispanties.com/shop

 

any ideas?

Link to comment
Share on other sites

got it. yessssssss, I love when something finally works.

 

I figured out I was deleting this extra portion between "create an account" and "shopping cart" becuase I thought the dividers where seperating the codes also.

 

 <?php } ?>

 

code is so fickle.

 

 

You can also try this code:

 

<td align="right" class="headerNavigation">

 

<?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>  |  ') : ''); ?>

 

<?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_CREATE_ACCOUNT) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_CREATE_ACCOUNT . '</a>  |  ') : ''); ?>

 

 

<?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?> <?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   

 

</td>

 

It is located in the header.php

Do or Do Not, there is no try.

Link to comment
Share on other sites

  • 2 weeks later...

I noticed this code change doesn't change any thing when using the Simple Template System. Dose any one have any idea's on why that is? What files must be edited instead when using STS?

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

  • 1 month later...
You can also try this code:

 

<td align="right" class="headerNavigation">

 

<?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>  |  ') : ''); ?>

 

<?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_CREATE_ACCOUNT) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_CREATE_ACCOUNT . '</a>  |  ') : ''); ?>

 

 

<?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?> <?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   

 

</td>

 

It is located in the header.php

 

 

 

Sweet. I just used the code and it worked for me as well....!

 

Thanks for sharing this !

Link to comment
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...