anonymous checkout disabled but profile shows anonymous

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

anonymous checkout disabled but profile shows anonymous

Post by tonz » Mon Nov 09, 2009 3:58 am

Hi,

We do not allow anonymous checkout. AllowAnonymousCheckout parameter for the OnepageCheckout control is not modified, it should be the default. Normally everything works fine however we had a few strange orders lately. Although the order summary Bill to section contains the customer information, the order's customer profile shows anonymous, as if the account did not get created properly. User cannot login to see his order and download his product. Admin/Users panel also does not find the user either.

We have our own license server which connects to the shop through the serial provider interface. These same orders did not get serial information, and it turned out that our license server was down. Nevertheless user info is not something the serial key provider interface handles.

Would anybody know what could create the problem?

Could somebody tell us how to fix username and password in the database so that the customer could login for that order?

Thanks in advance,

Tony
http://www.blackice.com
http://shop.faxproducts.com
http://shop.blackice.com

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

Re: anonymous checkout disabled but profile shows anonymous

Post by mazhar » Mon Nov 09, 2009 4:49 am

Could somebody tell us how to fix username and password in the database so that the customer could login for that order?
You can simply load the order and if customer's Email address is available through his/her address update user name with Email address and then trigger password reset request for this account. If Email address used for checkout was valid then customer will receive password reset link and will be able to access his/her account with new credentials.

User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

Re: anonymous checkout disabled but profile shows anonymous

Post by tonz » Mon Nov 09, 2009 5:03 am

Thanks Mazhar for your quick reply. I have loaded the order. Email address is available but only in the bill to section. Customer profile shows anonymous and shows no email info. Could you explain again, I am not sure whether I understand what do you mean. Or do you mean to load the order in the database and not the admin area?

Thanks

Tony

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

Re: anonymous checkout disabled but profile shows anonymous

Post by mazhar » Mon Nov 09, 2009 5:30 am

Well I mean to write some custom script to do this job. For example some page on admin side with UI having a textbox and a button. When some enters order number in textbox and hits enter you need to load crossponding order via code the access bill to email address and update user's user name with it and finally trigger password reset request. For example script could be something like

Code: Select all

int orderId = OrderDataSource.LookupOrderId(AlwaysConvert.ToInt(OrderNumberTextBox.Text));
        Order order = OrderDataSource.Load(orderId, false);
        User user = order.User;
        string emailAddress = string.Empty;
        
        emailAddress = user.Email;
        if (String.IsNullOrEmpty(emailAddress))
            emailAddress = order.BillToEmail;
        if (String.IsNullOrEmpty(emailAddress))
            return;
        user.UserName = emailAddress;
        user.Email = emailAddress;
        user.IsAnonymous = false;
        user.Save();
        user.GeneratePasswordRequest();

User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

Re: anonymous checkout disabled but profile shows anonymous

Post by tonz » Mon Nov 09, 2009 6:11 am

Thanks for the code. We started to implement but got the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0118: 'System.Web.UI.Page.User' is a 'property' but is used like a 'type'
Source Error:
Line 489: int orderId = 603;
Line 490: Order order = OrderDataSource.Load(orderId, false);
Line 491: User user = order.User;
Line 492: string emailAddress = string.Empty;
Line 493:

Could you please advise?

thanks, Tony

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

Re: anonymous checkout disabled but profile shows anonymous

Post by mazhar » Mon Nov 09, 2009 6:19 am

Seems like we need to make use of classes with their complete names including namespaces. Use this code instead

Code: Select all

int orderId = CommerceBuilder.Orders.OrderDataSource.LookupOrderId(AlwaysConvert.ToInt(OrderNumberTextBox.Text));
        CommerceBuilder.Orders.Order order = CommerceBuilder.Orders.OrderDataSource.Load(orderId, false);
        CommerceBuilder.Users.User user = order.User;
        string emailAddress = string.Empty;

        emailAddress = user.Email;
        if (String.IsNullOrEmpty(emailAddress))
            emailAddress = order.BillToEmail;
        if (String.IsNullOrEmpty(emailAddress))
            return;
        user.UserName = emailAddress;
        user.Email = emailAddress;
        user.IsAnonymous = false;
        user.Save();
        user.GeneratePasswordRequest();

User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

Re: anonymous checkout disabled but profile shows anonymous

Post by tonz » Mon Nov 09, 2009 10:33 am

now the code does take the bill to email and put it to the user email in our test server, however before we put it out live, I have a question because we could reproduce this issue on our test server:

currently the "bad" order thinks it is related to anonymous (group or user, I don't know). Each anonymous user has its own unique identifier? so if we take the billto email and put it to the user field, will it rewrite the email address of all anonymous users or only that one?

thanks again

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

Re: anonymous checkout disabled but profile shows anonymous

Post by mazhar » Mon Nov 09, 2009 10:37 am

It will effect only single user belonging to problematic order.

User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

Re: anonymous checkout disabled but profile shows anonymous

Post by tonz » Wed Nov 11, 2009 4:49 am

Finally we could reproduce the issue in our test environment. Code works properly, although the user is created as disabled. Can we do something that the user is enabled when the scripts has run?

We won't use the password request, we will send them pwds in these special cases.

Thanks again for your help.

Tony

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

Re: anonymous checkout disabled but profile shows anonymous

Post by mazhar » Wed Nov 11, 2009 4:54 am

In the script locate following line

Code: Select all

user.IsAnonymous = false;
and then update it as below

Code: Select all

user.IsAnonymous = false;
user.IsApproved = true;

User avatar
tonz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 48
Joined: Thu Mar 13, 2008 4:08 am

Re: anonymous checkout disabled but profile shows anonymous

Post by tonz » Wed Nov 11, 2009 4:55 am

Easy enough, thanks

Post Reply