Page 1 of 1
Basket Transferrance?
Posted: Fri Sep 26, 2008 7:23 am
by William_firefold
We want to implement a function to help create quotes for customers through the website.
What we want is to be able to create an order in the admin panel and pass the cart along to a user.
This may not be possible, Im not sure how the access restrictions are built into able.
If the basket is created and filled in admin, is it possible to access it from a regular user account, or maybe attach it to their account?
Re: Basket Transferrance?
Posted: Fri Sep 26, 2008 7:57 am
by jmestep
Are you going to make price adjustments? If not, I think you can just find the user in the admin and login as that user and start the process.
Re: Basket Transferrance?
Posted: Fri Sep 26, 2008 8:12 am
by William_firefold
We will need to make price adjustments.
And those price adjustments would have to carry over.
Can it be done?
Re: Basket Transferrance?
Posted: Fri Sep 26, 2008 8:19 pm
by AbleMods
You can modify the customer cart directly without actually creating an order.
This would allow you to populate their basket for them, allowing them to just log in and go straight to checkout. Would that work for you?
Re: Basket Transferrance?
Posted: Mon Sep 29, 2008 12:16 am
by mazhar
Well I have tried something, I think it may help you. In order to transfer basket which is created by the admin to some one else, first of all we create a user for example we say it
temp@temp.com. Now on the admin side we put the following code
Code: Select all
User user = new User()
Basket basket = user.Basket;
BasketItem basketItem = BasketItemDataSource.CreateForProduct(5, 1); // Where 5 is product id being added
basket.Items.Add(basketItem);
basket.Save();
When executed this code will create a basket with one item in it. Create a link for the website login page like
http://localhost/mystore/Login.aspx?buser=13
Where 13 is the user id of anonymous user created for basket from admin side
Now on the client side we modify the
ConLib/LoginDialog.ascx control and locate the following lines of code
Code: Select all
if ((oldUserId != newUserId) && (newUserId != 0))
{
User.Migrate(Token.Instance.User, UserDataSource.Load(newUserId));
Token.Instance.UserId = newUserId;
}
and made it look like
Code: Select all
if ((oldUserId != newUserId) && (newUserId != 0))
{
User.Migrate(Token.Instance.User, UserDataSource.Load(newUserId));
Token.Instance.UserId = newUserId;
int buserid = AlwaysConvert.ToInt(Request.QueryString["buser"]);
if(buserid>0)
{
Basket.Transfer(buserid, newUserId);
Token.Instance.User.Basket.Recalculate();
}
}
That's it. Now when some user visits the site through the link discussed above then when he logs on the basket created from the admin side will be shifted to him.