Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do you add a Logout button up top?


Guest

Recommended Posts

Just wondering if someone would be able to tell me how to add a logoff button next to the Account | Cart | Checkout image buttons, that will show only when the user is logged in.

Link to comment
Share on other sites

<?php
if (tep_session_is_registered('customer_id'))
{ ?>
<?php echo'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'log_off.gif', 'Click here to log out', '76', '19') . '</a>'?>
<?php 
} else {
?>
<?php echo'<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'login.gif', 'Click here to login', '56', '19') . '</a>' ?>
<?php echo'<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'heading_sub/l.gif', 'Click here to Sign up', '76', '19') . '</a>' ?>
<?php 
} 
?>

Link to comment
Share on other sites

Ok, let's try that one again. Here is the existing code I have for the buttons.

<?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>

 

Now this is roughly how I thouht it would go:

<?php
if (tep_session_is_registered('customer_id'))
{ ?>
<?php echo'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'log_off.gif', 'Click here to log out', '76', '19') . '</a>' <a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>?>
<?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>   ?>
<?php echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>   ?>
<?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>
<?php 
} else {
?>
<?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>

<?php 
} 
?>

 

But when I have it like that, the cart does not like it.

Link to comment
Share on other sites

Even thought just the following before the other images may have got it to work:

<?php if (tep_session_is_registered('customer_id')) { ?><?php echo'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'log_off.gif', 'Click here to log out', '76', '19') . '</a>'?>

 

Any other thoughts?

Link to comment
Share on other sites

<?php
if (tep_session_is_registered('customer_id'))
{ ?>
<?php echo'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'log_off.gif', 'Click here to log out', '76', '19') . '</a><a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'?>
<?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  ' ?>
<?php echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>   '?>
<?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>
<?php 
} else {
?>
<?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>

<?php 
} 
?>

Link to comment
Share on other sites

You will have to ignore my "HEADER_TITLE_CART_CHECKOUT" tags etc, as I have these defined in catalog/includes/language/english.php

 

But you get the idea.

Link to comment
Share on other sites

Thanks for your help Stu, I think we ended up with similar code. Below is what I have got now:

<?php
if (tep_session_is_registered('customer_id'))
{ ?>
<?php echo'<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'log_off.gif', 'Click here to log out', '55', '62') . '</a>'?>
<?php echo'<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', 'Your Account', '55', '62') . '</a>'?>
<?php echo'<a href="' . tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', 'View Cart', '55', '62') . '</a>'?>
<?php echo'<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', 'Click here to Checkout', '55', '62') . '</a>'?>

<?php 
} else {
?>
<?php echo'<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', 'Click here to login', '55', '62') . '</a>' ?>
<?php echo'<a href="' . tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', 'View Cart', '55', '62') . '</a>'?>
<?php echo'<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', 'Click here to Checkout', '55', '62') . '</a>'?>
<?php 
} 
?>

 

Works like a treat, people can try it at http://www.fishing-gear.co.nz

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...