mazza Posted January 10, 2003 Share Posted January 10, 2003 "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 More sharing options...
TB Posted January 10, 2003 Share Posted January 10, 2003 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 More sharing options...
mazza Posted January 10, 2003 Author Share Posted January 10, 2003 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 More sharing options...
toolcrazy Posted January 12, 2003 Share Posted January 12, 2003 if ( $cart->count_contents() > 0 ) { require(DIR_WS_BOXES . 'shopping_cart.php'); } In colums_right.php Thank you Linda. Steve ------------------------- Link to comment Share on other sites More sharing options...
burt Posted January 12, 2003 Share Posted January 12, 2003 <?php if ($cart->count_contents() != 0) { echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); } ?> Link to comment Share on other sites More sharing options...
mazza Posted January 12, 2003 Author Share Posted January 12, 2003 Works great, thanks guys. "Use no way as way, have no limitation as limitation." - Bruce Lee Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 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 More sharing options...
anadal Posted February 27, 2003 Share Posted February 27, 2003 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.