Jump to content

[Solved]Products Per Page


Recommended Posts

I am trying out the product list or grid module and need to change the products per page.

The default as you probably know is 10, 20, 50 I want to change this to 12, 24, 58.

When in grid mode the default of 10 leaves 2 empty slots at the bottom of each page.

I know I can change the default under preferences/ products to 12 but this just adds 12 to the list 10, 12, 20, 50.

I tried to search for these numbers in a number of files and was unable to find where I could change them.

 

Thanks in advance for your help.

Link to comment
Share on other sites

  • 3 months later...

Thanks:

 

Just what I needed I would never have found that there. :P

you can find it in classes/FrontController.php, function pagination

 

Hi

 

I found the default products per page, 10, 20 or 50 but cant seem to change them to : 9, 18 or 36 <_<

 

If iam not mistaken one should change the numbers here :

 

public function pagination($nbProducts = 10)

{

if (!self::$initialized)

$this->init();

 

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

// 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 >= 10) ? self::$cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE'))))));

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

 

Once changed the default landing page is still on 10, with options to choose from being 9, 10 or 18.

 

I want the default landing page to be 9, what am i missing ??

Link to comment
Share on other sites

After making changes you need to turn force compile on and cache off under preferences.

Also you will need to change the default products per page to your first number (9) under preferences products.

  • Like 1
Link to comment
Share on other sites

After making changes you need to turn force compile on and cache off under preferences.

Also you will need to change the default products per page to your first number (9) under preferences products.

 

I never changed it in the BO :rolleyes: ,

 

thank you for the help!!!

Link to comment
Share on other sites

  • 4 months later...

in your theme path edit file pagination.tpl and change code below:

{if (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10}
{assign var='nArray' value=array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 24, 58)}
{else}
{assign var='nArray' value=array(15, 30, 60)}
{/if}

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

After making changes you need to turn force compile on and cache off under preferences.

Also you will need to change the default products per page to your first number (9) under preferences products.

 

Thank you Tdr170.

 

Your suggestion worked for me. Did a like :)

 

Thanks for every suggestion on this topic.

 

PrestaFanBoy

Link to comment
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
×
×
  • Create New...