Page 1 of 1

category list order

Posted: 05 Oct 2021, 11:02
by neilolney
On my site, when using the frontend control panel, a new sub-category can be created easily. When images are then uploaded into the sub-category, the sub-category drop-down list does not appear to be ordered, as sometimes the new category is towards the top, sometimes in the middle. On my site I have a lot of sub-categories, that need to be ordered with the most recently created sub categories listed first. I have tried changing the setting in the control panel but it has no effect on this list.

I have found the code which generates the drop-down list in:
/components/com_phocagallery/views/user/tmpl/default_images.php

on row 84
<?php echo $this->listsimage['catid']; ?>

How can I either add to this line to order it by newest first, or where acounts is this list created please?

Re: category list order

Posted: 12 Oct 2021, 01:06
by Jan
Hi, the problem with catgories is, they need to build the tree, so this is whay ordering them e.g. by newest ist no possible sometimes.

$this-$listimage['catid'] array is defined in this file:

components/com_phocagallery/views/user/view.html.php

Jan

Re: category list order

Posted: 12 Oct 2021, 10:42
by neilolney
Thanks for the reply. I get the bit about the tree order, however my structure is one main category, then every other category is a subcat of the main category, therefore i should be able to have them ordered by date, correct?

I have found the bit of code you mentioned above:
$lists_image['catid'] = Joomla\CMS\HTML\HTMLHelper::_( 'select.genericlist', $tree, 'filter_catid_image', $javascript , 'value', 'text', $filter_catid_image );

and the definition of $filter_catid_image:
$filter_catid_image = $app->getUserStateFromRequest( $this->_context_image.'.filter_catid', 'filter_catid_image', 0, 'int' );

How can I change either of these to order by date created or ID, so the newest one is first please?

Re: category list order

Posted: 12 Oct 2021, 15:16
by neilolney
Funnily enough, before i upgraded to the latest version, the categories were in date order, but i have no idea what the changes were or even if they caused this issue? I cant recall what version i upgraded from, but it was a fairly substantial upgrade.

Re: category list order

Posted: 19 Oct 2021, 20:09
by Jan
Hi, it does not matter how much levels there are, the tree needs to be completed even there is only one level. Can you paste a screenshot where exactly you want to order the items?

Jan

Re: category list order

Posted: 20 Oct 2021, 17:20
by neilolney
Thanks for the reply Jan.

Here's a screenshot of where I am trying to organize the list. It is in the front end gallery management when trying to upload images. Its on the Images tab:

I have tried to insert the image using the BBCode tags and following the instructions, however according to the editor my BBCode for img is off. Here's the link (with some additional spaces):

https: // imgur.com/a/rIULTG6

Re: category list order

Posted: 25 Oct 2021, 00:53
by Jan
Hi, then the best way is to edit the frontend output (user) and change the select box output.

The default is set here:
components/com_phocagallery/views/user/view.html.php line cca 361

Jan

Re: category list order

Posted: 17 Jan 2022, 14:13
by neilolney
Thanks for the pointer in the right direction. Next question is how do i change it to order by the 'created date'?

$lists_image['catid'] = Joomla\CMS\HTML\HTMLHelper::_( 'select.genericlist', $tree, 'filter_catid_image', $javascript , 'value', 'text', $filter_catid_image );

Many many thanks

Re: category list order

Posted: 24 Jan 2022, 00:00
by Jan
Hi, you cannot change the order of the tree, the tree is based on level ordering - first root categories, then subcategories, etc. So the only one solution is to change the tree function completely.

Jan