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

testing for registered or anonymous user

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-28-2009, 12:42 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default testing for registered or anonymous user

I's like to be able to use an if statement in my invoice template, to display one thing for registered users, and another to anonymous users.

I am assuming I can just test the value of {$order.login}, but anonymous user logins have a number at the end.

I really want to do something like

{if left({$order.orderid}, 9) eq "anonymous"}
stuff here
{else}
stuff here
{/if}

but I can't work out what it should actually be? I've tried looking at the smarty site with no success?

tia
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #2  
Old 07-28-2009, 01:39 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: testing for registered or anonymous user

Are you talking about the invoice emailed to the customer? I don't think it uses smarty.
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 07-28-2009, 01:41 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: testing for registered or anonymous user

oops... yes it does

Hmm... not sure I'll take a look see.
__________________
xcart 5.1.2
Reply With Quote
  #4  
Old 07-28-2009, 03:43 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: testing for registered or anonymous user

I do such a test on order_invoice.tpl (for BCSE reward points - display points only for registered customers):

Code:
{if $order.login|strpos:'customer-'===0} code for anon customers {else} code for registered customers {/if}

NOTE: I call my anon customers, "customer", as set in config.php -- if you call them "anonymous", then change

strpos:'customer-'

to strpos:'anonymous-'

I also have a 4 digit order number (for now). Hopefully, it will exceed 4 digits some day, and I will have to adjust this code. That's about $11,000,000 of orders from now.

Hope this works for you.

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 07-28-2009, 03:49 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: testing for registered or anonymous user

Thanks, mine is for BCSE points code too!
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
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 09:06 AM.

   

 
X-Cart forums © 2001-2020