HOW TO ORDER CATEGORY

Phoca Gallery - image gallery extension
fioryp
Phoca Member
Phoca Member
Posts: 25
Joined: 21 Feb 2012, 00:57

HOW TO ORDER CATEGORY

Post by fioryp »

I have put on my left a phocagallery module to show 25 category with image

The category are not ordered with my settings and i not understand which is the order.
All my settings make no changes!
I can set to order by date, by name but when i see my site there is no changes.



website is
http://www.afferniandrea.com
i have the same problem both in left and in center module.
images are not in the correct oder

first i have insert 25 category and i see in the exact order i have create my category since order is not working i have insert again 25 category and in backend i have insered in the exact order i need
now i have 50 category ....i select the last 25 but now again the order is not correct
where is the query in phocagallery component ? what is the exact page that select and order of my category?

I'm not able to order with 25 category the module order the category (it's seems by id) with 50 category i don't know seem for 24 by id and only 1 i don't know!!
I have cancel date time and i have put 0000

When i want to add a module in module settings i see my 50 category in exact order ....it's only in my site that i don't see the order!

I have not subcategory!!

please where is the page that make the query to select category and make order?
in general settings ask me the order in 3 point:
Categories View Settings (List of Categories)
Category View Settings (Categories above Images)
General Settings

I have put the same order in these 3 fields but if i choose title, id, ascendig, descending in frontend there are no changes. there are 10 option but it's not working any option and i dont' understand where the component take the order.

PLEASE I REALLY NEED SUPPORT

i use phocagallery 2.8
Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: HOW TO ORDER CATEGORY

Post by Jan »

Solved in PM.
If you find Phoca extensions useful, please support the project
fioryp
Phoca Member
Phoca Member
Posts: 25
Joined: 21 Feb 2012, 00:57

Re: HOW TO ORDER CATEGORY

Post by fioryp »

The query for
mod_phocagallery_image
is

SELECT cc.id AS idcat, a.id AS idimage FROM #__phocagallery_categories AS cc
LEFT JOIN #__phocagallery AS a ON a.catid = cc.id WHERE a.published = 1 AND a.approved = 1 AND cc.published = 1 AND cc.id IN
(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29)
ORDER BY a.ordering ASC LIMIT 0,25

there is a way to revers the order of
$implodeAllowedCategoriesArray = implode( ',', $category_id);

i have tried with reverse_array function but it's not working....

In my project i will be always in this case
// Category ID - If the category is set, the images are taken from this category and the selection above is not accepted
// 1) User has selected categories
if ($category_id != '' && is_array($category_id) && count($category_id)) {
$implodeAllowedCategoriesArray = implode( ',', $category_id);

i not able to work with array funcion problably....can someone help me?
i need to reverse the order of list of my category in my query...can someone help me to modify the code?
fioryp
Phoca Member
Phoca Member
Posts: 25
Joined: 21 Feb 2012, 00:57

Re: HOW TO ORDER CATEGORY

Post by fioryp »

i have wrote a stupid idea....i have ordered in the query the categoryes as i want to display them
so now my query is
SELECT cc.id AS idcat, a.id AS idimage FROM #__phocagallery_categories AS cc
LEFT JOIN #__phocagallery AS a ON a.catid = cc.id WHERE a.published = 1 AND a.approved = 1 AND cc.published = 1 AND cc.id IN
(29,28,27,26,25)
ORDER BY a.ordering ASC LIMIT 0,5

but i think image order override category order ....

I'm not able to costumize query to order category and take the first image of my category
fioryp
Phoca Member
Phoca Member
Posts: 25
Joined: 21 Feb 2012, 00:57

Re: HOW TO ORDER CATEGORY

Post by fioryp »

i hope to help someone
i have changed the follow code
in mod_phocagallery_image.php

the first change
$image = '';
$query = 'SELECT cc.id AS idcat, a.id AS idimage'
.' FROM #__phocagallery_categories AS cc'
.' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id'
.' WHERE a.published = 1'
.' AND a.approved = 1'
.' AND cc.published = 1'
.' AND cc.id IN ('.$implodeAllowedCategoriesArray.')' // not images from not accessable categories
//.$imageOrdering
.' ORDER BY a.ordering asc, cc.id desc'
.' LIMIT ' . $limit_start . ',' . $limit_count ;


and then
/ QUERIES - all data we need to display the image
if ($images) {

foreach ($images as $valueImage) {
$imageArray[] = $valueImage->idimage;
}
$imageIds = implode(',', $imageArray);

$query = 'SELECT cc.id, cc.alias as catalias, a.id, a.catid, a.title, a.alias, a.filename, a.description, a.extm, a.exts,a.extl, a.exto, a.extw, a.exth, a.extid,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug, '
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__phocagallery_categories AS cc'
. ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id'
. ' WHERE a.id in (' . $imageIds . ')'
//.$imageOrdering;
. ' ORDER BY a.ordering ASC , cc.id';
Post Reply