SBPB Article Addon does Not Sort By Latest Correctly - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

SBPB Article Addon does Not Sort By Latest Correctly

CE

Chris Elliott

Template 3 years ago

Using Folium quickstart, when I create a page using Articles addon, and choosing "Ordering = Latest", ordering is not correct when displaying articles.

I note that the components/com_sppagebuilder/helpers/articles.php script does not even look for that value: around line 73:

    // has order by
    if ($ordering == 'hits') {
        $query->order($db->quoteName('a.hits') . ' DESC');
    } elseif($ordering == 'featured') {
        $query->where($db->quoteName('a.featured') . ' = ' . $db->quote(1));
        $query->order($db->quoteName('a.publish_up') . ' DESC');
    } elseif($ordering == 'oldest') {
        $query->order($db->quoteName('a.publish_up') . ' ASC');
    } elseif($ordering == 'alphabet_asc') {
        $query->order($db->quoteName('a.title') . ' ASC');
    } elseif($ordering == 'alphabet_desc') {
        $query->order($db->quoteName('a.title') . ' DESC');
    } elseif($ordering == 'random') {
        $query->order($query->Rand());  
    } else {
        $query->order($db->quoteName('a.publish_up') . ' DESC');
    }

by adding:

    } elseif($ordering == 'latest') {
        $query->order($db->quoteName('a.created') . ' DESC');

within this if block, I can now get ordering working correctly.

Please advise if this is a bug?

0
1 Answers
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 3 years ago #48093

Hello Chris Elliott

I have not found this issue with Folium or SP Page Builder. It works without the line too. The Articles are sorted according to the created date.

Best regards

0