Guest Posted June 13, 2004 Share Posted June 13, 2004 Maybe someone can help me here. It regards the header.php file, in particular the table row containing the code which makes up the 'my account', 'cart contents' and 'checkout' links. What I would like to do is to add a 'login' link here. However, just like the 'logoff' link which only appears if the sessions is registered: - <?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> I would like the 'logon' link to appear only if the session is not registered. Does anyone know how I would code this. I know how to insert it, but unsure about how to code it. Many thanks. I think that this would in fact be a great addition to osCommerce!!!!!!! Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2004 Share Posted June 13, 2004 <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 } else { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></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); ?>" 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> That is the whole line :) Matti Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2004 Share Posted June 13, 2004 Just as a suggestion, why not add this into the main release. It is a great addition...why have a logoff option and not a logon option? Great to have!!! Luke Ray Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2004 Share Posted June 13, 2004 I guess its because the 'My Account' link will redirect to the login page if the user is not logged in :) But, I have put it here as I am sure many would like a link that says 'login' Matti Link to comment Share on other sites More sharing options...
webslingers Posted June 15, 2004 Share Posted June 15, 2004 This is what I am looking for and it makes sense, but I'm not exactly sure where to put that code or if that is the whole code to add to the header file....? Link to comment Share on other sites More sharing options...
agiftcodotcom Posted June 15, 2004 Share Posted June 15, 2004 This is the code I am using. It will show "Log In" when not logged in, and it will show "Log Out | Account" when they are logged in. It will not show "account" when you are not logged in. <?php if (tep_session_is_registered('customer_id')) { echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class=headerbutton>Log Out</a> | <a href="account.php" class="headerbutton">Account</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_LOGIN) . '" class=headerbutton>Log In</a>'; } ?> Contributions I used : Updated 06-13-04 23:42 ---------------- Vote on My Graphis Poll Link to comment Share on other sites More sharing options...
webslingers Posted June 15, 2004 Share Posted June 15, 2004 I'm sorry for asking the same thing again, but do you just add that code to the header... or? Thanks Link to comment Share on other sites More sharing options...
agiftcodotcom Posted June 16, 2004 Share Posted June 16, 2004 I'm sorry for asking the same thing again, but do you just add that code to the header... or? Thanks Not a problem at all. If you are basically working from a stock header, look in includes/header.php and replace this... <td align="center" 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); ?>" 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> With this... <td align="center" class="headerNavigation"> <a href="index.php" class=headerbutton>Home</a> | <?php if (tep_session_is_registered('customer_id')) { echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class=headerbutton>Log Out</a> | <a href="account.php" class="headerbutton">Account</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_LOGIN) . '" class=headerbutton>Log In</a>'; } ?> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerbutton">Cart</a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerbutton">Checkout</a> </td> Now be careful, header.php has two navigational codes. Be sure you get the set that are text links "Account" devided by "|". Hope that makes sense. It's the second set of navigatinal codes. The first set are the top navigational images. Contributions I used : Updated 06-13-04 23:42 ---------------- Vote on My Graphis Poll Link to comment Share on other sites More sharing options...
webslingers Posted June 17, 2004 Share Posted June 17, 2004 Thank you very much, that was perfect. :D :D Link to comment Share on other sites More sharing options...
agiftcodotcom Posted June 17, 2004 Share Posted June 17, 2004 Glad to help. :) Contributions I used : Updated 06-13-04 23:42 ---------------- Vote on My Graphis Poll Link to comment Share on other sites More sharing options...
Tariq Posted September 25, 2004 Share Posted September 25, 2004 Question.. www.cherokeesoap.com/osCommerce I want to change the Login from the right colum to the Header, to the right of the banner, though with the Login contrib, I cannot seem to get it? I want to keep that type of setup, though I cannot get the "frame" around it to go away. Someone mentioned that there was a way to do that, though I have had NO luck, though have gotten sooooo close so many times. Without it having a stock setup for the shop anymore, its making it very difficult to get this done :( Any ideas??? One of these days, I will actually understand what I just changed... But reading the Manual DEFINATELY helps... Link to comment Share on other sites More sharing options...
yandus Posted January 20, 2005 Share Posted January 20, 2005 Just as a suggestion, why not add this into the main release. It is a great addition...why have a logoff option and not a logon option? Great to have!!! Luke Ray <{POST_SNAPBACK}> I was looking for a solution too. It might sound stupid but after reading this thread I realised i could simplify everything by simply changing the name 'My Account' into 'Login'. My shop is heavily modded and for the ones who want to use less codes this might be great(er) ? :-" Link to comment Share on other sites More sharing options...
the_other_mac Posted March 9, 2005 Share Posted March 9, 2005 <{POST_SNAPBACK}> Just an update to Eric's handy code above. There were a few personal customisations in there that may not suit everyone. This version sets it back to match the original localised code, right-aligned, SSL on appropriate links, original CSS class, and makes the code a bit more consistent if you need to modify further. It also removes the "home" link which isn't in the original ("home" is already in the default breadcrumb trail). Look for (beginning around line 64): <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); ?>" 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> Replace with: <td align="right" class="headerNavigation"> <?php if (tep_session_is_registered('customer_id')) { echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a> | <a href="account.php" class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_LOGIN) . '" class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>'; } echo '| <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '" class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a> '; echo '| <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="headerNavigation">' . HEADER_TITLE_CHECKOUT . '</a> '; ?> </td> ThaiGecko.com - wholesale Thai crafts Link to comment Share on other sites More sharing options...
roseoliveira1 Posted April 12, 2005 Share Posted April 12, 2005 Just an update to Eric's handy code above. There were a few personal customisations in there that may not suit everyone. This version sets it back to match the original localised code, right-aligned, SSL on appropriate links, original CSS class, and makes the code a bit more consistent if you need to modify further. It also removes the "home" link which isn't in the original ("home" is already in the default breadcrumb trail). Mac, thanks for the code - the only problem I have is that somehow for my store it doesn't seem to work :'( . I found the original code in the file and exchanged it for your code, but there does not seem to be any effect whatsoever. The same happens when I try Erics' code. Do you have any idea what the problem might be? I really want to change the text of those links in the header, "logon" is just much more intuitiv for somebody who is not yet logged on than "my account". Hope you can help me with this one, regards, Rose Link to comment Share on other sites More sharing options...
ramseyd2 Posted June 17, 2005 Share Posted June 17, 2005 i cannot find the relevant code to change it doesnt seem to be in includes/header??? Link to comment Share on other sites More sharing options...
samstone Posted August 11, 2005 Share Posted August 11, 2005 first ,like to say Hi, newbie at this stuff,but been doing a lot reg html and som JS and CFM I used above code works great except now the link to login ? should be SSL enabled? what to do add this to the line 'SSL' ???? else { echo '<a href="' . tep_href_link(FILENAME_LOGIN) . '" class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a>'; } Link to comment Share on other sites More sharing options...
yacpro13 Posted November 18, 2007 Share Posted November 18, 2007 Great Idea.....works like a charm! Thanks! Link to comment Share on other sites More sharing options...
bobi Posted November 20, 2007 Share Posted November 20, 2007 @ Tariq there is a Warning at you,r page , is that not security risk ?? Warning: I am able to write to the configuration file: /home/users/web/b212/pow.cherokeesoap/htdocs/osCommerce/includes/configure.php. This is a potential security risk - please set the right user permissions on this file. @ the_other_mac thanls for the code , does work great cheers bobi Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.