![]() |
How do I show Customer's name instead of login??
I want to have the Customer's first name followed by the first letter of their last name to show up instead of their login ID.
I tried replacing {$login} in authbox.tpl with {$customer_info.firstname} {$customer_info.lastname|truncate:1:".":true}, but nothing shows up. Anyone know how to do this? While I was testing Xcart earlier on I noticed that my name would show up right after "Welcome," at the top of the main customer area, but I don't want to simply pull the name from a cookie as the coe for that feature uses...unless, of course, the customer is logged in. Is the logged in Customer's name always the same as that found in the cookie that is checked in welcome.tpl? Thanks! :? |
try {$userinfo.firstname}
|
Thanks shan! :D Worked like a charm.
Had to change {$userinfo.lastname|truncate:1:".":true} to {$userinfo.lastname|truncate:2:".":true}. Why is it that I needed to truncate to 2 characters instead of only one to show the lastname + "."? Also, is there a place I can find a list of all of Xcart's variable names, where they are declared, and at least a short description of what they do? This would make modding sooo much easier. :?: |
Well, if worked at first...now it only works half the time.
For some reason the variable $userinfo shows up empty in every area but the shopping cart. Any idea how to change this? For now I am just using an If, Then statement to select from the $login and $userinfo, but this defeats the purpose of what I had in mind to begin with. |
Well, it seems that $customer_info.firstname works when viewing products, and only then. And it seems that $userinfo.firstname only works when viewing the shopping cart. However, $login works all the time but it only shows the login name. :cry:
Looks like I will have to do some PHP coding to get this one to work. Any other ideas before go ahead with that? |
Kinda old but I'm reviewing your posts for optimizations so I thought I'd drop a note in here.
You can open auth.php and at the bottom put: Code:
if ($login) { Then use {$name.firstname} and {$name.lastname} |
Actually, I solved this one ages ago. Just didn't think to post it....in fact, I can't even remember how I did it, that was so long ago. About two days off from a year ago. :lol:
Thanks for the tip though! Hope you find the optimizations useful. :) |
Please any one explain abit more
What actually shall I do to change user name to show first and last name when customer login.
Thanks |
Re: Please any one explain abit more
Quote:
What Jon posted above looks like it would work pretty well. :) |
Hi
Then use {$name.firstname} and {$name.lastname}
where shall use this code, Thanks for help |
Re: Hi
Quote:
Wherever you want to show a customer's first and/or last name. |
Hi
I want to show it on top of login manu
|
Re: Hi
Quote:
Open up authbox.tpl and add the following wherever you would like it positioned. Code:
{if $active_modules.Greet_Visitor ne '' and $login}{$name.firstname} {$name.lastname}{/if} |
Thanks for help, but I tried but it doesnt work. I posted my code below please have look what actually wrong. I want to display customer first and last name on top of login manu.
Thanks {* $Id: auth.tpl,v 1.39.2.1 2005/01/11 14:30:09 mclap Exp $ *} {capture name=menu} <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> {if $config.General.use_https_login eq "Y"} {assign var="form_url" value=$https_location} {else} {assign var="form_url" value=$current_location} {/if} <FORM action="{$form_url}/include/login.php" method="post" name="authform"> <INPUT type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}"> {if $config.General.use_secure_login_page eq "Y"} {* use_secure_login_page *} <TR> <TD> {assign var="slogin_url_add" value=""} {if $usertype eq "C"} {assign var="slogin_url" value=$catalogs_secure.customer} {if $catalogs_secure.customer ne $catalogs.customer} {assign var="slogin_url_add" value="?`$XCARTSESSNAME`=`$XCARTSESSID`"} {/if} {elseif $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"} {assign var="slogin_url" value=$catalogs_secure.admin} {elseif $usertype eq "P"} {assign var="slogin_url" value=$catalogs_secure.provider} {elseif $usertype eq "B"} {assign var="slogin_url" value=$catalogs_secure.partner} {/if} {include file="buttons/secure_login.tpl"} </TD> </TR> {else} {* use_secure_login_page *} <TR> <TD class="VertMenuItems"> <FONT class="VertMenuItems">{$lng.lbl_username}</FONT> <INPUT type="text" name="username" size="16" value="{#default_login#}"> <FONT class="VertMenuItems">{$lng.lbl_password}</FONT> <INPUT type="password" name="password" size="16" value="{#default_password#}"> {if $js_enabled} {include file="buttons/login_menu.tpl"} {else} {include file="buttons/login_menu.tpl"} {/if} <INPUT type="hidden" name="mode" value="login"> {if $active_modules.Simple_Mode ne "" and $usertype ne "C" and $usertype ne "B"} <INPUT type="hidden" name="usertype" value="P"> {else} <INPUT type="hidden" name="usertype" value="{$usertype}"> {/if} <INPUT type="hidden" name="redirect" value="{$redirect}"> <TD height="24" class="VertMenuItems"> </TD> </TR> {/if} {* use_secure_login_page *} {if $usertype eq "C" or ($usertype eq "B" and $config.XAffiliate.partner_register eq "Y")} <TR> <TD height="16" nowrap class="VertMenuItems"> {$lng.lbl_register} l {/if} {if $login eq ""} {$lng.lbl_recover_password} </TD> </TR> {/if} {if $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"} <TR> <TD class="VertMenuItems"> <DIV align="left">{$lng.lbl_insecure_login} </DIV> </TD> </TR> {/if} {if $usertype eq "C"} <TR> <TD class="VertMenuItems" align="right"> {if $js_enabled} {$lng.txt_javascript_disabled} {else} {$lng.txt_javascript_enabled} {/if} </TD> </TR> {/if} </FORM> </TABLE> {/capture} { include file="menu.tpl" dingbats="dingbats_authentification.gif" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu } and {* $Id: authbox.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform"> <TR> <TD></TD> <TD class="VertMenuItems" valign="top"> {$login} {$lng.txt_logged_in} {if $js_enabled} {include file="buttons/logout_menu.tpl"} {else} {include file="buttons/logout_menu.tpl"} {/if} </TD> </TR> {if $usertype eq "C"} <TR> <TD class="VertMenuItems" colspan="2" align="right"> {if $js_enabled} {$lng.txt_javascript_disabled} {else} {$lng.txt_javascript_enabled} {/if} </TD> </TR> {/if} <INPUT type="hidden" name="mode" value="logout"> <INPUT type="hidden" name="redirect" value="{$redirect}"> </FORM> </TABLE> {/capture} { include file="menu.tpl" dingbats="dingbats_authentification.gif" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu } |
Did you add Jon's code into auth.php?
|
hi
Sorry but i am new so I dont know where shall i put which code. will be grateful for help
Thanks |
Just insert the code posted earlier by Jon somewhere near the bottom of auth.php for the customer area.
|
I know this thread is old but I saw this and wanted to do the mod.
It works for me but only in Admin area - the customer area is blank where the name should appear. As presented I inserted the code in auth.php and inserted Code:
{if $active_modules.Greet_Visitor ne '' and $login}{$name.firstname} {$name.lastname}{/if} in authbox.tpl |
All times are GMT -8. The time now is 01:06 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.