v 3.3.6 I think a bug

Support forum dedicated to free and advanced Joomla content presentation module with various layout options and data sources support.
GK User
Thu Jan 17, 2013 12:59 am
Hi i see the version 3.3.6 when in data source select news order By frontage/featured order
the module don show the article and in write: Error: No articles to display.
I think is a bug, but the same problem I have con 3.1.3.

I change the template and the templae is GK news.
User avatar
Senior Boarder

teitbite
Thu Jan 17, 2013 3:58 am
Hi

This message is visible if a configuration of module is wrong. Please send na an access to Your joomla panel and tell me which module should I check.
User avatar
Moderator

GK User
Thu Jan 17, 2013 4:59 pm
I think is not an error of configuration because i try i much way,
upgrading, re-istalling the module on a new istallation of joomla,
copy the configuration of a quick start site.

Now i'm working in a test site because I want change template
I send the information of account at the support desk.

Thanks
User avatar
Senior Boarder

teitbite
Fri Jan 18, 2013 3:01 am
Hi

Please send the access to me via PM or my mail. A different person is handling support desk question so He will not know where to send it or specifie it should go to Teitbite.
User avatar
Moderator

GK User
Sat Jan 19, 2013 2:17 pm
I send my date account in your e-mail :-)

Thanks a lot
User avatar
Senior Boarder

teitbite
Sun Jan 20, 2013 10:54 am
Hi

I guess You're right. I wasn't able to make it work either. PLease send me an ftp access so I'll try to fix it.
User avatar
Moderator

GK User
Mon Jan 21, 2013 7:49 pm
Ok - i send you the ftp account

Thanks
regards
User avatar
Senior Boarder

teitbite
Wed Jan 23, 2013 1:43 am
Hi

I wasn't able to fix it myself. I had send Your access to programmers. Hopefully they can help.
User avatar
Moderator

GK User
Wed Jan 23, 2013 2:41 pm
So now I have to wait only?
User avatar
Senior Boarder

teitbite
Thu Jan 24, 2013 1:07 am
Hi

Dziudek fixed this bug already :) A package will be updted soon. Meanwhile please replace this file mod_news_pro_gk4/gk_classes/gk.source.joomla.php with below code:

