Is there a way to upload an image in product mapping, now you must use/search for the webadres ?
thx
Henk
Hi David
I've just added the above mod, just checking whether the mod should rewrite the image name to the product name. If so it's not working for me, i've checked folder permissions the file uploads but does not rename.
Chris
Hi Chris,
It wouldn't rename - the image file will be uploaded exactly as it is called on your local computer; and then the image_url field should be derived to point to the URL of that filename in your /pimages/ folder...
Cheers,
David.
--
PriceTapestry.com
Hi David
Got it, I was thinking of the logo upload which renames to the merchant name.
Is it possible to alter the productsmap_delete.php to also delete the saved image when the product map is deleted.
Thanks
Chris
Hi Chris,
Sure, in admin/productsmap_delete.php look for the following code at line 10:
$id = $_GET["id"];
...and REPLACE with:
$id = $_GET["id"];
$sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap` WHERE id='".database_safe($id)."'";
database_querySelect($sql,$rows);
$productsmap = $rows[0];
if (strpos($productsmap["image_url"],"http://".$_SERVER["HTTP_HOST"])!==FALSE)
{
$pimage = str_replace("http://".$_SERVER["HTTP_HOST"].$config_baseHREF."pimages/","",$productsmap["image_url"]);
unlink("../pimages/".$pimage);
}
Cheers,
David.
--
PriceTapestry.com
Hello Henk,
Sure here's a quick mod so that you upload custom images.
Firstly, you need to create a folder to save the uploaded images into. I've used "pimages" in the code below. Create a folder of this name in your Price Tapestry installation directory and make sure that it is writeable by PHP. The easiest way to do this is normally with your FTP program - in the remote the window, right-click on the pimages folder and look for Permissions... or maybe Properties... and then Permissions. Then give WRITE access to all users(Owner / Group / World).
Edit admin/productsmap_configure.php and look for the following code at line 39:
if (!isset($_POST["image_url"])) $_POST["image_url"] = "";
...and REPLACE with:
if (!isset($_POST["image_url"])) $_POST["image_url"] = "";
if ($_FILES["pimage"]["name"])
{
move_uploaded_file($_FILES["pimage"]["tmp_name"],"../pimages/".$_FILES["pimage"]["name"]);
$_POST["image_url"] = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF."pimages/".$_FILES["pimage"]["name"];
}
next, look for the following code at line 99:
print "<form method='post'>";
...and REPLACE with:
print "<form method='post' enctype='multipart/form-data'>";
And finally the following code at line 127:
print "<input type='text' name='image_url' value='".widget_safe($productmap["image_url"])."' />";
...and REPLACE with:
print "<input type='text' name='image_url' value='".widget_safe($productmap["image_url"])."' /> or upload <input type='file' name='pimage' />";
On submitting the form, if a file has been submitted it will be saved in the pimages/ folder and then the custom image_url generated as, for example, http://www.example.com/pimages/ImageFilename.jpg
Cheers,
David.
--
PriceTapestry.com