Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Friendlier: "Welcome back, [firstname]" in welcome

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-21-2005, 04:33 PM
 
jsa jsa is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 197
 

Default Friendlier: "Welcome back, [firstname]" in welcome

Hi. One of my cart testers asked if the welcome back code could display his first name only.

I think it might be a privacy issue for him, but it makes sense, too, because it's just friendlier. First name/last name is very clinical.

Here's my welcome.tpl:
Code:
{* $Id: welcome.tpl,v 1.23.2.1 2005/04/23 08:32:48 max Exp $ *} {if ($active_modules.Greet_Visitor ne "") and ($smarty.cookies.GreetingCookie ne "") and $logout_user eq ''} <H3>{$lng.lbl_welcome_back}, {$smarty.cookies.GreetingCookie|replace:"\'":"'"} </H3> {/if} {$lng.txt_welcome} {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} {include file="customer/main/featured.tpl" f_products=$f_products}

I think the code responsible for the name is: {$smarty.cookies.GreetingCookie|replace:"\'":"'"}

However, I have no idea how to change that to first name only. It looks like fancy regex stuff at the end there. Maybe it's not. Whatever it is, though, is way over my head.

Anybody know how to display the first name only?

Thanks!
__________________
Building: X-Cart GoldPlus 4.6.1
Old cart:
XC 4.0.17 FComp-RMA-AOM-OFF-Affil
BCSE: Referral Pts-Surveys-BatchUp-OrderEZ- Reviews-RSS
FT: Glossary-OptCopt-AdvSrch-Recently Viewed-Also Bought
CM: eZConversion
XP: SalesRecovery, MultCrncy
Reply With Quote
  #2  
Old 12-21-2005, 04:55 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

http://forum.x-cart.com/viewtopic.php?t=3438
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 12-21-2005, 05:45 PM
 
jsa jsa is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 197
 

Default

Quote:
Originally Posted by balinor
http://forum.x-cart.com/viewtopic.php?t=3438

You are a better searcher than I! Thanks, that hit the spot! Thank you for that. That thread has lots of good info.

Now that I did the first name mod, though, I'm seeing some artifacts from cookie handling because I have secure login chosen and a different secure domain than http domain.

The name cookie gets stuffed into the https domain, and their name doesn't appear when the customer returns to the http domain on their own.

(of course, this has nothing to do with the first name mod... I only noticed it now because my attention is in this area right now)

This is the code welcome.tpl uses to figure out the domain to stuff the cookie into:

Code:
$_tmp = parse_url($current_location); setcookie("GreetingCookie", $first_last, time()+3600*24*180, "/", $_tmp["host"]);

Maybe there's another thread that deals with cookies between secure and nonsecure domains?
__________________
Building: X-Cart GoldPlus 4.6.1
Old cart:
XC 4.0.17 FComp-RMA-AOM-OFF-Affil
BCSE: Referral Pts-Surveys-BatchUp-OrderEZ- Reviews-RSS
FT: Glossary-OptCopt-AdvSrch-Recently Viewed-Also Bought
CM: eZConversion
XP: SalesRecovery, MultCrncy
Reply With Quote
  #4  
Old 12-22-2005, 04:22 AM
 
jsa jsa is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 197
 

Default

I'm not sure if it this is a good fix or what, but for now, I set $xcart_http_host to my domain minus the www. in config.php.

Then in welcome.tpl, I switched this:

Code:
setcookie("GreetingCookie", $first_last, time()+3600*24*180, "/", $_tmp["host"]);

to

this:
Code:
setcookie("GreetingCookie", $first_last, time()+3600*24*180, "/", $xcart_http_host);

That way, whether people go to doman.com www.domain.com or subdomain.domain.com, xcart can still grab the cookie.

I'm not sure if I lose anything by doing this. Obviously x-cart moved to the host method for a reason.
__________________
Building: X-Cart GoldPlus 4.6.1
Old cart:
XC 4.0.17 FComp-RMA-AOM-OFF-Affil
BCSE: Referral Pts-Surveys-BatchUp-OrderEZ- Reviews-RSS
FT: Glossary-OptCopt-AdvSrch-Recently Viewed-Also Bought
CM: eZConversion
XP: SalesRecovery, MultCrncy
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:22 PM.

   

 
X-Cart forums © 2001-2020