Code: Select all
<?php
/**
* News class
* @package News Show Pro GK4
* @Copyright (C) 2009-2011 Gavick.com
* @ All rights reserved
* @ Joomla! is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: GK4 1.0 $
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
class NSP_GK4_Joomla_Source {   
// Method to get sources of articles
function getSources($config) {
//
$db = JFactory::getDBO();
// if source type is section / sections
$source = false;
$where1 = '';
$where2 = '';
//
if($config['data_source'] == 'com_categories'){
$source = $config['com_categories'];
$where1 = ' c.id = ';
$where2 = ' OR c.id = ';
} else {
$source = strpos($config['com_articles'],',') !== false ? explode(',', $config['com_articles']) : $config['com_articles'];
$where1 = ' content.id = ';
$where2 = ' OR content.id = ';   
}
//
$where = ''; // initialize WHERE condition
// generating WHERE condition
for($i = 0;$i < count($source);$i++){
if(count($source) == 1) $where .= (is_array($source)) ? $where1.$source[0] : $where1.$source;
else $where .= ($i == 0) ? $where1.$source[$i] : $where2.$source[$i];   
}
//
$query_name = '
SELECT DISTINCT
c.id AS CID
FROM
#__categories AS c
LEFT JOIN
#__content AS content
ON
c.id = content.catid
WHERE
( '.$where.' )
AND
c.extension = '.$db->quote('com_content').'
AND
c.published = 1
';   
// Executing SQL Query
$db->setQuery($query_name);
//
return $db->loadObjectList();
}
// Method to get articles in standard mode
function getArticles($categories, $config, $amount) {   
//
$sql_where = '';
//
if($categories) {   
$j = 0;
// getting categories ItemIDs
foreach ($categories as $item) {
$sql_where .= ($j != 0) ? ' OR content.catid = '.$item->CID : ' content.catid = '.$item->CID;
$j++;
}   
}
// Overwrite SQL query when user set IDs manually
if($config['data_source'] == 'com_articles' && $config['com_articles'] != ''){
// initializing variables
$sql_where = '';
$ids = explode(',', $config['com_articles']);
//
for($i = 0; $i < count($ids); $i++ ){   
// linking string with content IDs
$sql_where .= ($i != 0) ? ' OR content.id = '.$ids[$i] : ' content.id = '.$ids[$i];
}
}
// Arrays for content
$content_id = array();
$content_iid = array();
$content_cid = array();
$content_title = array();
$content_text = array();
$content_date = array();
$content_date_publish = array();
$content_author = array();
$content_catname = array();
$content_hits = array();
$content_email = array();
$content_rating_sum = array();
$content_rating_count = array();
$content_images = array();
$news_amount = 0;
// Initializing standard Joomla classes and SQL necessary variables
$db = JFactory::getDBO();
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$access = JComponentHelper::getParams( 'com_content' )->get('show_noauth');

if($config['unauthorized'] == 1) {
$access_con = '';
} else {
$access_con = ' AND content.access IN ('. implode(',', JFactory::getUser()->authorisedLevels()) .') ';
}
$date = JFactory::getDate("now", $config['time_offset']);
$now = $date->toMySQL();
$nullDate = $db->getNullDate();
// if some data are available
if(count($categories) > 0){
// when showing only frontpage articles is disabled
$frontpage_con = ($config['only_frontpage'] == 0) ?
(($config['news_frontpage'] == 0) ? ' AND content.featured = 0 ' : '' ) :
(($config['news_frontpage'] == 0) ? ' AND content.featured = 0 ' : ' AND content.featured = 1 ' );
$since_con = '';
if($config['news_since'] !== '') $since_con = ' AND content.created >= ' . $db->Quote($config['news_since']);
// Ordering string
$order_options = '';
// When sort value is random
if($config['news_sort_value'] == 'random') {
$order_options = ' RAND() ';
}else{ // when sort value is different than random
if($config['news_sort_value'] != 'fordering') $order_options = ' content.'.$config['news_sort_value'].' '.$config['news_sort_order'].' ';
else $order_options = ' frontpage.ordering '.$config['news_sort_order'].' ';
}   
// language filters
$lang_filter = '';
if (JFactory::getApplication()->getLanguageFilter()) {
$lang_filter = ' AND content.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').') ';
}

if($config['data_source'] != 'com_all_articles') {
$sql_where = ' AND ( ' . $sql_where . ' ) ';
}
// creating SQL query
$query_news = '
SELECT
content.id AS IID,
'.($config['use_title_alias'] ? 'content.alias' : 'content.title').' AS title,
content.introtext AS text,
content.created AS date,
content.publish_up AS date_publish,
content.hits AS hits,
content.images AS images,
content.featured AS frontpage
FROM
#__content AS content
WHERE
content.state = 1
'. $access_con .'
AND ( content.publish_up = '.$db->Quote($nullDate).' OR content.publish_up <= '.$db->Quote($now).' )
AND ( content.publish_down = '.$db->Quote($nullDate).' OR content.publish_down >= '.$db->Quote($now).' )
'.$sql_where.'
'.$lang_filter.'
'.$frontpage_con.'
'.$since_con.'
ORDER BY
'.$order_options.'
LIMIT
'.($config['startposition']).','.($amount + (int)$config['startposition']).';
';   
// run SQL query
$db->setQuery($query_news);
// when exist some results
if($news = $db->loadObjectList()) {
// generating tables of news data
foreach($news as $item) {   
$id = $item->ID;
if($config['unauthorized'] == 0) {
if (!($access || in_array($item->access, $authorised))) {
$id = 0;
}
}
$content_iid[] = $item->IID; // news IDs
$content_title[] = $item->title; // news titles
$content_text[] = $item->text; // news text;
$content_date[] = $item->date; // news dates
$content_date_publish[] = $item->date_publish; // news dates
$content_hits[] = $item->hits; // news hits
$content_images[] = $item->images; // news images
  $news_amount++;   // news amount
}
}

// generate SQL WHERE condition
$second_sql_where = '';
for($i = 0; $i < count($content_iid); $i++) {
$second_sql_where .= (($i != 0) ? ' OR ' : '') . ' content.id = '.$content_iid[$i];
}   
// second SQL query to get rest of the data and avoid the DISTINCT
$second_query_news = '
SELECT
content.id AS IID,
content.access AS access,
categories.title AS cat,
users.email AS author_email,
'.$config['username'].' AS author,
content_rating.rating_sum AS rating_sum,
content_rating.rating_count AS rating_count,
CASE WHEN CHAR_LENGTH(content.alias)
THEN CONCAT_WS(":", content.id, content.alias)
ELSE content.id END as ID,
CASE WHEN CHAR_LENGTH(categories.alias)
THEN CONCAT_WS(":", categories.id, categories.alias)
ELSE categories.id END as CID
FROM
#__content AS content
LEFT JOIN
#__categories AS categories
ON categories.id = content.catid
LEFT JOIN
#__users AS users
ON users.id = content.created_by
LEFT JOIN
#__content_rating AS content_rating
ON content_rating.content_id = content.id
WHERE
'.$second_sql_where.'
ORDER BY
'.$order_options.'
';
// run the query
$db->setQuery($second_query_news);
// when exist some results
if($news2 = $db->loadObjectList()) {
// generating tables of news data
foreach($news2 as $item) {   
$pos = array_search($item->IID, $content_iid);
$id = $item->ID;
if (!($access || in_array($item->access, $authorised))) { $id = 0; }
$content_id[$pos] = $id; // news IDs
$content_cid[$pos] = $item->CID; // news CIDs
$content_author[$pos] = $item->author; // news author
$content_catname[$pos] = $item->cat; // news category name
$content_email[$pos] = $item->author_email; // news author emails
$content_rating_sum[$pos] = $item->rating_sum; // news rating sum
$content_rating_count[$pos] = $item->rating_count; // news rating count
}
}   
}
// Returning data in hash table
return array(
"ID" => $content_id,
"IID" => $content_iid,
"CID" => $content_cid,
"title" => $content_title,
"text" => $content_text,
"date" => $content_date,
"date_publish" => $content_date_publish,
"author" => $content_author,
"catname" => $content_catname,
"hits" => $content_hits,
"email" => $content_email,
"news_amount" => $news_amount,
"rating_sum" => $content_rating_sum,
"rating_count" => $content_rating_count,
"images" => $content_images
);
}
}
/* EOF */
User avatar
Moderator

