View Single Post
  #27  
Old 04-23-2009, 07:29 AM
  clik's Avatar 
clik clik is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: Canada
Posts: 30
 

Default Re: Let Customer choose number of products displayed on page

Quote:
Originally Posted by Jon
I don't want to hijack this thread as it's a good mod... and not my mod... but I've had to assist several store owners who have had the misfortune of having their sites hacked due to varying exploits, so please excuse my paranoia and hesitation to rely on x-cart's data sanitizing

Here's the code I would use in change_ppp.php:

Code:
<?php if ( !defined('XCART_SESSION_START') && ($_SERVER['REQUEST_METHOD'] != "POST")) { header("Location: home.php");} require_once "auth.php"; x_session_register("products_per_page"); if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($ppp) { $back = $_SERVER['HTTP_REFERER']; if (!$back) $back = "/home.php"; if ($ppp == "all") { $ppp = 32767; } else { $products_per_page = (int)$ppp; } x_session_save("products_per_page"); func_header_location($back); } } if ((int)$products_per_page > 0) { $config["Appearance"]["products_per_page"] = $products_per_page; $objects_per_page = $config["Appearance"]["products_per_page"]; } $smarty -> assign("products_per_page",$config["Appearance"]["products_per_page"]); ?>

Thanks guys for this very handy mod
It works in x-cart 4.2 as well but I have a little problem with <option value="all">. It wouldn't make it "selected". It keeps the previous selected value (5/10/20... etc).

Any idea where the problem could be?

I used the code above for the change_ppp.php file.

Thank you!
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
Reply With Quote