We have users who need to log in with an existing account to recieve member pricing. I'd like to display a message in the checkout screen if someone logs in and is not in the member user group, reminding them to use their pre-existing member account (assuming they have one) to receive member pricing.
I thought I'd try using nVelocity to accomplish this, but I am not sure if or how to access the UserGroup name, or even the ID. If I can get at the ID I might be able to use the sample code I've seen to do a quick check and display a message if they are or are not in the member group. How can I access a Users Group IDs or a User Group Names.
I was fiddling with
${UserGroup.GroupID}
$User.Group
... but had no luck.
Thanks in advance.
Ernie
Using nVelocity to Display or act upon user group
-
- Lieutenant (LT)
- Posts: 54
- Joined: Fri Aug 15, 2008 7:56 am
Re: Using nVelocity to Display or act upon user group
First check ac_Groups table from the database and find the id of your group for example in my case i created a group named MemberGroup and the database id for this group was 9.
Now put the following NVelcocity code in OnePageCheckout scriptlet
It will show the related message depending upon that user is a member of the group or not. For your requirements you can just skip the else part, so that it will be something like as below.
Now put the following NVelcocity code in OnePageCheckout scriptlet
Code: Select all
#if(!$customer.IsInGroup(9))
You are not a member
#else
You are a member
#end
Code: Select all
#if(!$customer.IsInGroup(9))
You are not a member
#end
-
- Lieutenant (LT)
- Posts: 54
- Joined: Fri Aug 15, 2008 7:56 am
Re: Using nVelocity to Display or act upon user group
Mazhar,
Perfect! Perfect! Prefect!
Exactly what I needed.
Thanks,
Ernie
Perfect! Perfect! Prefect!
Exactly what I needed.
Thanks,
Ernie