News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Pagination issue [Fixed in jD3.2.13]

Started by Olivier, 02.10.2014 13:17:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Olivier

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
  •  

Olivier

More info :

the pagination is ok in the categories view.

the pagination is not displayed in the category view
  •  

Arno

Hi,
before you have updated to Joomla 3.3.4 has it works properly?

What is your jD version?
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Olivier

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.

  •  

Olivier

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;
   }
  •  

Arno

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?
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Olivier

  •  

ColinM

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
Colin M
  •  

Arno

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.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

water

Same problem here after upgrade joomla to 3.3.6 from 3.3.4
  •  

ColinM

#10
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
Colin M
  •  

Arno

#11
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.  ;)
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Arno

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...  >:( >:( >:(
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

ColinM

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
Colin M
  •  

Olivier

Hi,

I've just test this :
reverting https://github.com/joomla/joomla-cms/pull/3945 solve this issue.

hope it will help

Olivier
  •