You are here:  » Minimize product mapping list page


Minimize product mapping list page

Submitted by technoarenasol on Tue, 2012-10-09 07:29 in

Hi david

In our site large number of products .So In product mapping List page size too much big..can be possible to minimize mapping list page ........I think it may be easy if mapping product list page display according to alphabetic latter like first all give option -A,B,C,D.....X,Y,Z

If anyone click on B link after that display Product mapping list which start from B latter

Submitted by support on Tue, 2012-10-09 12:18

Hi,

Sure - in admin/productsmap.php look for the following code at line 53:

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

...and REPLACE with:

  if (isset($_GET["letter"]))
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE name LIKE '".database_safe($_GET["letter"])."%' ORDER BY name";
  }
  else
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE 0";
    for($c=65;$c<91;$c++) print "<a href='?letter=".chr($c)."'>".chr($c)."</a> ";
  }

This will give you an A B C ... Z menu of mapped products...

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2013-01-31 07:55

technoarenasol

Hi David

Possible get separate list for all categries like for mobile category A B C ... Z menu of mapped products,Mobile Accessories A B C ... Z menu of mapped products,...etc

Thanks
Amin

Submitted by support on Thu, 2013-01-31 09:39

Hello Amin,

I assume you mean the `category` field on the productsmap table - in which case yes this is easy to do. Have a go with the following as a new script admin/productsmapmenu,php

<?php
  
require("../includes/common.php");
  require(
"../includes/widget.php");
  
$admin_checkPassword TRUE;
  require(
"../includes/admin.php");
  require(
"admin_header.php");
  require(
"admin_menu.php");
  print 
"<h2>Product Mapping by Category</h2>";
  
$sql "SELECT DISTINCT(category) FROM `".$config_databaseTablePrefix."productsmap` WHERE category <> '' ORDER BY category";
  if (
database_querySelect($sql,$rows))
  {
    foreach(
$rows as $row)
    {
      print 
"<h2>".$row["category"]."</h2>";
      print 
"<ul>";
      
$sql2 "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE category = '".database_safe($row["category"])."' ORDER BY name";
      
database_querySelect($sql2,$rows2);
      foreach(
$rows2 as $row2)
      {
        print 
"<li><a href='productsmap_configure.php?id=".$row2["id"]."'>".$row2["name"]."</a></li>";
      }
      print 
"</ul>";
    }
  }
  else
  {
    print 
"<p>There are no cateories to display.</p>";
  }
  require(
"admin_footer.php");
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2013-01-31 12:03

technoarenasol

Sorry david I am not use category in product mapping.....can be possible using products table ??

Submitted by support on Thu, 2013-01-31 12:06

Hi Amin,

Sure - instead of the above have a go with:

<?php
  
require("../includes/common.php");
  require(
"../includes/widget.php");
  
$admin_checkPassword TRUE;
  require(
"../includes/admin.php");
  require(
"admin_header.php");
  require(
"admin_menu.php");
  print 
"<h2>Product Mapping by Category</h2>";
  
$sql "SELECT DISTINCT(category) FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category";
  if (
database_querySelect($sql,$rows))
  {
    foreach(
$rows as $row)
    {
      
$sql2 "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE name IN (SELECT name FROM `".$config_databaseTablePrefix."products` WHERE category='".database_safe($row["category"])."') ORDER BY name";
      if (
database_querySelect($sql2,$rows2))
      {
        print 
"<h2>".$row["category"]."</h2>";
        print 
"<ul>";
        foreach(
$rows2 as $row2)
        {
          print 
"<li><a href='productsmap_configure.php?id=".$row2["id"]."'>".$row2["name"]."</a></li>";
        }
        print 
"</ul>";
      }
    }
  }
  else
  {
    print 
"<p>There are no cateories to display.</p>";
  }
  require(
"admin_footer.php");
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2013-01-31 13:04

Hi David

I am try above code..but no result display.

Thanks & Regards
Amin

Submitted by support on Thu, 2013-01-31 13:13

Hi Amin,

Try the above now - I changed the main SELECT SQL which was still using the category field on the productsmap table - now modified to select from productsmap where name is in the sub-query select from the products table for the category...

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Tue, 2013-04-23 19:24

Hi David,

I liked the 2013-01-31 10:39 one, but is it possible to do that with unmapped products and edit inline and saved it as mapped?

Thx
Henk

Submitted by support on Wed, 2013-04-24 07:39

Hello Henk,

Sure - the first script can link to productsmap.php with a new parameter ?add=Product+Name, which you can then edit as required in the New Product form and click to Add the new product.

For the first script; have a go with:

<?php
  
require("../includes/common.php");
  require(
"../includes/widget.php");
  
