Forums

Pagination problem with filters

novice75 02 Apr, 2012
Hello everybody,

Sorry for my bad English...

I am using chronoconnectivity V3.2 with Joomla 1.5 and I have some filters (set thanks to the dynamic filters tutorial 2). The pagination works fine if all database records should be shown.But when I make a search which should return only some records, and if it should be on more that one page, the pagination breaks. More exactly, the first page return good results I'm looking for, however when I click on the "next" link or "page 2" link, it sends me back to the whole database records.

I have try the solution proposed in this topic: http://www.chronoengine.com/forums.html?cont=posts&f=12&t=20616&sid=11f5d5b8752550d73f9d8bf0543bf390
but it seems that it only adjust the list limit according to number of query results, so all the records appear on a same page whitout any pagination (at least that what it did for me).

And I really have to let the pagination with a limit of 10 or 25 records max and I just want the pagination to work with filters.

I have also try the solution proposed by vales in this topic:
http://www.chronoengine.com/forums.html?cont=posts&f=12&t=13182&start=30
The problem is that with session variables, the query is remembered too much time (even if I quit the page, or relaunch the query with blank fields, etc...)

Please help me 😢 😢 😢
novice75 02 Apr, 2012
More details:
I'm using the template beez (a little modified) so this is the pagination code (from templates/beez/html/pagination.php) :

<?php
/**
 * @version		$Id: pagination.php 14401 2010-01-26 14:10:00Z louis $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 *	 Input variable $list is an array with offsets:
 *		 $list[limit]		: int
 *		 $list[limitstart]	: int
 *		 $list[total]		: int
 *		 $list[limitfield]	: string
 *		 $list[pagescounter]	: string
 *		 $list[pageslinks]	: string
 *
 * pagination_list_render
 *	 Input variable $list is an array with offsets:
 *		 $list[all]
 *			 [data]		: string
 *			 [active]	: boolean
 *		 $list[start]
 *			 [data]		: string
 *			 [active]	: boolean
 *		 $list[previous]
 *			 [data]		: string
 *			 [active]	: boolean
 *		 $list[next]
 *			 [data]		: string
 *			 [active]	: boolean
 *		 $list[end]
 *			 [data]		: string
 *			 [active]	: boolean
 *		 $list[pages]
 *			 [{PAGE}][data]		: string
 *			 [{PAGE}][active]	: boolean
 *
 * pagination_item_active
 *	 Input variable $item is an object with fields:
 *		 $item->base	: integer
 *		 $item->link	: string
 *		 $item->text	: string
 *
 * pagination_item_inactive
 *	 Input variable $item is an object with fields:
 *		 $item->base	: integer
 *		 $item->link	: string
 *		 $item->text	: string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
 */

function pagination_list_footer($list)
{
	// Initialize variables
	$lang =& JFactory::getLanguage();
	$html = "<div class=\"list-footer\">\n";

	$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
	$html .= $list['pageslinks'];
	$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";

	$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
	$html .= "\n</div>";

	return $html;
}

function pagination_list_render($list)
{
	// Initialize variables
	$lang =& JFactory::getLanguage();
	$html = "<ul class=\"pagination\">";

	$html .= $list['start']['data'];
	$html .= $list['previous']['data'];

	foreach( $list['pages'] as $page )
	{
		if($page['data']['active']) {
			// $html .= '<strong>';
		}

		$html .= $page['data'];

		if($page['data']['active']) {
			//  $html .= '</strong>';
		}
	}

	$html .= $list['next']['data'];
	$html .= $list['end']['data'];
	// $html .= '«';

	$html .= "</ul>";
	return $html;
}

function pagination_item_active(&$item) {
	return "<li><strong><a href=\"".$item->link."\" title=\"".$item->text."\">".$item->text."</a></strong></li>";
}

function pagination_item_inactive(&$item) {
	return "<li>".$item->text."</li>";
}
?>


the final HTML from view source:
<div align="right">
<div class="list-footer">
<div class="limit">Affichage #<select name="limit" id="limit" class="inputbox" size="1" onchange="this.form.submit()"><option value="5" >5</option><option value="10"  selected="selected">10</option><option value="15" >15</option><option value="20" >20</option><option value="25" >25</option><option value="30" >30</option><option value="50" >50</option><option value="100" >100</option><option value="0" >Tous</option></select></div><ul class="pagination"><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes" title="Début">Début</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes" title="Précédent">Précédent</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes" title="1">1</a></strong></li><li>2</li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=20" title="3">3</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=30" title="4">4</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=40" title="5">5</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=20" title="Suivant">Suivant</a></strong></li><li><strong><a href="/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=40" title="Fin">Fin</a></strong></li></ul>
<div class="counter">Page 2 sur 5</div>
<input type="hidden" name="limitstart" value="10" />
</div>
</div>
</div>


and the code in the Header box begins with:
<?php
JHTML::_('behavior.mootools');
?>


<?php
$script = "
window.addEvent('domready', function() {
var pagelinks = $$('a.pagenav');
  var form = $$('form[name=connectivity]')[0];
  var limitstart = $$('input[name=limitstart]')[0];
  pagelinks.each(function(link) {
    var href  = link.getProperty('href'); 
    var start = href.substr(href.lastIndexOf('start=')+6);
    var title = link.getProperty('title');
    var new_link  = new Element('a', {
      'events': {
        'click': function() {
          limitstart.value = new_link.getProperty('start');
          form.submit();
        }
      },
      'title': title,
      'start': start
    });
    new_link.setText(title);
    link.replaceWith(new_link);
  });
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>


Thank you for any help!!
novice75 05 Apr, 2012
Up

Nobody have an idea ?
Max_admin 08 Apr, 2012
Hi novice,

Is there any way you may upgrade to Chronoforms V4 and Connectivity V4 as well ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
novice75 08 Apr, 2012
Hi,

Thank you for your answer.
Unfortunately, I have to keep the previous version...

Do you think there is any solution with V3.2?
GreyHead 09 Apr, 2012
Hi novice75,

The links you posted already have the limitstart parameter included in them:
/index.php?option=com_chronoconnectivity&connectionname=Commandes&limitstart=20
so either the JavaScript is working OK or you don't need it.

Hard to say any more without seeing the listing. If limitstart is set then the pagination 'should' behave correctly.

Bob
novice75 09 Apr, 2012
Hi GreyHead,

What could be the problem then ?

Could I give you in private an access to the website, so you could take a quick look?

Thank you very much!
This topic is locked and no more replies can be posted.