-
AuthorPosts
-
Josh Friend
Josh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 11, 2015 at 3:04 am #206256Hi there,
I want the Joomla article categories (not articles) to follow the order as in the Category Manager instead of Ascending or Descending. May I know how to modify the code?
Thank you
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 3:36 am #570074<em>@mredwan 472741 wrote:</em><blockquote>Hi there,
I want the Joomla article categories (not articles) to follow the order as in the Category Manager instead of Ascending or Descending. May I know how to modify the code?
Thank you</blockquote>
Hi there
May i know which view you are mentioned ? At frontend view=categories or in backend ?
Have you checked with Joomla! document about configuration ?Thank you,
Viet Vujooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 3:36 am #735146<em>@mredwan 472741 wrote:</em><blockquote>Hi there,
I want the Joomla article categories (not articles) to follow the order as in the Category Manager instead of Ascending or Descending. May I know how to modify the code?
Thank you</blockquote>
Hi there
May i know which view you are mentioned ? At frontend view=categories or in backend ?
Have you checked with Joomla! document about configuration ?Thank you,
Viet VuJosh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 11, 2015 at 4:08 am #570080Hi Viet Vu,
My question is similar to
http://www.joomlart.com/forums/topic/ja-news-2-order-categories/That thread replies to News2… I’m asking about JA News Pro
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 4:47 am #570089Hi there
It’s require core hacking.
Please check adapter file ( which one you are using ). and adding
$query->order(< your own ordering here >);
Thank you,
Viet VuJosh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 11, 2015 at 5:21 am #570097From website/modules/mod_janewspro/helpers/adapter/content.php ? (for Joomla article)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(‘c.`id`’);
$query->from(‘#__categories AS c’);
$query->where(‘c.`id` IN (‘.rtrim($lwhere, ‘, ‘).’)’);
$query->where(‘c.`language` IN (”.$lang.”, ‘*’)’);
$db->setQuery($query);
$items = $db->loadRowList();
$it=array();
foreach ($items AS $item) {
$it[] = $item[0];
}
$arr_cats = $it;I don’t want Ascending or Descending… I want it to follow the ORDER of the categories in the Category Manager.
So what do I put inside?
$query->order(< your own ordering here >);
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 5:23 am #570098<em>@mredwan 472772 wrote:</em><blockquote>From website/modules/mod_janewspro/helpers/adapter/content.php ? (for Joomla article)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(‘c.`id`’);
$query->from(‘#__categories AS c’);
$query->where(‘c.`id` IN (‘.rtrim($lwhere, ‘, ‘).’)’);
$query->where(‘c.`language` IN (”.$lang.”, ‘*’)’);
$db->setQuery($query);
$items = $db->loadRowList();
$it=array();
foreach ($items AS $item) {
$it[] = $item[0];
}
$arr_cats = $it;I don’t want Ascending or Descending… I want it to follow the ORDER of the categories in the Category Manager.
So what do I put inside?
$query->order(< your own ordering here >);
</blockquote>Hi there
If you can’t work on it. Please provide FTP access. I’ll help you update it.But please note it’s core hacking. You’ll face with your risky and lose your modified with updating in future
Thank you,
Viet VuJosh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 11, 2015 at 5:51 am #570100Yes, I know it’s core hacking on the News Pro module. Unfortunately I’m working on localhost. All I’m asking is… what do I put inside
$query->order(< your own ordering here >);
c.ordering? as I can see from the _categories table, there is no ‘ordering’ column (field)
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 6:48 am #570104<em>@mredwan 472776 wrote:</em><blockquote>Yes, I know it’s core hacking on the News Pro module. Unfortunately I’m working on localhost. All I’m asking is… what do I put inside
$query->order(< your own ordering here >);
c.ordering? as I can see from the _categories table, there is no ‘ordering’ column (field)</blockquote>
Hi there
It’s Joomla logic about ordering. Because you are doing core modify / customize. Please reference Joomla.For sample in backend com_categories if we echo query when doing sorting by Order we’ll have
SELECT a.id, a.title, a.alias, a.note, a.published, a.access, a.checked_out, a.checked_out_time, a.created_user_id, a.path, a.parent_id, a.level, a.lft, a.rgt, a.language,l.title AS language_title,uc.name AS editor,ag.title AS access_level,ua.name AS author_name
FROM #__categories AS a
LEFT JOIN `#__languages` AS l ON l.lang_code = a.language
LEFT JOIN #__users AS uc ON uc.id=a.checked_out
LEFT JOIN #__viewlevels AS ag ON ag.id = a.access
LEFT JOIN #__users AS ua ON ua.id = a.created_user_id
WHERE a.extension = 'com_content' AND (a.published IN (0, 1))
ORDER BY a.lft DESC
Now back with this module, you can apply your own ordering by follow above
c.lft DESC ( or ASC as your needed )Thank you,
Viet Vujooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 6:52 am #570105Hi there
Here is document about this ordering logichttp://www.sitepoint.com/hierarchical-data-database-2/
Thank you,
Viet VuJosh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 11, 2015 at 9:16 am #570131Thank you for your lengthy explanation but it’s still not what I want.
Let me explain another way… For the module, I have 4 categories all at the same level. Their catsid are
“375”,”376″,”377″,”378″So if it’s ASC it will be “375”,”376″,”377″,”378″
If it’s DESC it will be “378”,”377″,”376″,”375″
But what I want is this order
“375”,”377″,”376″,”378″I don’t mind hard-coding in the content.php file. How do I do this?
Do I have to modify or get rid of the following snippet i.e. $arr_cats?
$categoriesSortDir = $params->get(‘cat_ordering’, ‘asc’);
if($categoriesSortDir == ‘desc’){
$arr_cats = array_reverse($arr_cats);
}$lang = JFactory::getLanguage()->getTag();
$lwhere = ”;
foreach ($arr_cats AS $v) {
if ($v != ”) $lwhere .= $v.’, ‘;
}jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 11, 2015 at 1:54 pm #570161<em>@mredwan 472812 wrote:</em><blockquote>Thank you for your lengthy explanation but it’s still not what I want.
Let me explain another way… For the module, I have 4 categories all at the same level. Their catsid are
“375”,”376″,”377″,”378″So if it’s ASC it will be “375”,”376″,”377″,”378″
If it’s DESC it will be “378”,”377″,”376″,”375″
But what I want is this order
“375”,”377″,”376″,”378″I don’t mind hard-coding in the content.php file. How do I do this?
Do I have to modify or get rid of the following snippet i.e. $arr_cats?
$categoriesSortDir = $params->get(‘cat_ordering’, ‘asc’);
if($categoriesSortDir == ‘desc’){
$arr_cats = array_reverse($arr_cats);
}$lang = JFactory::getLanguage()->getTag();
$lwhere = ”;
foreach ($arr_cats AS $v) {
if ($v != ”) $lwhere .= $v.’, ‘;
}
</blockquote>Hi there
# You are trying to hard to category order or follow your backend category ordering ? That’s confusing me.
Prev code you can use for backend ordering.
# But if you want to apply your own thing than after queried . You can do foreach again to rearrange it.If you can’t work on it. Please consider ask for custom work with 3rd developer.
Thank you,
Viet VuJosh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 12, 2015 at 3:03 am #570233Thank you Viet Vu for helping… I finally got it to work!
Josh FriendJosh
- Join date:
- October 2008
- Posts:
- 68
- Downloads:
- 262
- Uploads:
- 11
- Thanks:
- 14
- Thanked:
- 1 times in 1 posts
May 12, 2015 at 3:03 am #735305Thank you Viet Vu for helping… I finally got it to work!
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
May 12, 2015 at 3:04 am #570234Glad to hear that
Thank you,
Viet Vu -
AuthorPosts
This topic contains 16 replies, has 2 voices, and was last updated by jooservices 9 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum