category list order

Phoca Gallery - image gallery extension
neilolney
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 10 Sep 2021, 09:30

category list order

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: category list order

Post 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
If you find Phoca extensions useful, please support the project
neilolney
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 10 Sep 2021, 09:30

Re: category list order

Post 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?
neilolney
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 10 Sep 2021, 09:30

Re: category list order

Post 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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: category list order

Post 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
If you find Phoca extensions useful, please support the project
neilolney
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 10 Sep 2021, 09:30

Re: category list order

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: category list order

Post 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
If you find Phoca extensions useful, please support the project
neilolney
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 10 Sep 2021, 09:30

Re: category list order

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: category list order

Post 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
If you find Phoca extensions useful, please support the project
Post Reply