Just wondering if anyone knows how to create a new shopping cart from code where the shopping cart is NOT linked to the current user.
I basically need to create a new order in the ecommerce module from a scheduled task in kentico. I've created a new customer and linked it to the relevent user. Now I am stuck triing to create a shopping cart. My code is as follows:
// create customer (if they dont already exist)
var custInfo = CustomerInfoProvider.GetCustomerInfoByUserId(myUserID);
if (custInfo == null)
{
custInfo = new CustomerInfo();
custInfo.CustomerUserID = buyer.UserID;
custInfo.CustomerFirstName = myFirstName;
custInfo.CustomerLastName = myLastName;
custInfo.CustomerEnabled = true;
CustomerInfoProvider.SetCustomerInfo(custInfo);
}
// create cart, add product to cart
var cartInfo = ShoppingCartInfoProvider.CreateShoppingCartInfo(CMSContext.CurrentSiteID);
cartInfo.ShoppingCartUserID = myUserID; // this fails - ShoppingCartUserID is readonly
If I can link the shopping cart to the required user I think the rest should be pretty easy.
Any ideas?
Thanks in advance!