Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • friends1976 Friend
    #131314

    I would like the CategoriesList module to list the categories by the order I select rather than the ID joomla gives when creating them. Is there a way to do this? Thank you very much!

    Sherlock Friend
    #262145

    Hi
    You can edit mod_ja_categorieslist.php(modulesmod_ja_categorieslist folder)
    you will see those lines:

    switch ( $ordering ) {
    case 'alpha':
    $order = 'a.name ASC';
    break;

    case 'category':
    case 'popular':
    case 'newest':
    case 'oldest':
    default:
    $order = 'a.name DESC';
    }
    $where = ($secid) ? "n AND a.section IN (".$secid.")" : "";

    $query = "SELECT a.id,a.title, a.description AS text, '' AS created,"
    . " '2' AS browsernav,"
    . " s.id AS secid, a.id AS catid,"
    . " CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug"
    . "n FROM #__categories AS a"
    . "n INNER JOIN #__sections AS s ON s.id = a.section"
    . "n LEFT JOIN #__menu AS m ON m.componentid = a.id"
    . "n WHERE a.published = 1"
    . "n AND s.published = 1"
    . ' AND a.access <= '.(int) $user->get('aid')
    . ' AND s.access <= '.(int) $user->get('aid')
    . $where
    . "n ORDER BY $order"
    . "n LIMIT 0, $limit";
    $db->setQuery( $query );

    $rows = $db->loadObjectList();
    That is code get categories, Order by $order, you can change as you want

    friends1976 Friend
    #262282

    I have no idea what to change the code to. I want it to order the categories by Order # not ID. Can you suggest the change? Thank you.

    Sherlock Friend
    #262303

    Hi
    you can change

    $order = 'a.name DESC';

    to

    $order = 'a.ordering DESC';

    friends1976 Friend
    #262318

    I tried to change the code to the following:

    switch ( $ordering ) {
    case ‘alpha’:
    $order = ‘a.ordering DESC’;
    break;

    case ‘category’:
    case ‘popular’:
    case ‘newest’:
    case ‘oldest’:
    default:
    $order = ‘a.ordering DESC’;

    but it didn’t work. This is how it looks in the admin…


    Sherlock Friend
    #262321

    You can change like above but change DESC to ASC

    friends1976 Friend
    #262331

    You can tell I know sooo much about this! LOL!

    Thank you, thank you, thank you!!! 😀

Viewing 7 posts - 1 through 7 (of 7 total)

This topic contains 7 replies, has 2 voices, and was last updated by  friends1976 16 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum