Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How can I sort products by date? CreateDate and UpdateDate fields of IProductContent always same for all products. Can anybody help with it?
Hi TRiV and welcome to Our.
Would it be possible for you to share the code that you have right now to pull out the products.
By sharing the code, then people can try to help you with a specific example.
Best,
/Dennis
Hi Dennis!
Code snippet:
ProductCollection currentCollection = ...getting current collection... var childCollections = currentCollection.Children().OrderBy(x => x.SortOrder); IEnumerable<IProductContent> products = childCollections.SelectMany(x => x.GetProducts()).Union(currentCollection.GetProducts()).DistinctBy(x => x.Key); var temp = products; switch (filter.SortOrder) { case SortOrder.FromNewToOld: { temp = temp.OrderByDescending(x => x.CreateDate); break; } case SortOrder.FromOldToNew: { temp = temp.OrderBy(x => x.CreateDate); break; } case SortOrder.LowPriceToHighPrice: { temp = temp.OrderBy(x => x.Price); break; } case SortOrder.HighPriceToLowPrice: { temp = temp.OrderByDescending(x => x.Price); break; } }
Sort order not work, b/c "CreateDate" always same for all products. Same thing with "UpdateDate". Can anyone help with it?
Thanks,
TRiV!
Did you find any solution?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Sort Order by Date
How can I sort products by date? CreateDate and UpdateDate fields of IProductContent always same for all products. Can anybody help with it?
Hi TRiV and welcome to Our.
Would it be possible for you to share the code that you have right now to pull out the products.
By sharing the code, then people can try to help you with a specific example.
Best,
/Dennis
Hi Dennis!
Code snippet:
Sort order not work, b/c "CreateDate" always same for all products. Same thing with "UpdateDate". Can anyone help with it?
Thanks,
TRiV!
Did you find any solution?
is working on a reply...