assiging user to a volume discount group dynamically

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

assiging user to a volume discount group dynamically

Post by Carolharry » Mon Jul 06, 2009 2:15 pm

We have a special page which has Register control of Ablecommerce. I modified Registerdialog.ascx so that when the user logs in through this page we assign them to a special volume discount group and redirect them to a special category which has products with special volumediscount associated to that category.

I am doing it like this

if ((Token.Instance.UserId != newUserId) && (newUserId != 0))
{
User.Migrate(Token.Instance.User, newUser);
Token.Instance.UserId = newUserId; //this is AbleCommerce Code
if (_isSpecialuser)//this is being passed from usercontrol attribute
{
newUser.UserGroups.Add(new UserGroup(newUser.UserId, 14));
newUser.Save();


if (!newUser.IsAnonymous)
Response.Redirect("categorylist.aspx?categoryid=98");

}

}
1. Problem is after I redirect him to this page, his status is still "Anonymous".
2. The not newUser.Isanonymous condition is returning true and the user is redirected to category=98 page.
3. I checked the user Id being retrieved in categorylist.aspx page and it says a differnt userid(anonymous userid) and not the newUser.userId.
hence, when I add the product in category =98 to cart I am not getting the volume discount associated to that category.

What is that I am missing? Why isn't response.redirect taking the authenticated userid?

Any help??

thanks
Carol

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: assiging user to a volume discount group dynamically

Post by Carolharry » Tue Jul 07, 2009 5:20 am

does any one know how Token.Instance.Userid gets filled?

Any help from dev team please......

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: assiging user to a volume discount group dynamically

Post by mazhar » Tue Jul 07, 2009 6:34 am

Check the ConLib/RegisterDialog(Out of the Box) control's code in detail that how it is migrating anonymous user after registration.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: assiging user to a volume discount group dynamically

Post by Logan Rhodehamel » Tue Jul 07, 2009 9:39 am

Carolharry wrote:What is that I am missing? Why isn't response.redirect taking the authenticated userid?
AbleCommerce uses ASPNET Forms Authentication for user tracking. After you have established your new user, you will need to tell the browser that the user is authenticated. In other words, set a cookie.

Code: Select all

if (!newUser.IsAnonymous)
{
  FormsAuthentication.SetAuthCookie(newUser.UserName, false);
  Response.Redirect("categorylist.aspx?categoryid=98");
}
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Post Reply