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
What's is a best way to get a list of X best sellers from a catalog using the API?
Many thanks
Matt
uCommerce uses a SP called uCommerce_GetProductTop10 to generate the Top 10 product overview found in the backend.
If you are looking for a more flexible solution i think you maybe could get some inspiration from a method i once wrote, to rank products:
public static IOrderedEnumerable<Ranking> RankPassedProducts(List<string> skus) { var validOrders = PurchaseOrder.All().Where(x => x.CompletedDate != null).ToList(); var validOrderLines = validOrders.SelectMany(y => y.OrderLines); var rankingList = new List<Ranking>(); foreach (var sku in skus) { var buys = validOrderLines.Where(x => x.Sku == sku).ToList().Sum(y => y.Quantity); var newRanking = new Ranking() { Buys = buys, Sku = sku }; rankingList.Add(newRanking); } var outputList = rankingList.OrderByDescending(y => y.Buys); return outputList; }
It takes some time, so i made a caching layer to speed things up.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Best sellers
What's is a best way to get a list of X best sellers from a catalog using the API?
Many thanks
Matt
uCommerce uses a SP called uCommerce_GetProductTop10 to generate the Top 10 product overview found in the backend.
If you are looking for a more flexible solution i think you maybe could get some inspiration from a method i once wrote, to rank products:
It takes some time, so i made a caching layer to speed things up.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.