So in an ideal world I would like to call the above function in a user control and for it not to return a XPathNodeItrerator is there a nice simple AddToBasket which would return me a true or false of success and ref for any error messages.
Otherwise to use the above function a user control you have to parse the actually XML back out and then grab the error from there.. Not impossible but not cleaniest way of doing it.
You can use SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.AddProduct() which will return the order line the product was added to. The *Context classes are a good way to access the same functionality found in CommerceLibrary.
AddToBasket Function
public static XPathNodeIterator AddToBasket(string catalogName, int quantity, string sku, string variantSku, bool addToExistingLine)
Hi,
So in an ideal world I would like to call the above function in a user control and for it not to return a XPathNodeItrerator is there a nice simple AddToBasket which would return me a true or false of success and ref for any error messages.
Otherwise to use the above function a user control you have to parse the actually XML back out and then grab the error from there.. Not impossible but not cleaniest way of doing it.
Any ideas?
James
You can use SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.AddProduct() which will return the order line the product was added to. The *Context classes are a good way to access the same functionality found in CommerceLibrary.
Here's the reference for the AddProduct method http://www.ucommerce.dk/docs/html/M_UCommerce_Entities_PurchaseOrder_AddProduct.htm
I am finding that the following call does not return the pricegroupprice, therefore preventing the product to be added to the basket.
var item = Product.SingleOrDefault(x => x.Sku == sku);
Anyone have any ideas? The pricegroupprice is definitely set for the product and exists in the pricegroupprice table.
Thanks
Don
Is it the right call there? I was expecting a call to PurchaseOrder.AddProduct or Product.GetPrice.
Could you clarify?
Thanks,
is working on a reply...