Ecommerce shopping cart sort

Merete Nor Midtskog asked on May 9, 2014 03:25

How can I change the sort order of content in my shopping cart? Need to order by product number.

Regards Merete

Recent Answers

Josef Dvorak answered on May 12, 2014 11:46


There is no such functionality in Kentico, and there is no way to order items internally, so you would need to modify parts of Kentico that show the list of cart / order items to order items for the output.

Also, you have to keep in mind that product options are SKUs too, so they also have SKUID. This means that if you do a SQL Order by SKUID, you may split products from their product options. Therefore the ordering will not be possible via a simple SQL, only using a custom logic that will manipulate the list before displaying it.

The best place to start the customization seems to be overriding this method in ShoppingCartInfoProvider:

protected virtual void FilterContentTableInternal(DataTable table)

This method is used for removing undesirable rows (bundles) from a Content Table, which is used for output in Kentico 7 shopping cart, Order details and notification emails. Here you can add your own code to the order items in the table.

In Kentico 8 you will also need to modify the following web part, and make sure that the data bound to shoppingCartUniView.DataSource is ordered before assignment:


1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.