LISE – orderby not working with action="category"?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
10010110
Translator
Translator
Posts: 200
Joined: Tue Jan 22, 2008 9:57 am

LISE – orderby not working with action="category"?

Post by 10010110 »

Trying to sort LISE items by creation date but nothing changes whatever I do.

Code: Select all

{LISEDownloads action='category' category='example1,example2' show_items=1 orderby='item_created|DESC'}
Is there something I’m missing?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: LISE – orderby not working with action="category"?

Post by DIGI3 »

As it's using the category array and not the item array, I don't think you can achieve this using parameters in a single module call. You could probably add a summary call to each category in the category template and apply the sorting there.

So your category template would be something like:

Code: Select all

<!-- categories -->
<ul>
{foreach from=$categories item=category}
  <li class="category-{$category->alias}">
    <a class="category-name" href="{$category->url}">{$category->name} ({$category->items|count})</a>
    {if $category->items|count > 0}
    <ul>
      {LISEtest category=$category->alias orderby='item_created|DESC' template_summary='list'}
    </ul>
    {/if}
  </li>
{/foreach}
<ul>
<!-- categories //-->
with the module call being:

Code: Select all

{LISEtest action='category'}
Then create a summary template something like:

Code: Select all

{if $items|@count > 0}
  {foreach from=$items item=item}
    <li>{$item->title}</li>
  {/foreach}
{/if}
Not getting the answer you need? CMSMS support options
10010110
Translator
Translator
Posts: 200
Joined: Tue Jan 22, 2008 9:57 am

Re: LISE – orderby not working with action="category"?

Post by 10010110 »

Oh man, that’s more complicated than I expected. So, my category template looks like this:

Code: Select all

<!-- categories -->
<div class="downloads">
{foreach $categories as $category}
	{*$category|@print_r*}
	<!-- start loop{$category@iteration} -->
	{if $category->depth == 1}
		{if $category->prevdepth > 1 && $category@iteration != 1}
		</ul>
	</div>
	<!-- end category -->
		{/if}
	<div class="kategorie depth{$category->depth} prevdepth{$category->prevdepth}" id="{$category->alias}">
		<h3>{$category->menutext}</h3>
		{if $category@last}
		<div class="mitteilung hinweis">Momentan gibt es nichts zum Herunterladen.</div>
	</div>
			{continue}
		{/if}
		<ul>
	{else}
		<li class="depth{$category->depth} prevdepth{$category->prevdepth}">
		{if !empty($category->datei)}<a href="{uploads_url}/downloads/{$category->datei}">{/if}
			{$ext=$category->datei|pathinfo:$smarty.const.PATHINFO_EXTENSION|lower}
			{if $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif' || $ext == 'tif' || $ext == 'tiff'}
				{CGSmartImage src="{uploads_url}/downloads/{$category->datei}" filter_resize="w,150" quality="86"}
			{/if}
			{$category->menutext}
		{if !empty($category->datei)}</a>{/if}
		{if !empty($category->beschreibung)}<div class="beschreibung">{$category->beschreibung}</div>{/if}
		{if !empty($category->datum)}<div class="datum">{$category->datum}</div>{/if}
		</li>
		{if $category@last}
			</ul>
		</div>
		<!-- last -->
		{/if}
	{/if}
<!-- end -->
{/foreach}
</div>
<!-- categories //-->
and this is what it looks like in reality:
https://tinyurl.com/yhdqqrma

(the two columns are two separate module calls; the important one is the one in the left column which calls several categories)

I’ve also defined a few custom fields. Basically what I need is sorting by date (specified in custom field) in descending order. ???
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: LISE – orderby not working with action="category"?

Post by DIGI3 »

I don't think it's as complicated as you might think. Just don't use show_items in the module tag, and add a module call (with default action, category, and your sort parameter) into your category template where you want to show items.
Not getting the answer you need? CMSMS support options
10010110
Translator
Translator
Posts: 200
Joined: Tue Jan 22, 2008 9:57 am

Re: LISE – orderby not working with action="category"?

Post by 10010110 »

Thanks, it’s not quite as I hoped to achieve it but it works nicely.
Locked

Return to “Modules/Add-Ons”