Page 1 of 1

Subcategories sort by id

Posted: 15 Jan 2009, 15:20
by Balazs
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

Re: Subcategories sort

Posted: 15 Jan 2009, 21:32
by caro84g
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

Re: Subcategories sort

Posted: 16 Jan 2009, 11:12
by Balazs
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

Re: Subcategories sort

Posted: 16 Jan 2009, 12:17
by zocha
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.
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:

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_id
So new value of ordering would be the maximum in the category - current value.

Not tested. Do some tests with copied jos_phocagallery_categories table.

Re: Subcategories sort by id

Posted: 16 Jan 2009, 12:24
by zocha
Or even simplier:

Code: Select all

UPDATE jos_phocagallery_categories
SET jos_phocagallery_categories.ordering=100000000 - jos_phocagallery_categories.id
where 100000000 would be maximum id value or just something very big.

Re: Subcategories sort by id

Posted: 25 Jan 2009, 18:22
by Balazs
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.

Re: Subcategories sort by id

Posted: 26 Jan 2009, 15:03
by Jan
ok

Re: Subcategories sort by id

Posted: 25 Feb 2009, 16:05
by Qbik
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;