You are here:  » Delete Product Mapping

Support Forum



Delete Product Mapping

Submitted by philstone on Fri, 2014-06-20 14:04 in

Hi David

Trust you are well

In my product mapping I feel it would benefit me to add a 'Delete Product Mapping' button on the productsmap_configure.php page which I have done below, however is there anyway when it deletes it could return to the same productsmap_configure.php that it was on? (which I know would show empty fields, but as I have over 10,000 mapped products it would save waiting for the productsmap.php to load), I usually use the prev or next links to navigate through my product maps.

  if ($id > 1) print "<a href='".$href."?id=".($id-1)."'>Prev</a>&nbsp;";
  print "<a href='".$href."?id=".($id+1)."'>Next</a>&nbsp;";
  print "<form action='productsmap_delete.php?id=".$productmap["id"]."' method='post'><input type='submit' name='submit' value='Delete Product Mapping'></form>";
  print "<h3>".$productmap["name"]."</h3>";

any help with this would be greatly appreciated

regards

Phil

Submitted by support on Tue, 2014-06-24 07:54

Hi Phil,

A "Reset" function would be straight forward, in productsmap_configure.php if you look for the following code at line 27:

  if ($submit == "Save")

...and REPLACE with;

  if ($submit == "Reset")
  {
    $sql = "UPDATE `".$config_databaseTablePrefix."productsmap` SET
              alternates = '',
              description = '',
              category = '',
              brand = '',
              image_url = ''
              WHERE id ='".database_safe($id)."'";
    database_queryModify($sql,$insertId);
    header("Location: productsmap_configure.php?id=".$id);
    exit();
  }
  if ($submit == "Save")

And then to add the Reset button to the form, look for the following code at line 133:

    print "<input type='submit' name='submit' value='Cancel' />&nbsp;";

...and REPLACE with:

    print "<input type='submit' name='submit' value='Cancel' />&nbsp;";
    print "<input type='submit' name='submit' value='Reset' />&nbsp;";

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Tue, 2014-06-24 20:24

As always David that works perfect!!

Thanks so much

regards

Phil Stone