$admin_checkPassword TRUE;
  require(
"../includes/admin.php");
  require(
"admin_header.php");
  require(
"admin_menu.php");
  print 
"<h2>Product Mapping by Category</h2>";
  
$sql "SELECT DISTINCT(category) FROM `".$config_databaseTablePrefix."productsmap` WHERE category <> '' ORDER BY category";
  if (
database_querySelect($sql,$rows))
  {
    foreach(
$rows as $row)
    {
      print 
"<h2>".$row["category"]."</h2>";
      print 
"<ul>";
      
$sql2 "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE category = '".database_safe($row["category"])."' AND name NOT IN (SELECT name FROM `".$config_databaseTablePrefix."productsmap`) ORDER BY name";
      
database_querySelect($sql2,$rows2);
      foreach(
$rows2 as $row2)
      {
        print 
"<li><a href='productsmap.php?new=".$row2["name"]."'>".$row2["name"]."</a></li>";
      }
      print 
"</ul>";
    }
  }
  else
  {
    print 
"<p>There are no cateories to display.</p>";
  }
  require(
"admin_footer.php");
?>

Then in admin/productsmap.php look for the following code at line 90:

  widget_textBox("name",(isset($_POST["name"])?widget_safe(widget_posted($_POST["name"])):""));

...and REPLACE with:

  if (!isset($_POST["name"]) && isset($_GET["add"])) $_POST["name"] = $_GET["add"];
  widget_textBox("name",(isset($_POST["name"])?widget_safe(widget_posted($_POST["name"])):""));

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by bihmaniak on Thu, 2013-04-25 22:12

Hello David,

Is it also possible to create something like that on the www.example.com/category/ or www.example.com/brand/ pages?
In stead of displaying all categories or brands I would just like to display a letters menu and the default page should display all categories and brands with an A.

Regards,

bihmaniak > Artikelvergelijken.nl

Submitted by support on Fri, 2013-04-26 07:49

Hi bihmaniak,

Sure - at the top of categories.php look for the following code at line 7:

  $sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";

...and REPLACE with:

  $letter = (isset($_GET["letter"])?$_GET["letter"]:"A");
  $sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` WHERE category LIKE '".database_safe($letter)."%' ORDER BY category";

Then look for the following code around line 41:

  require("html/atoz.php");

...and REPLACE with:

  $sql = "SELECT DISTINCT(UCASE(SUBSTRING(category,1,1))) as letter FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category";
  if (database_querySelect($sql,$rows))
  {
    foreach($rows as $row)
    {
      print "<a href='?letter=".$row["letter"]."'>".$row["letter"]."</a>";
    }
  }
  require("html/atoz.php");

Identical changes for brands.php, just replace every instance of "category" with "brand" - let me know if you're not sure at all of course...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by stonecold111 on Sat, 2013-08-17 10:05

Is it possible to go back to the previous list after saving a record, for example, After creating a new record under "B", I'll go back to the "B" list page instead of back to the main product mapping page.

Submitted by support on Sun, 2013-08-18 11:18

Hi,

Sure - with the above mod in place, edit admin/productsmap.php and look for the following code at line 68:

  admin_tool("Configure","productsmap_configure.php?id=".$productmap["id"],TRUE,FALSE);

...and REPLACE with:

  admin_tool("Configure","productsmap_configure.php?id=".$productmap["id"]."&letter=".$_GET["letter"],TRUE,FALSE);

Then in admin/productsmap_configure.php and look for the following code at line 80:

  header("Location: productsmap.php");

...and REPLACE with:

  header("Location: productsmap.php?letter=".$_GET["letter"]);

Cheers,
David.
--
PriceTapestry.com

Submitted by stonecold111 on Wed, 2013-08-21 19:57

Hi,
I just ran into a problem. I have just mapped a product that starts with a number, and I cannot find the record since the lists are all letters.

Submitted by support on Thu, 2013-08-22 14:25

Hi,

I just emailed a modified admin/productsmap.php with 0-9 included in the lists..

Cheers,
David.
--
PriceTapestry.com

Submitted by stonecold111 on Thu, 2013-08-22 14:58

Thank you. Already received

Submitted by falmeida on Sun, 2014-02-09 14:13

get this error when i add this mod

Warning: main() [function.main]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead in /home3/falmeida/public_html/admin/productsmap.php on line 68

Notice: Undefined index: letter in /home3/falmeida/public_html/admin/productsmap.php on line 68

Submitted by support on Sun, 2014-02-09 17:27

Hi,

In place of the modification at the line indicated:

  if ($_GET["letter"])

...use:

  if ((isset($_GET["letter"])) && ($_GET["letter"]))

To remove the date warning, add the following code to the end of your config.advanced.php file, just before the closing PHP tag:

  date_default_timezone_set("America/Chicago");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com