Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

display number of items per page


JariV

Recommended Posts

I use 2.3.4.1 CE BS version.

I found a mod in a post with code by @Tsimi that is closed, that can display number of items per page in prducts listning but it did not work. Anyone know how I can change it to get it working ?

"For osC 2.3.4 BS (Bootstrap version GOLD or EDGE)

open catalog/includes/modules/product_listing.php"

FIND:

 <?php
    if (MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True') {
      ?>

and ADD RIGHT ABOVE it this:

<?php
if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page');
  if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS;
  if (isset($HTTP_GET_VARS['mppp']) && is_numeric($HTTP_GET_VARS['mppp']) && ($HTTP_GET_VARS['mppp'] > 0)) $max_products_per_page = intval($HTTP_GET_VARS['mppp']);
  $mppp_list = array();
  for ($i = 1; $i <= 5; $i += 1) { //change $i <= 5 to show more or less page options, default is 5 (Example: 12, 24, 36, 48, 60 (total: 5 options))
	$mppp = intval($i * 12); //change $i * 12 for products shown per page, default is 12
	$mppp_list[] = array('id' => $mppp, 'text' => $mppp);
	}
	$mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS);	
  $gvhf = '';
  $ignore = array('page', 'mppp');
  if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
	reset($HTTP_GET_VARS);
	while (list($key, $value) = each($HTTP_GET_VARS)) {
	  if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) {
		$gvhf .= tep_draw_hidden_field($key, $value);
	  }
	}
  }
  $maxpppform = tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="form-control input-sm" style="width:70px;" onchange="this.form.submit()"') . '</form>';
 $listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id');
?>
 <form class="form-inline pull-right">
	<label class="control-label"><?php echo TEXT_SHOW; ?></label>
	<?php echo $maxpppform; ?>
 </form>

 

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Hi all using frozen BS and this works ok for categories listings but when I use search I get the below can someone please help with how to fix this

image.png.45fa07c9bc4b6d09f1e6bebf4a0e5610.png

image.png.4e21dde5e40ce20e8a98387677c43901.png

product_listing.php

      <!-- start display number of items per page -->
  <?php
if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page');
  if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS;
  if (isset($_GET['mppp']) && is_numeric($_GET['mppp']) && ($_GET['mppp'] > 0)) $max_products_per_page = intval($_GET['mppp']);
  $mppp_list = array();
  for ($i = 1; $i <= 5; $i += 1) { //change $i <= 5 to show more or less page options, default is 5 (Example: 12, 24, 36, 48, 60 (total: 5 options))
	$mppp = intval($i * 20); //change $i * 12 for products shown per page, default is 12
	$mppp_list[] = array('id' => $mppp, 'text' => $mppp);
	}
	$mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS);
  $gvhf = '';
  $ignore = array('page', 'mppp');
  if (is_array($_GET) && (sizeof($_GET) > 0)) {
	reset($_GET);
	while (list($key, $value) = each($_GET)) {
	  if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) {
		$gvhf .= tep_draw_hidden_field($key, $value);
	  }
	}
  }
 $maxpppform = tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="form-control input-sm" style="width:70px; margin-right:10px" onchange="this.form.submit()"') . '</form>';
 $listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id');
?>
      <!-- end display number of items per page -->

 

Link to comment
Share on other sites

Sorry the part of the above is

<!-- start display number of items per page -->
 <form class="form-inline pull-right">
	<label class="control-label"><?php echo TEXT_SHOW; ?></label>
	<?php echo $maxpppform; ?>
 </form>
<!-- end display number of items per page -->

not this works ok with looking at categories

image.png.9b6d8c6fe6bb6191232e63d7d5371154.png

image.png.0c80272d8ec70f2fc2291e30f6036491.png

 

Link to comment
Share on other sites

add this to your language file  /public_html/includes/languages/english.php

//display number of items per page
define('TEXT_ALL_ITEMS', 'show them all');
define('TEXT_SHOW','Show&nbsp;');

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...