Hello,
I have a problem: How can i make phoca gallery sort subcategories by id reverse? I want the subcategory width the largest id to be at the first place. Which file i need to edit and how?
Thx for help!
Balazs
Subcategories sort by id
-
Balazs
- Phoca Member

- Posts: 13
- Joined: 17 Nov 2008, 16:49
Subcategories sort by id
Last edited by Balazs on 16 Jan 2009, 11:14, edited 1 time in total.
- caro84g
- Phoca Hero

- Posts: 1369
- Joined: 11 Feb 2008, 17:52
- Location: Holland
- Contact:
Re: Subcategories sort
Hi,
go in the backend to categories. Change the order of your subcategories by typing the right number in the boxes. Press the floppy image on top of this row.
It's just like you save the order of menu-items in Joomla!
Regards, Carolien
go in the backend to categories. Change the order of your subcategories by typing the right number in the boxes. Press the floppy image on top of this row.
It's just like you save the order of menu-items in Joomla!
Regards, Carolien
Please ask your support questions in the forums and not via PM - I delete those PM's
Backup before you do any major change to your website (and test first)
Backup before you do any major change to your website (and test first)
-
Balazs
- Phoca Member

- Posts: 13
- Joined: 17 Nov 2008, 16:49
Re: Subcategories sort
Hi,
I got at least 4000-5000 subcategories, it would take very long time. I could modify the order of the main categories by editing the view file of the mvc. How can i do the same thing width subcategires? Which file contains the code which sorts the subcategories?
Regarsd, Balazs
I got at least 4000-5000 subcategories, it would take very long time. I could modify the order of the main categories by editing the view file of the mvc. How can i do the same thing width subcategires? Which file contains the code which sorts the subcategories?
Regarsd, Balazs
-
zocha
- Phoca Member

- Posts: 23
- Joined: 12 Nov 2008, 14:25
Re: Subcategories sort
Wouldn't be easier to update the value of order column directly in db? Something like creating temporary table with category_id and max_ordering columns then:Balazs wrote:I got at least 4000-5000 subcategories, it would take very long time. I could modify the order of the main categories by editing the view file of the mvc.
Code: Select all
INSERT INTO temp
SELECT parent_id, max(ordering)
FROM jos_phocagallery_categories
GROUP BY parent_id;
UPDATE jos_phocagallery_categories, temp
SET jos_phocagallery_categories.ordering=temp.max_ordering - jos_phocagallery_categories.ordering
WHERE jos_phocagallery_categories.parent_id=temp.category_idNot tested. Do some tests with copied jos_phocagallery_categories table.
Łukasz Indeka
Joomla VirtueMart
Joomla VirtueMart
-
zocha
- Phoca Member

- Posts: 23
- Joined: 12 Nov 2008, 14:25
Re: Subcategories sort by id
Or even simplier:
where 100000000 would be maximum id value or just something very big.
Code: Select all
UPDATE jos_phocagallery_categories
SET jos_phocagallery_categories.ordering=100000000 - jos_phocagallery_categories.id
Łukasz Indeka
Joomla VirtueMart
Joomla VirtueMart
-
Balazs
- Phoca Member

- Posts: 13
- Joined: 17 Nov 2008, 16:49
Re: Subcategories sort by id
Hi,
I solved the problem. I edited the view part of the component to read and show the items backward instead of forward.
In the /.../views/category/tmpl/default.php file I deleted the line 75, and write in the following:
for($key = count($this->items) - 1; $key >= 0; $key--) {
$value = $this->items[$key];
instead of this: foreach($this->items as $key => $value) {
It works fine.
I solved the problem. I edited the view part of the component to read and show the items backward instead of forward.
In the /.../views/category/tmpl/default.php file I deleted the line 75, and write in the following:
for($key = count($this->items) - 1; $key >= 0; $key--) {
$value = $this->items[$key];
instead of this: foreach($this->items as $key => $value) {
It works fine.
- Jan
- Phoca Hero

- Posts: 49297
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
-
Qbik
- Phoca Member

- Posts: 44
- Joined: 22 Feb 2008, 13:32
- Location: Poland
- Contact:
Re: Subcategories sort by id
So what exactly I have to change to add possibility or to change direction of shoving category (newest first)
on line 75
I Have
$iconBoxWidth = 0;
on line 75
I Have
$iconBoxWidth = 0;