GK User
Sun Feb 10, 2013 3:46 am
I attend the versione 3.3.7 but also the versione 3.3.7 have the same bug, and the code that you post here dont resolve the problem.
in data source when select news order By frontage/featured order
the module don show the article and in write: Error: No articles to display.

I hope that is possbile to resolve
Thanks
regards
Lorenzo
User avatar
Senior Boarder

GK User
Sun Feb 10, 2013 3:58 am
I have find a solution. I take this file this file mod_news_pro_gk4/gk_classes/gk.source.joomla.php from
version 3.3.5 and overwrite on version 3.3.7.

I have put the file in attachement
User avatar
Senior Boarder

teitbite
Mon Feb 11, 2013 6:20 pm
Hi

Great that You have found solution. Can You attache this file for other users and so I'll be able to show this to programmers. I'm guessing they missed this problem or overwrite it already :(
User avatar
Moderator

GK User
Fri Mar 08, 2013 2:17 am
Hi,
I installed version 3.3.7 (mod_news_pro_gk4_J! 30_compatible.zip) and would like to make sure that the items shown from the form they were only "frontpage / featured" but I am having the same problem mentioned in this post.
I performed all of the steps, copied and pasted the code in gk.source.joomla.php, etc., but just activated the "By frontend / featured order" is printed message: "Oops, you've encountered an error 0 ".
I would like to know if there is a version with this problem fixed.
Thanks in advance and I apologize for my bad English ... :)
User avatar
Fresh Boarder

teitbite
Fri Mar 08, 2013 11:01 am
Hi

Please send me an access to Your joomla panel and FTP. I'll show this to programmers.
User avatar
Moderator

teitbite
Fri Mar 08, 2013 12:02 pm
Access send to programmers.
User avatar
Moderator

GK User
Fri Mar 08, 2013 12:50 pm
teitbite wrote:Access send to programmers.

Thanks a lot! :D
User avatar
Fresh Boarder

teitbite
Wed Mar 13, 2013 12:34 am
Hi

Programmers has fixed the issue. An updated version of NSP will be available tomorrow for download.
User avatar
Moderator

GK User
Thu Apr 25, 2013 7:29 pm
Hi,

I don't see 3.3.7 available, at least not for Joomla 3.0. But I was able to fix this issue. In gk.source.k2.php or gk.source.joomla.php (around line 110 - 128) look for:

Code: Select all
$date = JFactory::getDate($config['time_offset'].' hour '.date('Y-m-d', strtotime('now')));


And change to:

Code: Select all
$date = JFactory::getDate();



Worked for me. Joomla 3.0 version. Because Joomla saves records to MySQL using a GMT only (I think) the "created" date can sometimes be a few hours ahead of your actual timezone settings. Viewing these records in the DB directly confirmed this for me. For whatever reason the timezone offset setting that the original code was pulling threw an error zero for me.
User avatar
Fresh Boarder

teitbite
Fri Apr 26, 2013 10:31 am
Hi

Ok. Thanks for sharing. I'll let programmers know that they have missed to update J3.0 ;/
User avatar
Moderator


cron