Problem Statement
There is no default functionality to persist the GET parameters while using “Paginator” helper in CakePHP. As per default functionality of CakePHP paginatior helper, the GET parameters will remove from the URL if you navigate to the next page. So in this blog we will learn how to add the GET parameters in the URL of page number in CakePhp version 2.0?
Solution
If you are facing this issue then you need to add a few lines of code in the beforeRender function. This function is defined in the paginator.php file (File Location: cake\libs\view\helpers\paginator.php). You need to add the following lines shown in the brown color:
public function beforeRender($viewFile) { $this->options['url'] = array_merge($this->request->params['pass'], $this->request->params['named']); //Start of code if (!empty($this->request->query)) { $get_param = $this->request->query; unset($get_param['url']); $this->options['url']['?'] = $get_param; } // End of code parent::beforeRender($viewFile); }