Forums / Managing Customers and Orders / Changing link from "login" (when not logged in) to "my account" (when logged in)

Changing link from "login" (when not logged in) to "my account" (when logged in)

Locked

Started by safeg on 29 Sep 2009, 10:00 AM · Views: 3,413

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
29 Sep 2009, 10:00 AM
#1
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Changing link from "login" (when not logged in) to "my account" (when logged in)

Hi there

What is the solution to have a 2 deffirent links that change when you are logged or not logged in? ie. When the new customer come to the website there is link - LOGIN. With this link he can create an account and do shopping on the website.

The problem is I would love to have this link to change to MY ACCOUNT, after customer log in.

Anyone know the solution?
Thank you

here is the link to the shop:
http://www.millers-graphics.co.uk

Lukas

29 Sep 2009, 11:01 AM
#2
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

im pretty sure it does anyway.......when someone is logged in it changes to Log Out, and My Account will also appear.

Have done a test account yourself?

29 Sep 2009, 11:14 AM
#3
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Ooba_Scott:

im pretty sure it does anyway.......when someone is logged in it changes to Log Out, and My Account will also appear.

Have done a test account yourself?

Yes. It's still the same when I am logged in or off. Any suggestions?
Thank for the respons :smile:

Lukas

29 Sep 2009, 11:22 AM
#4
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

The links are in the sidebox INFORMATION - tpl_information

Lukas

29 Sep 2009, 11:24 AM
#5
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

hmm have you changed anything in the tpl_header.php file? (your template - common)

As in here about line 80 ( <!-- bof navigation display -->) this is where the logic is to switch between login, log out, my account

....maybe you have accidnelty changed abit of this without noticing?

29 Sep 2009, 11:26 AM
#6
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Thats probaly the reason why they are not changing, as it isnt to do with the header file ( sorry u must have been typing when i was)

You should be able to add that logic from the header file into the sidebox information file, where the login link is

29 Sep 2009, 11:30 AM
#7
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

I'll give it a try. Thanks :smile:

Lukas

29 Sep 2009, 11:41 AM
#8
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Yupi! :laugh:

Works so far, but still its not in a place. Here is the code:

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_information.php 2982 2006-02-07 07:56:41Z birdbrain $ */ $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; $content .= "\n" . '<ul style="margin: 0; padding: 0; list-style-type: none;">' . "\n"; $content .= '<li>- <a href="/">Home</a></li>' . "\n"; $content .= '<li>- <a href="http://www.millers-graphics.co.uk/index.php?main_page=page_3">About Us</a></li>' . "\n"; ?> <?php if ($_SESSION['customer_id']) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
<li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php } else { if (STORE_STATUS == '0') { ?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?> <?PHP for ($i=0; $i<sizeof($information); $i++) { $content .= '<li>- ' . $information[$i] . '</li>' . "\n"; } $content .= '<li>- <a href="http://www.millers-graphics.co.uk/index.php?main_page=page_2">How To Find Us</a></li>' . "\n"; $content .= '</ul>' . "\n"; $content .= '</div>'; ?>

Could you help to sort it out? Thanks :smile:

And link to the website:
http://www.millers-graphics.co.uk

Lukas

29 Sep 2009, 11:55 AM
#9
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

so what happens when you login now? ......what happens to the login, log off and my account links?

29 Sep 2009, 12:03 PM
#10
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

When I enter the website, there is a "Login" link only. When I sign in, I can see "Log out" and "Manage my accounts" links. I have checked them and they seem to be working. But, I am not developer, especially PHP developer. I was able to merge the code of both files - tpl_header and tpl_information, but I dont know how to make look how I want.

First of all, all links - Login, Log off and My Account - appear outside the information sidebox.

If this is something you could help with..please :lookaroun:

website address:
http://www.millers-graphics.co.uk

Lukas

29 Sep 2009, 12:04 PM
#11
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Propablly, my code merging skills are not good enough..:wacko:

Lukas

29 Sep 2009, 12:25 PM
#12
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

The code in the file isnt how i had it in my head.

hmm maybe editing the wrong file then, as the $i++ section is a start of a loop, and it brings in all the links from the file information.php (includes/modules/sideboxes/information.php)

So my thinking is you would need to modify this page with the login link.

I would try and put it about the DEFINE_CONTACT_US_STATUS (as you want it to appear above the contact us link)

could try something like:

if ($_SESSION['customer_id']) {
$information[] = '<a href="zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> ';}

else {
if (STORE_STATUS == '0') {

$information[] = '<a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a>';}}

Not sure if that will work though.....sorry not sure i will be able to be much more help than that, without trial and error lol

29 Sep 2009, 12:43 PM
#13
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

I will give a try. Thanks again

Lukas

29 Sep 2009, 12:50 PM
#14
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

also, my code may be slightly wrong.....or missed bracket or something.

But was trying to provide something tht you could see my logic behind.....good luck

29 Sep 2009, 12:51 PM
#15
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

oops i can see i have a random ?> on the first line after logoff

29 Sep 2009, 12:51 PM
#16
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Nope, its not working. I'll check the code like you said and hopefully :cool: it will work. Thanks again for your help

Lukas

29 Sep 2009, 1:10 PM
#17
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Ooba_Scott, your idea was great. I did some tweaks to the code and it works perfect. Thank you so much.

Ah, and here is the good code:

if ($_SESSION['customer_id']) {
$information[] = '<a href="' . zen_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' .HEADER_TITLE_LOGOFF . '</a>';
$information[] = '<a href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' .HEADER_TITLE_MY_ACCOUNT . '</a>';
} else {
if (STORE_STATUS == '0') {
$information[] = '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' .HEADER_TITLE_LOGIN . '</a>';
}
}

Lukas

29 Sep 2009, 1:18 PM
#18
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

fantastic, well done

Im pleased you got there in the end :)

29 Sep 2009, 1:37 PM
#19
safeg avatar

safeg

Zen Follower

Join Date:
Apr 2009
Location:
Edinburgh
Posts:
130
Plugin Contributions:
0

Re: Changing link from "login" (when not logged in) to "my account" (when logged in)

Only thanks to you :D:

Lukas