Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Removing "my account" from navigation


mazza

Recommended Posts

"My account" link in head navigation is not too useful for first time visitors and people just browsing the selection. So here is a way to hide it when visitor is not logged in.

 

In includes/header.php, change:

 

<a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> 

      | 

 

To:

 

      <?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

 }

?>

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

Another way of doing it is by replacing the values with those relevant to the status of your login.

 

Whilst you're not logged in, it will show; 'Login' 'Create Account'

After login, those values will change to; 'Logout' 'My Account'

 

The code below also goes in catalogincludesheader.php.

Note that it is all one line of code, so you may need to put it back together as one line if you do a cut and paste.

 

<?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>  |  <a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> <?php }

           else { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CREATE_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>   

"The price of success is perseverance. The price of failure comes much cheaper."

Link to comment
Share on other sites

Does anybody know how to hide the checkout link from top navigation if there are no products in the cart ? I tried this but it did not work:

 

<?php

 if ($cart->count_contents() < 0) {



 } else {

echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL');

 }

?>

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

  • 2 weeks later...

This is what I am currently using...

<?php if (tep_session_is_registered('customer_id')) { ?><?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> | <a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> <?php } else { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CREATE_ACCOUNT; ?></a><?php } ?>   

...however, the Log Off and My Account only show when logged in. It does not show Log In or Create An Account when not logged in. What is wrong with my code?

 

Also, I noticed that this line...

<?php if (tep_session_is_registered('customer_id')) { ?>

...is repeated twice at the beginning. When I delete one or the other, it gives me a Parse Error. Could you explain why it might be doing this? I don't understand why it needs the same code twice.

Link to comment
Share on other sites

  • 1 month later...
Does anybody know how to hide the checkout link from top navigation if there are no products in the cart ? I tried this but it did not work:

 

<?php

 if ($cart->count_contents() < 0) {



 } else {

echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL');

 }

?>

 

This is my code, works fine for me. Regards. Antonio,

 

<?php if ($cart->count_contents() > 0) { ?><a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...