Created
March 19, 2013 21:38
-
-
Save adamjenkin/5200380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override Basket GetBasket(bool create) | |
{ | |
// Member is not logged on use default behavior | |
if (!Member.IsLoggedOn()) return base.GetBasket(create); | |
// Otherwise try and load a basket for the current member, create one if it doesn't exist | |
Basket basket = GetBasketForCurrentMember(); | |
if(basket == null) | |
{ | |
// no member specific basket, check anonymous basket held in cookie | |
// (Has basket on the OrderContext class checks for a basket in the cookie of the HttpConext) | |
if(this.HasBasket) | |
{ | |
basket = this.GetBasket(); | |
// Set the memberid property on this basket to convert it to a member basket | |
basket.PurchaseOrder["MemberId"] = Member.CurrentMemberId().ToString(); | |
// Might need a save here? | |
// basket.PurchaseOrder.Save(); | |
} | |
else | |
{ | |
// no anonymous or member baskets, create a brand new one | |
basket = CreateBasket(); | |
} | |
return basket; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment