If this is your first visit, check our documentation. To post, register or login.

BannersAll sort order fix

Started by twitchtoo on 14 Mar 2019, 5:03 AM · Views: 10,927

Results 1 to 4 of 4
14 Mar 2019, 5:03 AM
#1
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

BannersAll sort order fix

Minor change may help correct sort order issues in BannersAll

Condition: Sort order is not being followed - Stock Responsive Classic Template.

Found in:
includes/templates/YOUR_TEMPLATE/sideboxes/tpl_banner_box_all.php
line 22
$sql = "select banners_id from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter . " order by banners_sort_order";

The Fix:
$sql = "select banners_id from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter . " order by banners_sort_order asc"; // Twitch fix banners display sort order

Now my banners follow the correct sort order.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

14 Mar 2019, 12:30 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: BannersAll sort order fix

lat9:

What version of MySQL? The default for the ORDER BY clause is ASC (https://www.w3schools.com/sql/sql_orderby.asp_/

It may be an indexing issue based on this mysql document: https://dev.mysql.com/doc/refman/8.0/en/order-by-optimization.html

Effectively indicating that optimization may use the index instead of the value(s) in the order by field if optimization identifies that the index is faster...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Mar 2019, 5:32 PM
#4
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: BannersAll sort order fix

There is an SQL version mismatch, this is the fix for when you have no choice and it needs to work. This also prevents 'guessing' or any random/inconsistent looking sort order.

Solid state coding is more reliable.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian