cyber83 Designer Depuis Romania Membre depuis juin 2024 cyber83 3 févr. 2025 12:21 On the Vmod page, I want to name the Vmod's in a logical way, however I dont know how the netries are sorted on this page: admin/?app=vmods&doc=vmods its not A-Z - I would prefer the vmod entries to be sorted from A-Z so I can organise them when I give the Vmod name for example: Admin - Vmod - 1 Admin - Vmod - 2 Front - Vmod - xxx and so on
jackmaessen LiteCart Fan Depuis Netherlands Membre depuis déc. 2022 jackmaessen 3 févr. 2025 13:40 https://github.com/litecart/litecart/blob/dev/public_html/admin/vmods.app/vmods.inc.php#L183 $vmods is the array sort alphabetically by name: function sortByName($a, $b) { return strcmp($a["name"], $b["name"]); } usort($vmods, 'sortByName'); So in file admin/vmods.app/vmods.inc.php ... $vmods[] = $vmod; } function sortByName($a, $b) { return strcmp($a["name"], $b["name"]); } usort($vmods, 'sortByName'); ...
cyber83 Designer Depuis Romania Membre depuis juin 2024 cyber83 3 févr. 2025 14:01 Thank you jackmaessen - that worked - I can now name my vmods in a way that it groups itself from Z-A for a clearer view as I am started to have lots of vmods..
tim Founder Depuis Sweden Membre depuis mai 2013 tim 3 févr. 2025 14:53 And even more lightweight is this: uasort($vmods, function($a, $b) { return strcmp($a['name'], $b['name']); }); And as arrow functions: uasort($vmods, fn($a, $b) => strcmp($a['name'], $b['name'])); https://www.php.net/manual/en/functions.arrow.php