Jump to content

Recommended Posts

Posted

i want to override pagination setting , specially the total show result per page , i have put this code

$settings = array_merge(Configure::get("Blesta.pagination_client"), array(
    'total_results' => $this->total_announcements, // = 21
    'results_per_page' => 6,
    'uri'=> $this->base_uri . "plugin/announcements/client_main/index/[p]/",
    'params'=>array('sort'=>$sort,'order'=>$order)
   )
  );
  $this->helpers(array("Pagination"=>array($this->get, $settings))); 
// $this->Pagination->setSettings(Configure::get("Blesta.pagination_ajax"));

but is not working , it show 20 result instead of 6 result per page .

 

what is working is the pagination tab , is calculated corectly , it show 4 page .

 

i have missed something or this is a bug ?

 

 

Posted
  On 8/25/2014 at 1:54 AM, naja7host said:

i want to override pagination setting , specially the total show result per page , i have put this code

$settings = array_merge(Configure::get("Blesta.pagination_client"), array(
    'total_results' => $this->total_announcements, // = 21
    'results_per_page' => 6,
    'uri'=> $this->base_uri . "plugin/announcements/client_main/index/[p]/",
    'params'=>array('sort'=>$sort,'order'=>$order)
   )
  );
  $this->helpers(array("Pagination"=>array($this->get, $settings))); 
// $this->Pagination->setSettings(Configure::get("Blesta.pagination_ajax"));

but is not working , it show 20 result instead of 6 result per page .

 

what is working is the pagination tab , is calculated corectly , it show 4 page .

 

i have missed something or this is a bug ?

 

What you have there looks like it should work to me, so long as you don't have a 'total_results' key, or 'total_results' = 0.

Posted
  On 8/25/2014 at 4:58 PM, Tyson said:

What you have there looks like it should work to me, so long as you don't have a 'total_results' key, or 'total_results' = 0.

 

i think you have not understand the probleme . let say

$settings = array_merge(Configure::get("Blesta.pagination_client"), array(
    'total_results' => 21 , // = 21
    'results_per_page' => 6,
    'uri'=> $this->base_uri . "plugin/announcements/client_main/index/[p]/",
    'params'=>array('sort'=>$sort,'order'=>$order)
   )
  );
  $this->helpers(array("Pagination"=>array($this->get, $settings)));

this should normally show a page with 6 result and anvigation with 4 pages .

 

but it show 20 result with pagination of 4 pages .

 

when i have searched the code i have found request using $this->setPerPage() instead of results_per_page .

 

the same code tested in native function like listing service and client , it always return 20 result insead of results_per_page value .

can someone re-duplicate the case ?

Posted

I meant 'total_pages' rather than 'total_results' above.

 

I'd have to see how you're setting your results into the template to show you where it's going wrong. But the number of results you show on the page is independent of the pagination. It sounds like the pagination is working correctly by showing the correct number of pages for the number of results you say you have. However, the number of results you set in your template does not coincide with the number you told the pagination you would set. This sounds like an issue with how you're fetching or displaying the data rather than a problem with pagination.

 

Using $this->setPerPage() in a model simply overrides the default 'per page' value of a query, which is generally used in calculating the result list to fetch in the limit clause of your queries.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...