Hello,
I have this subscriber that sorts products by price:
[Subscribe(Dynamicweb.Notifications.eCommerce.ProductList.BeforePaging)]
public class ChangeSorting : NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
{
Dynamicweb.Notifications.eCommerce.ProductList.BeforePagingArgs thisArgs = (Dynamicweb.Notifications.eCommerce.ProductList.BeforePagingArgs)args;
thisArgs.Products.Sort(Dynamicweb.eCommerce.Products.ProductCollection.SortBy.Price,Dynamicweb.eCommerce.Products.ProductCollection.SortDirection.Ascending);
foreach (Dynamicweb.eCommerce.Products.Product p in thisArgs.Products)
{
LogToFile.Log(p.Number + " " + p.Price.PriceFormatted, "SortLog", LogToFile.LogType.ManyEntriesPerFile);
}
}
}
Unfortunately this doesnt seem to work very well. Here's an excerpt from the SortLog:
[2/13/2013 9:00:01 AM]: 84717 kr. 173,75 [2/13/2013 9:00:01 AM]: 84326 kr. 173,75 [2/13/2013 9:00:01 AM]: 84104 kr. 173,75 [2/13/2013 9:00:01 AM]: 84103X103 kr. 198,75 [2/13/2013 9:00:01 AM]: 84348X348 kr. 173,75 [2/13/2013 9:00:01 AM]: 84795X795 kr. 186,25 [2/13/2013 9:00:01 AM]: 84613 kr. 173,75 [2/13/2013 9:00:01 AM]: 84288X288 kr. 173,75 [2/13/2013 9:00:01 AM]: 84959 kr. 173,75
Note: I also have a priceprovider setting the prices before all this, but shouldn't this still work ?
Cheers,
Jonas