This was my solution. After a lot of testing, it works great now! It's a part of the free Prestashop online store.
Code:
public static void ReGenerateEntireTree()
{
DataTable Table = SelectQuery("SELECT id_category, id_parent FROM ps_category ORDER BY id_parent ASC, position ASC");
Dictionary<int, int> categoryArray = new Dictionary<int,int>();
Leave a comment: