Jump to content

Custom module & pagination in frontoffice


danielec
 Share

Recommended Posts

Hello!! I'm creating a module in prestashop (backoffice / frontoffice) but I've a big problem. In my page in the frontoffice I wanna insert the pagination. I read code (pagination.php/pagination.tpl) but I do not understand nothing.
Pagination is in: product / supplier / category and manufacturer.
It is very complicated!! Or not?
Is unnecessary to implement a pagination with PHP when everything I need already exists.
Please help me!

PS Sorry for my bab english

Share this post


Link to post
Share on other sites

  • 3 years later...

take a look in classes/controller/FrontController.php

 

function is:

 

public function pagination($nbProducts = 10)
{

 

 

example to use is like this:

 

$this->productSort();
  $this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'))));
  $this->p = abs((int)(Tools::getValue('p', 1)));
  $search = Search::find($this->context->language->id, $query, 1, 10, 'position', 'desc');
  Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
  $nbProducts = $search['total'];
  $this->pagination($nbProducts);
  $this->context->smarty->assign(array(
   'products' => $search['result'], // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
   'search_products' => $search['result'],
   'nbProducts' => $search['total'],
   'search_query' => $query,
   'instant_search' => $this->instant_search,
   'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));

 

but its better to sear IN files "*.php" with string "pagination(" with Notepad++ for example.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More