WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • ONEFORALL - Group sorting bug
  • Print
Pages: [1]   Go Down

Author Topic: ONEFORALL - Group sorting bug  (Read 10906 times)

Offline CodeALot

  • Posts: 579
  • Gender: Male
ONEFORALL - Group sorting bug
« on: January 29, 2020, 06:06:12 PM »
If you use field type GROUP in OneForAll and SHOW GROUP HEADERS on, SORT BY GROUP on, the sorting goes wrong once you use more than 10 groups.
Sorting is done like:

1
10
11
2
3
4
5 --- etc.
 
Does anyone have a brilliant idea how to solve this?
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8916
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: ONEFORALL - Group sorting bug
« Reply #1 on: January 29, 2020, 08:42:53 PM »
Hi, try this. Find in view_overview.php the block.
Code: [Select]
// If a group field is defined order by group and position
Last line of this block is
Code: [Select]
          .'ORDER BY `f`.`value` '.$group_order.', `i`.`position` '.$position_order.$limit_sql;
Change it to
Code: [Select]
          .'ORDER BY LENGTH(`f`.`value`), `f`.`value` '.$group_order.', `i`.`position` '.$position_order.$limit_sql;

Only this is added:
LENGTH(`f`.`value`),
Hope it helps.
Logged
https://onkel-franky.de

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: ONEFORALL - Group sorting bug
« Reply #2 on: January 29, 2020, 10:55:46 PM »
You're the best. That solved it. MANY thanks!
Logged

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: ONEFORALL - Group sorting bug
« Reply #3 on: January 29, 2020, 11:01:33 PM »
If it is certain that 'f.value' contains a number (integer), it is easier to evaluate this value in the sorting as a number.
This can be achieved with the SQL function CAST(expression AS datatype)'.
Code: [Select]
  .'ORDER BY CAST(`f`.`value` AS UNSIGNED) '.$group_order.', `i`.`position` '.$position_order.$limit_sql;
see:
https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast (function cast and description of types in function convert)
Logged
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"We need education to cope with digitalization - and NOT the digitalization of education.!"

Tägliches Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • ONEFORALL - Group sorting bug
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2