You are here:  » Dealing with product maps for products that aren't in the database anymore

Support Forum



Dealing with product maps for products that aren't in the database anymore

Submitted by dlw on Tue, 2016-11-22 04:05 in

I'm hoping someone can help me with this. I'm looking for a way to indicate visually which product maps are no longer valid on the product mapping page so I can manually delete them.

Submitted by support on Tue, 2016-11-22 09:41

Hi,

Sure - to show an X alongside deleted Product Mapping entries, edit admin/productsmap.php and look for the following code at line 68:

    print "<table>";

...and REPLACE with:

    $ins = array();
    foreach($rows as $productmap)
    {
      $ins[] = "'".database_safe($productmap["name"])."'";
    }
    $sql2 = "SELECT id,name FROM `".$config_databaseTablePrefix."products` WHERE name IN (".implode(",",$ins).")";
    database_querySelect($sql2,$rows2);
    $exists = array();
    foreach($rows2 as $row2)
    {
      $exists[] = $row2["name"];
    }
    print "<table>";

And then the following code at (now) line 92:

      print "<th class='pta_key'>".$productmap["name"]."</th>";

...and REPLACE with:

      print "<th class='pta_key'>".$productmap["name"]."</th>";
      print "<td>".(in_array($productmap["name"],$exists)?"&nbsp;":"X")."</td>";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by dlw on Wed, 2016-11-23 04:23

It works perfectly! Thanks, David. You're the best. :)