1

I use for my component a categories table like the categories table from Joomla. So the structure has also the columns from the Joomla categories table: - Table jos_my_categories structure: id, parent_id, lft, rgt, level, title ...

Normally is use for the default sort order: $query->order('c.lft'); which gives a result as example (only categories titles):

  • beta
    • charly
    • alpha
    • beta
  • alpha
    • beta
      • zulu
      • sierra
    • charly
    • alpha
  • charly
    • alpha
    • beta
    • charly

But required is alternate also a tree result in alpbabetical order (also for the sub categories - in all levels):

  • alpha
    • alpha
    • beta
      • sierra
      • zulu
    • charly
  • beta
    • alpha
    • beta
    • charly
  • charly
    • alpha
    • beta
    • charly

How must in this case be the query?

2

I m just trying to answer. You can try

$query->order('c.lft,c.name ASC'); 

If you can provide the Complete Query or code then you might get the exact answer.

  • Thanks for the hint. But this has not helped. The 'lft' column can only have 'unique' values. – mikael Nov 4 '14 at 15:02
  • Okay i have find out that it is not possible to sort alphabetical nested sets. So i must use a own sort method. So we can close my question. – mikael Nov 5 '14 at 10:27
  • When anybody else search the solution, here can you find it: stackoverflow.com/a/20448404/3319544 – mikael Nov 5 '14 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.