Jump to content

Opción "ver todos" en "Artículos por página"


achura

Recommended Posts

Ok, muy bien! pero yo tengo una duda sobre esto, he modificado FrontController para cambiar los articulos por pagina a 20, 40 y 80, pero me gustaria incluir un valor al final "Ver todos" que me imagino que será poniendo un valor alto (un cuarto valor) pero, donde tendría que poner "Ver todos" para que saliera en el select?

 

El codigo es:

 

public function pagination($nbProducts = 20)

{

if (!self::$initialized)

$this->init();

$nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 20 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 20, 40, 80) : array(20, 40, 80);

// Clean duplicate values

$nArray = array_unique($nArray);

asort($nArray);

$this->n = abs((int)(Tools::getValue('n', ((isset(self::$cookie->nb_item_per_page) AND self::$cookie->nb_item_per_page >= 20) ? self::$cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE'))))));

$this->p = abs((int)(Tools::getValue('p', 1)));

 

if (!is_numeric(Tools::getValue('p', 1)) || Tools::getValue('p', 1) < 0)

Tools::redirect('404.php');

 

$current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);

//delete parameter page

$current_url = preg_replace('/(\?)?(&)?p=\d+/', '$1', $current_url);

 

$range = 25; /* how many pages around page selected */

 

if ($this->p < 0)

$this->p = 0;

 

if (isset(self::$cookie->nb_item_per_page) AND $this->n != self::$cookie->nb_item_per_page AND in_array($this->n, $nArray))

self::$cookie->nb_item_per_page = $this->n;

 

if ($this->p > (($nbProducts / $this->n) + 1))

Tools::redirect(preg_replace('/[&?]p=\d+/', '', $_SERVER['REQUEST_URI']));

 

$pages_nb = ceil($nbProducts / (int)($this->n));

 

$start = (int)($this->p - $range);

if ($start < 1)

$start = 1;

$stop = (int)($this->p + $range);

if ($stop > $pages_nb)

$stop = (int)($pages_nb);

self::$smarty->assign('nb_products', $nbProducts);

$pagination_infos = array(

'products_per_page' => (int)Configuration::get('PS_PRODUCTS_PER_PAGE'),

'pages_nb' => $pages_nb,

'p' => $this->p,

'n' => $this->n,

'nArray' => $nArray,

'range' => $range,

'start' => $start,

'stop' => $stop,

'current_url' => $current_url

);

self::$smarty->assign($pagination_infos);

}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...