Skip to content

Instantly share code, notes, and snippets.

@ArveSystad
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save ArveSystad/df06cec5b0f60e6e9fa6 to your computer and use it in GitHub Desktop.

Select an option

Save ArveSystad/df06cec5b0f60e6e9fa6 to your computer and use it in GitHub Desktop.
public Cart GetShoppingCart(int orderGroupId)
{
var parameters = new OrderSearchParameters
{
SqlWhereClause = "OrderGroupId = " + orderGroupId
};
var options = new OrderSearchOptions
{
Classes = new StringCollection { "ShoppingCart" },
RecordsToRetrieve = 1
};
var findCarts = OrderContext.Current.FindCarts(parameters, options);
Cart cart = findCarts.FirstOrDefault();
if (cart == null)
throw new Exception("Can't find order! Something has clearly gone wrong");
return cart;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment