Hi,
since Joomla 3.3.4, the pagination is not working anymore ( when listing documents in a category, the 10 first are displayed, but there is no link at the bottom to display the others documents ).
I installed Joomla 3.3.5, then 3.3.6, which should correct this issue, but not with jdownload.
Can you confirm the bug ?
it is a joomla bug, or Jd bug, or both ?
Regards
Olivier
More info :
the pagination is ok in the categories view.
the pagination is not displayed in the category view
Hi,
before you have updated to Joomla 3.3.4 has it works properly?
What is your jD version?
Yes it worked with Joomla 3.3.3 and last version of JD.
I reproduced the bug both on my production serveur and my local dev server.
This issue from getItems() in models/category.php
I propose you the following hack :
function getItems()
{
$params = $this->getState()->get('params');
$limit = $this->getState('list.limit');
if ($this->_downloads === null && $category = $this->getCategory()) {
$model = JModelLegacy::getInstance('downloads', 'JdownloadsModel', array('ignore_request' => true));
$model->setState('params', JFactory::getApplication()->getParams());
$model->setState('filter.category_id', $category->id);
$model->setState('filter.published', $this->getState('filter.published'));
$model->setState('filter.access', $this->getState('filter.access'));
$model->setState('filter.language', $this->getState('filter.language'));
$model->setState('list.ordering', $this->_buildContentOrderBy()); // $this->getState('list.ordering'));
$model->setState('list.start', $this->getState('list.start'));
$model->setState('list.limit', $limit );
$model->setState('list.direction', $this->getState('list.direction'));
$model->setState('list.filter', $this->getState('list.filter'));
$model->setState('list.links', $this->getState('list.links'));
/////
$this->_downloads=array();
$this->_pagination = $model->getPagination();
/////
if ($limit >= 0) {
$this->_downloads = $model->getItems();
if ($this->_downloads === false) {
$this->setError($model->getError());
}
}
else {
$this->_downloads=array();
}
// $this->_pagination = $model->getPagination();
}
return $this->_downloads;
}
Hi,
thanks for the modification.
But i wondering why Joomla has changed here something. ::)
Have you any informations or a link about this problem in newer Joomla versions?
please see http://issues.joomla.org/tracker/joomla-cms/4330
I think it was an hidden bug ( Jd)
Hi
Definitely a Joomla bug. Calculation of number of items is flawed. I am using a test setup of just 3 items per page
Introduced line below in ../downloads/tmpl/default.php (short hand as 'downloads.php' in messages)
$total_downloads = $this->pagination->get('total');
echo "In downloads.php circa line 107 total downloads=".$total_downloads."
";
Using Joomla 3.3.3 - which is correct
In downloads circa line 107 total downloads=25
in downloads.php circa line 219 start of sub header section
in downloads.php total pages=9
Using Joomla 3.3.6 - which has a problem
In downloads.php circa line 107 total downloads=3
in downloads.php circa line 219 start of sub header section
in downloads.php total pages=1
Colin
Seems that this Joomla bug has also effects on the other jD frontend views ('all downloads' etc.) Very bad thing. >:(
I will search how we can fix this.
Same problem here after upgrade joomla to 3.3.6 from 3.3.4
Hi
I have just downloaded the 3.3.7 development version but it still has the problem! :( :o
Also I looked into Joomla bug report #4330 which is a single line change.
See https://github.com/joomla/joomla-cms/pull/4330/files
So I reversed the change but it made no difference.
Colin
Hi Colin,
QuoteAlso I looked into Joomla bug report #4330 which is a single line change.
yes i have seen this line, but here seems not to be the problem. :-\
i have seen your tracker entry. Good idea. ;)
The hack from scab333 seems to works for the category view.
But we have the same problem in all other views. So i try in the moment to find a solution for the 'all downloads' view.
But i can not find what exactly is in this case different between Joomla 3.3.3 and Joomla 3.3.4.
I can test (with debugger) what i will, i get always different results for the '$total' variable.
In Joomla 3.3.4 it is always the same as the value for '$limit'.
Joomla makes me sometimes crazy... >:( >:( >:(
Arno
Think you are on right track - the total limit always gets set to the requested pages/view. - I know jDownloads reads the total by typically
$total_downloads = $this->pagination->get('total'); but where does jDownloads tell Joomla what is the value of the total limit?
And where does it tell the pagination that there are so items/page? These are perhaps database things and that to me is where it may be going wrong.
Also saw Joomla tracker item #4339 which is similar see https://github.com/joomla/joomla-cms/issues/4339
Colin
Hi,
I've just test this :
reverting https://github.com/joomla/joomla-cms/pull/3945 solve this issue.
hope it will help
Olivier
@ Olivier,
@ Colin,
many thanks for the hints. I think i have found the problem and will publish later today a fixed version. ;)
@Oliver Yes reversing #3945 does fix problem :) ;) ;D
Colin
Arno
A couple og people are working the issue see
https://github.com/joomla/joomla-cms/issues/4472
If it is any help the part of Joomla mod #3945 that causes problem are the lines marked //*
public function setQuery($query, $offset = 0, $limit = 0)
{
$this->sql = $query;
if ($query instanceof JDatabaseQueryLimitable)
{
// start of #3945
//* if (!$limit && $query->limit)
//* {
//* $limit = $query->limit;
//* }
if (!$offset && $query->offset)
{
$offset = $query->offset;
}
// end of #3945
$query->setLimit($limit, $offset);
}
else
{
$this->limit = (int) max(0, $limit);
$this->offset = (int) max(0, $offset);
}
return $this;
}
Colin
Hi
The Joomla people have found the error and have a patch. :) :)
Joomla fix Clear limit for all JDatabaseQuery objects #4485
https://github.com/joomla/joomla-cms/pull/4485/files for changed code
https://github.com/joomla/joomla-cms/pull/4485 for explanation
libraries/legacy/model/legacy.php circa line 315
should now read as below
protected function _getListCount($query)
{
// Use fast COUNT(*) on JDatabaseQuery objects if there is no GROUP BY or HAVING clause:
if ($query instanceof JDatabaseQuery
&& $query->type == 'select'
&& $query->group === null
&& $query->having === null)
{
$query = clone $query;
$query->clear('select')->clear('order')->clear('limit')->select('COUNT(*)');
$this->_db->setQuery($query);
return (int) $this->_db->loadResult();
}
// Otherwise fall back to inefficient way of counting all results.
// Remove the limit part if it's a JDatabaseQuery object
if ($query instanceof JDatabaseQuery)
{
$query = clone $query;
$query->clear('limit');
}
$this->_db->setQuery($query);
$this->_db->execute();
return (int) $this->_db->getNumRows();
}
Hi,
thanks for the informations. I have it also read on GitHub. ;)
I have now online a new 3.2.13 beta version which worked with the original Joomla 3.3.6 files. So we must not wait on the official next Joomla version.
About the problem:
I had found out, that i have a few MySql 'group by' definitions in some from my queries. The changed core files in Joomla 3.3.4 had in this case wrong getTotal() values. But i have now seen, that the 'group by' clauses are not really required. So i have removed it and get now the correct results for the pagination.
Many thanks for your help again! ;D ;) 8)