You are here:  » productsmap.php fatal errors (more products!)

Support Forum



productsmap.php fatal errors (more products!)

Submitted by marco.saiu on Wed, 2011-08-03 01:09 in

Hello i have some problem with products map because have more maps of products 2.850.000 if possible paginate this? 100 record per page i think not generate this problem!

Thank's

Submitted by support on Wed, 2011-08-03 08:20

Hello Marco,

To make a simple pagination, in admin/productsmap.php, look for the following code at line 52:

  $sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` ORDER BY name";

...and REPLACE with:

  $limit = 100;
  $page = (isset($_GET["page"])?intval($_GET["page"]):1);
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` ORDER BY name";
  $offset = ($page-1) * $limit;
  $sql .= " LIMIT ".$offset.",".$limit;

And then look for the following code at line 80:

  print "<h3>New Product</h3>";

...and REPLACE with:

  $sql = "SELECT COUNT(*) AS total FROM `".$config_databaseTablePrefix."productsmap`";
  database_querySelect($sql,$result);
  $totalPages = ceil($result[0]["total"]/$limit);
  print "<form method='GET'>";
  print "Go to page: ";
  print "<select name='page'>
  for($i=1;$i<=$totalPages;$i++)
  {
    print "<option value='".$i."'>".$i."</option>";
  }
  print "</select>";
  print "<input type='submit' value='Go' />";
  print "</form>";
  print "<h3>New Product</h3>";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com