New option in Sort article

News Show Pro GK5 - flexible, responsive and easily extendable free Joomla module support forum.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Mon Jan 19, 2015 10:57 pm
Hello,
I have a problem with News Show Pro GK5. I wanted to select 5 closest events (from today until future) from K2 category based on data created.
In the folder modules/mod_news_pro_gk5/data_sources/com_k2 I added a file configuration.json:
Code: Select all
"supported_options": {
      "sort_values": {
         "new sort": "newoption",
      },

And In the file model.php from the same folder for the funtion getArticles() I added:
Code: Select all
if($config['news_sort_value'] == ‘newoption’) {
            $sql_where .= ' AND (content.created >= NOW())';
        }


And now here comes the question. Modification only applies to one module and when I want to add another module displaying another K2 category, I see a screen saying there are no articles to display. Where is my mistake? What did I forget about?
User avatar
Fresh Boarder

GK User
Thu Jan 22, 2015 8:20 am
Hello,

Please remember that the news_sort_value is also used in the following code fragment what can cause an error:

Code: Select all
if(
         $config['news_sort_value'] == 'random' ||
         $config['news_sort_value'] == 'user'
      ) {
         $order_options = ' RAND() ';
      }else if($config['news_sort_value'] == 'rating') {
         $order_options = ' (content_rating.rating_sum / content_rating.rating_count) '.$config['news_sort_order'];
         $rating_join = 'LEFT JOIN #__k2_rating AS content_rating ON content_rating.itemID = content.id';
      }else{ // when sort value is different than random
         $order_options = ' content.'.$config['news_sort_value'].' '.$config['news_sort_order'].' ';
      }   
User avatar
Administrator


cron