AbanteCart Community

eCommerce construction => Installation and Configuration => Topic started by: svsanchez on March 02, 2016, 10:12:28 PM

Title: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: svsanchez on March 02, 2016, 10:12:28 PM
Hello, apparently my cart has the following displaying options by default:

5 - 15 - 25 - 35 - 45

Problem is that it displays 4 products per row, so the last row only shows 1 product, which makes the user think that's the last product (even with the NEXT link below). So I would like to offer the users the following displaying options instead:

20 - 40 - 60 - 80 - ALL

How can I do this?
Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: svsanchez on March 04, 2016, 01:12:15 AM
I haven't yet figured how to do this. Is this possible?
Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: svsanchez on March 05, 2016, 01:08:37 AM
C'mon, is this really impossible to do?
Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: llegrand on March 05, 2016, 02:48:51 PM
well here's a suggestion and a comment.

suggestion  -  just edit the language definitions - to let them know to look for more pages 
find it in the system > localization >language definitions  then type in Per page on the translate block and it will locate all instances for you.

comment -  personally I think showing all is not a good thing -  too much to load,  too much to scroll.

 
Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: abantecart on March 05, 2016, 03:52:54 PM
This is pretty easy to change.

Default values are set in file: core/engine/html.php
Look for:
class PaginationHtmlElement extends HtmlElement {

Code: [Select]
public function __construct($data) {
parent::__construct($data);
//default settings
$this->sts['total'] = 0;
$this->sts['page'] = 1;
$this->sts['limit'] = 20;
$this->sts['split'] = 5;
$this->sts['limits'] = array();

These default settings will be overridden with params passed into pagination class in the controller.

In calling controller, for example in category listing: storefront/controller/pages/product/category.php

Code: [Select]
$this->view->assign('pagination_bootstrap', $this->html->buildElement( array (
'type' => 'Pagination',
'name' => 'pagination',
'text'=> $this->language->get('text_pagination'),
'text_limit' => $this->language->get('text_per_page'),
'total' => $product_total,
'page' => $page,
'limit' => $limit,
'url' => $pagination_url,
'style' => 'pagination'))

Add new param with 'limits' => array(20, 40, 60, 80),

This will split your pages with 20 per page




Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: svsanchez on March 15, 2016, 11:23:42 PM
Hello abantecart, thanks a lot for your help, I was able to set the pagination in 20 items increments.

I would now like to show 50 products in the category page instead of the default 20. The reason for this is that many people don't see there are more products than the first 20. I tried changing the 'limit' line from 20 to 50 but this didn't work. Could you please tell me how to do this?

Thank you!
Title: Re: Showing 20 - 40 - 60 - 80 - ALL products per page
Post by: svsanchez on March 16, 2016, 12:12:37 AM
Never mind with my previous question: I found the way to do this in Admin > Settings > General

Thanks a lot!