Skip to content

Commit 3b58ca0

Browse files
committed
Cart and mini cart should not have different item order
1 parent e10d4f8 commit 3b58ca0

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Libraries/SmartStore.Services/Customers/CustomerExtentions.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,15 @@ public static int CountProductsInCart(this Customer customer, ShoppingCartType c
287287

288288
return count;
289289
}
290-
public static List<OrganizedShoppingCartItem> GetCartItems(this Customer customer, ShoppingCartType cartType, int? storeId = null, bool orderById = false)
290+
291+
public static List<OrganizedShoppingCartItem> GetCartItems(this Customer customer, ShoppingCartType cartType, int? storeId = null)
291292
{
292293
var rawItems = customer.ShoppingCartItems.Filter(cartType, storeId);
293294

294-
if (orderById)
295-
rawItems = rawItems.OrderByDescending(x => x.Id);
296-
297-
var organizedItems = rawItems.ToList().Organize();
295+
var organizedItems = rawItems
296+
.OrderByDescending(x => x.Id)
297+
.ToList()
298+
.Organize();
298299

299300
return organizedItems.ToList();
300301
}

src/Presentation/SmartStore.Web/Controllers/ShoppingCartController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,6 @@ protected MiniShoppingCartModel PrepareMiniShoppingCartModel()
996996

997997
//products. sort descending (recently added products)
998998
foreach (var sci in cart
999-
.OrderByDescending(x => x.Item.Id)
1000999
.Take(_shoppingCartSettings.MiniShoppingCartProductNumber)
10011000
.ToList())
10021001
{
@@ -2633,7 +2632,7 @@ public ActionResult FlyoutWishlist()
26332632
{
26342633
Customer customer = _workContext.CurrentCustomer;
26352634

2636-
var cart = customer.GetCartItems(ShoppingCartType.Wishlist, _storeContext.CurrentStore.Id, true);
2635+
var cart = customer.GetCartItems(ShoppingCartType.Wishlist, _storeContext.CurrentStore.Id);
26372636
var model = new WishlistModel();
26382637

26392638
PrepareWishlistModel(model, cart, true);

0 commit comments

Comments
 (0)