Hey,
I am running into a problem here. I need to group products by serialno and sort the products by a variantno. Products is imported from NAV - and because of productgroup structure - sort isn't an option there.
I tried to inherit the ProductListTemplateExtender and make the group sort on a generic list of products and push it back to the ProductCollection and assign it to the original base.ProductList reference.
I hoped I would be able to overrule the standard sort, but it looks like it's not possible.
What to do?
- Allan
Developer forum
E-mail notifications
Group and sort products in list
Posted on 09/07/2010 10:07:05
Replies
Jeppe Eriksson Agger
Posted on 09/07/2010 11:21:39
Hi Allan
You can sort your products in a custom way by hooking into the notification "Notifications.eCommerce.ProductList.BeforePaging". That notification is broadcast just after the standard eCom product sort has completed. From the notification args object (after you've cast it to "Notification.eCommerce.ProductList.BeforePagingArgs") you can get the ProductCollection object and manipulate it any way you'd like.
- Jeppe
You can sort your products in a custom way by hooking into the notification "Notifications.eCommerce.ProductList.BeforePaging". That notification is broadcast just after the standard eCom product sort has completed. From the notification args object (after you've cast it to "Notification.eCommerce.ProductList.BeforePagingArgs") you can get the ProductCollection object and manipulate it any way you'd like.
- Jeppe
Jeppe Eriksson Agger
Posted on 09/07/2010 11:24:54
The type you cast the notification args object to is of course "Notifications.eCommerce.ProductList.BeforePagingArgs". Forgot the "s" in my previous post, sorry :-)
Posted on 12/07/2010 10:06:25
Hey,
How do I referer to my sorted productcollection afterwards?
The productlist from the argument is readonly.
How do I referer to my sorted productcollection afterwards?
The productlist from the argument is readonly.
Jeppe Eriksson Agger
Posted on 14/07/2010 11:43:16
The product list should contain the products you want, but not the correct sorting. You can simply sort the collection.
If, however, you the collection doesn't contain the products you want, then Clear the collection and add you products. That way you keep the product reference.
If, however, you the collection doesn't contain the products you want, then Clear the collection and add you products. That way you keep the product reference.
You must be logged in to post in the forum