The function I am using right now to get categories (sorted alphabetically) is
$category_tree = ShopFunctions::categoryListTreeLoop($categoryIds,$cid = 0, $level = 0, $disabledFields = array(), $isSite=true, $vendorId=1, VmConfig::$vmlang);
Now I want $category_tree to contain categories but to be sorted as per ordering that is made in VirtueMart. Can anyone help?