Page 1 of 1

Lise sorting on Sub-category

Posted: Sat Jan 30, 2021 8:49 pm
by musicscore
I created a Lise module called Menu to show a restaurant menu on a site.
I created 2 categories :

1 .English
2. Spanisch

Each category contains multiple sub categories examle :

1. English
----- Main Course
----- Salad
----- Small Plates

2. Spanisch
----- Platos principales
----- Buffet de ensaladas
----- Platos pequeños

Then I created some items and select the corresponding categories (multi select).

I create a English page with this Lise command

{LISEmenu action=category category=English orderby=category_position}

I would expect that the categories and subcategories would be sorted by (sub) category postion but it isn's sorted at all.
Trying for 2 days now every combinatie of Lise sorting commands and modifing templates without any luck.

Please help

Re: Lise sorting on Sub-category

Posted: Sun Jan 31, 2021 2:38 pm
by DIGI3
I had a similar issue with category list but mine was related to showitems: http://dev.cmsmadesimple.org/bug/view/12395

JoMorg is planning to improve that, so you might want to add a comment to the bug report for your issue too as it's probably related.

A short term workaround is to use a UDT to sort the array first, or javascript/jquery to sort it on the user end.

[Solved] Lise sorting on Sub-category

Posted: Mon Feb 01, 2021 9:07 pm
by musicscore
Thanks DIGI3

I submitted a bug report.
To sort the subcategories on my site a created a UDT.

Code: Select all

$categories = $params['categories'];

$keys = array_column($categories, 'position');
array_multisort($keys, SORT_ASC, $categories);
$smarty->assign('categories', $categories);
This sorts all the categories on their position in the backend categories tab of the lise module.

Thanks for your help