X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   testing for registered or anonymous user (https://forum.x-cart.com/showthread.php?t=48846)

amy2203 07-28-2009 12:42 AM

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

ARW VISIONS 07-28-2009 01:39 AM

Re: testing for registered or anonymous user
 
Are you talking about the invoice emailed to the customer? I don't think it uses smarty.

ARW VISIONS 07-28-2009 01:41 AM

Re: testing for registered or anonymous user
 
oops... yes it does :)

Hmm... not sure I'll take a look see.

carpeperdiem 07-28-2009 03:43 AM

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

amy2203 07-28-2009 03:49 AM

Re: testing for registered or anonymous user
 
Thanks, mine is for BCSE points code too!


All times are GMT -8. The time now is 12:42 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.