Comment to 'Sorting of Featured Events block'
  • I asked ChatGPT for a recommendation and here is it's suggestion:

    1. Add a tiny child class that forces ascending order

    Create (or upload) this file inside the Events module, e.g.

    modules/boonex/events/classes/BxEvFeaturedStartAsc.php:

    <?php
    // Featured events, sorted by event_start ASC (soonest first)
    class BxEvFeaturedStartAsc extends BxEventsSearchResultFeatured
    {
        protected function getAlterOrder ()
        {
            // Use event_start not added, and ASC so August comes before October
            return ['order' => "`bx_events_entries`.`event_start` ASC"];
        }
    }
    (If you want the reverse again later, just switch ASC↔DESC.)
    

    ### 2 Tell the homepage block to load that class

    Edit the content column of the block in sys_pages_blocks (or via Studio → Pages → your block → “Code view”) so it includes two override parameters:

    a:3:{
        s:6:"module";s:9:"bx_events";
        s:6:"method";s:15:"browse_featured";
        s:6:"params";a:3:{
            i:0;s:7:"gallery";                       // existing view mode
            s:20:"override_class_name";s:21:"BxEvFeaturedStartAsc";
            s:20:"override_class_file";s:56:"modules/boonex/events/classes/BxEvFeaturedStartAsc.php";
        }
    }
    
    

    (Leave the rest exactly as it was.)

    ### 3 Clear caches

    • Studio → Dashboard → Clear cache, or
    • delete everything inside /cache/ and /cache_public/, or
    • run php upgrade.php cleanup from the console.

    Will the above suggestion work, or will it mess up everything?