Page 1 of 1

LISE orderby custom field not working

Posted: Sat Mar 16, 2024 4:42 pm
by 10010110
I have a LISE instance where I’m trying to sort by custom field but for some reason whenever I add the property it’s not showing anything.

It’s a repertoire list with the song title as item title and the original performer as custom field named “interpret”.
Bildschirmfoto 2024-03-16 um 17.33.11.png
Bildschirmfoto 2024-03-16 um 17.32.51.png
I’m simply calling it with this tag:

Code: Select all

{LISERepertoire orderby='custom_interpret, item_title'}
The summary template looks like this:

Code: Select all

{$count=$items|count}
{$split = $count/2}
{$split = $split|round}
{if $items|count > 0}
	<table>
		<thead>
			<tr>
				<th scope="col">Originalinterpret</th>
				<th scope="col">Titel</th>
			</tr>
		</thead>
		<tbody>
			<!-- items -->
			{foreach $items as $item}
			<!-- item -->
			<tr>
				<th scope="row">
					{if !empty($item->fielddefs)}
						{foreach $item->fielddefs as $fielddef}
							{$fielddef.value}	
						{/foreach}
					{/if}
				</th>
				<td>{$item->title}</td>
			</tr>
			<!-- item //-->
				{if $count > 20 AND $item@index+1 == $split}
		</tbody>
	</table>
	<table>
	<thead>
		<tr>
			<th scope="col">Originalinterpret</th>
			<th scope="col">Titel</th>
		</tr>
	</thead>
	<tbody>
				{/if}
			{/foreach}
		<!-- items //-->
		</tbody>
	</table>
{/if}
It creates two tables if the list is longer than 20 items.
Everything shows up if I don’t use the orderby property or if I’m just doing

Code: Select all

orderby='item_title'
but as soon as I do orderby='custom_interpret, item_title' it doesn’t show anything and there is also no error log message, so I’m stumped.

[edit]
I also tried {$item|print_r} in the summary template and without the custom field order property it prints an array of LISEItem objects, but with the property value it shows an empty array. ??? I have the feeling, it’s a bug in the module.
[/edit]

Re: LISE orderby custom field not working

Posted: Sun Mar 17, 2024 1:54 pm
by DIGI3
I wasn't able to recreate this problem, I tried a lot of different combinations. One thing that could be considered a bug is that if you use orderby_custom and an item doesn't have that field populated, it will be omitted. My expectation is that it would just be at the top/bottom.

The only thing I can think of is that there's something strange about the alias of that field, like a hidden character or something. Try changing the alias of that field, then updating your template to match. Or try sorting with different fields to see if it's unique to that one.

Re: LISE orderby custom field not working

Posted: Sun Mar 17, 2024 2:11 pm
by DIGI3
Also realizing this could be a strict mode issue with mysql - if you have control to either turn off strict mode or disable ONLY_FULL_GROUP_BY mode, you might want to try that. See https://stackoverflow.com/questions/239 ... l-group-by