jacksfregio Posted February 17, 2016 Share Posted February 17, 2016 (edited) Hi to all. In Product Attributes pagination don't work: when I click to change page it return to index page. Same error even in the Prestashop official demo. Version 1.6.1.4 php 5.6 http://forge.prestashop.com/browse/PSCSX-7663# Edited March 3, 2016 by jacksfregio (see edit history) 3 Link to comment Share on other sites More sharing options...
m.venusova Posted March 29, 2016 Share Posted March 29, 2016 i have the same bug . Pagination is not working ina product attributes Link to comment Share on other sites More sharing options...
Lebybab Posted April 21, 2016 Share Posted April 21, 2016 to fix it, you have to override AdminController postProcess function, next to $this->setRedirectAfter: public function postProcess() { try { if ($this->ajax) { // from ajax-tab.php $action = Tools::getValue('action'); // no need to use displayConf() here if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action))) { Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this)); Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this)); $return = $this->{'ajaxProcess'.Tools::toCamelCase($action)}(); Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); return $return; } elseif (!empty($action) && $this->controller_name == 'AdminModules' && Tools::getIsset('configure')) { $module_obj = Module::getInstanceByName(Tools::getValue('configure')); if (Validate::isLoadedObject($module_obj) && method_exists($module_obj, 'ajaxProcess'.$action)) { return $module_obj->{'ajaxProcess'.$action}(); } } elseif (method_exists($this, 'ajaxProcess')) { return $this->ajaxProcess(); } } else { // Process list filtering if ($this->filter && $this->action != 'reset_filters') { $this->processFilter(); } if (isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) { //Correction bug du coeur qui ne faisait pas le bon traitement dans le cas de paginations "imbriquées" type attributes_group if($this->position_identifier) { $this->setRedirectAfter(self::$currentIndex.'&'.$this->position_identifier.'='.(int)Tools::getValue('id_attribute_group').'&view'.$this->table.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '')); } else{ $this->setRedirectAfter(self::$currentIndex.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '')); } } // If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action)))) { // Hook before action Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this)); Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this)); // Call process $return = $this->{'process'.Tools::toCamelCase($this->action)}(); // Hook After Action Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); return $return; } } } catch (PrestaShopException $e) { $this->errors[] = $e->getMessage(); }; return false; } in the core file you only have : if (isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) { $this->setRedirectAfter(self::$currentIndex.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '')); } Link to comment Share on other sites More sharing options...
marcin_jaworski Posted March 29, 2017 Share Posted March 29, 2017 This is better solution also fix problems on categories: if (isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) { $identifier = Tools::getIsset($this->identifier) ? '&'.$this->identifier.'='.(int)Tools::getValue($this->identifier) : ''; $this->setRedirectAfter(self::$currentIndex.$identifier.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '')); } <?php class AdminController extends AdminControllerCore { /** * @TODO uses redirectAdmin only if !$this->ajax * @return bool */ public function postProcess() { try { if ($this->ajax) { // from ajax-tab.php $action = Tools::getValue('action'); // no need to use displayConf() here if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action))) { Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this)); Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this)); $return = $this->{'ajaxProcess'.Tools::toCamelCase($action)}(); Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); return $return; } elseif (!empty($action) && $this->controller_name == 'AdminModules' && Tools::getIsset('configure')) { $module_obj = Module::getInstanceByName(Tools::getValue('configure')); if (Validate::isLoadedObject($module_obj) && method_exists($module_obj, 'ajaxProcess'.$action)) { return $module_obj->{'ajaxProcess'.$action}(); } } elseif (method_exists($this, 'ajaxProcess')) { return $this->ajaxProcess(); } } else { // Process list filtering if ($this->filter && $this->action != 'reset_filters') { $this->processFilter(); } if (isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) { $identifier = Tools::getIsset($this->identifier) ? '&'.$this->identifier.'='.(int)Tools::getValue($this->identifier) : ''; $this->setRedirectAfter(self::$currentIndex.$identifier.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '')); } // If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action)))) { // Hook before action Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this)); Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this)); // Call process $return = $this->{'process'.Tools::toCamelCase($this->action)}(); // Hook After Action Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); return $return; } } } catch (PrestaShopException $e) { $this->errors[] = $e->getMessage(); }; return false; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now