Hi David
When a feed is deregistered the logo details are removed from merchant_logos.php however i've noticed that actual files are not deleted from server. Can this function (unlink) be added to the deregister process so that once a feed is deregistered a clean up of all that merchant files (logos etc) takes place.
Chris
Thanks David
Will I be ok to add more instances of the above for other folders? Also i've been trying to add a delete foreach of the logos in admin to make it easier to remove, if for example the wrong image has been uploaded without having to ftp. I managed to get all files deleted but not individually. Is it possible to do?
Chris
Hi Chris,
Sure you can use the same code to remove files named as the merchant name from other folders. I'm afraid I'm not quite sure what you mean regarding a foreach delete of logos - do you want to cleanup the logos folder to remove old merchant logos that remain prior to adding this mod?
Cheers,
David.
--
PriceTapestry.com
Hello David
No I mean as a completly seperate mod not connected with the clean up above (which worked great). What I meant was is it possible to add a delete link next to each logo in merchant_logos.php. I know you can overwrite if you need to change a logo but no way to delete a logo (other than ftp) should the need arise.
Chris
Hi Chris,
I get you - that's a straight forward mod in admin/merchant_logos.php look for the following code at line 8:
require("../includes/admin.php");
...and REPLACE with:
require("../includes/admin.php");
if ($_GET["action"]=="delete")
{
unlink("../logos/".$_GET["merchant"]);
header("Location: merchant_logos.php");
exit();
}
And finally, look for the following code at line 59:
print "<th align='left'>".$row["merchant"]."</th>";
...and REPLACE with:
print "<th align='left'>".$row["merchant"]."</th>";
print "<td><a href='?action=delete&merchant=".urlencode($row["merchant"])."'>Delete</td>";
Cheers,
David.
--
PriceTapestry.com
Hi Chris,
No problem - in includes/admin.php look for the following code within the admin_deregister() function at line 103:
$sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE filename='".database_safe($feed["filename"])."'";
database_queryModify($sql,$insertId);
...and immediately after that point, just before the end of the function INSERT the following new code:
@unlink("../logos/".$feed["merchant"]);
(the @ prefix ensures that the call does not return an error if the logo does not exist)
Cheers,
David.
--
PriceTapestry.com