Hi David
Is it possible to add a name field to productsmap_configure.php so that the name can be edited/renamed rather than deleting and starting again.
Chris
Hi David
Thanks, that was spot on and worked fine.
Chris
Hi David,
There's a problem with apostrophes in product titles.
Going back to edit products with an apostrophe, I find that in the rename box, the apostrophe gets cut off as well as the text after it, for example:
"Alex's Revenge" would become "Alex"
Hi,
Thanks for pointing that out. To correct the problem, edit includes/widget.php and look for the following code at line 133:
return htmlspecialchars($text);
...and REPLACE with:
return htmlspecialchars($text,ENT_QUOTES);
Cheers,
David.
--
PriceTapestry.com
Hi David, just wondering how to go about this on 14/06A?
The code seems a little different. Am I now replacing?
print "<input type='submit' name='submit' id='formSubmit' value='Save' /> ";
Hi Mark,
Equivalent changes for 14/01A;
In admin/productsmap_configure.php look for the following code at line 39:
if ($_POST["alternates"])
...and REPLACE with:
if ($_POST["name"] <> $productmap["name"])
{
$sql = "SELECT id FROM `".$config_databaseTablePrefix."productsmap` WHERE name='".database_safe($_POST["name"])."' AND id<>'".database_safe($id)."'";
if (!database_querySelect($sql,$result))
{
$sql = "UPDATE `".$config_databaseTablePrefix."productsmap` SET name='".database_safe($_POST["name"])."' WHERE id='".database_safe($id)."'";
database_queryModify($sql,$result);
}
}
if ($_POST["alternates"])
And finally, look for the following code at line 111:
widget_formButtons(array("Save"=>TRUE),TRUE);
....and REPLACE with:
widget_textBox("Rename Mapping","name",FALSE,$productmap["name"],"",6);
widget_formButtons(array("Save"=>TRUE),TRUE);
(I'm preparing my reply to your email regarding some more significant changes you made previously - no need to send me this file in response, the changes should be confined to the helper tool...)
Cheers,
David.
--
PriceTapestry.com
Hi David
Does the same code apply for 15/01A as I seem to be getting the following: Fatal error: Call to undefined function widget_posted()
Kind regards
Dale
Hi Dale,
widget_posted() has been deprecated as all $_POST fields are now cleansed automatically by includes/widget.php so you can simply remove the line with the call to widget_posted() - corrected above also.
Cheers,
David.
--
PriceTapestry.com
Hi Chris,
Sure - here's a patch to do this - but I would strongly recommend making a backup using the Database Tool (from the Admin menu) first!!
In admin/productsmap_configure.php look for the following code at line 41:
if ($_POST["alternates"])
...and REPLACE with:
$_POST["name"] = widget_posted($_POST["name"]);
if ($_POST["name"] <> $productmap["name"])
{
$sql = "SELECT id FROM `".$config_databaseTablePrefix."productsmap` WHERE name='".database_safe($_POST["name"])."' AND id<>'".database_safe($id)."'";
if (!database_querySelect($sql,$result))
{
$sql = "UPDATE `".$config_databaseTablePrefix."productsmap` SET name='".database_safe($_POST["name"])."' WHERE id='".database_safe($id)."'";
database_queryModify($sql,$result);
}
}
if ($_POST["alternates"])
And finally, look for the following code at line 131:
print "<input type='submit' name='submit' value='Save' /> ";
....and REPLACE with:
print "<strong>Rename Mapping:</strong><br />";
print "<input type='text' name='name' value='".widget_safe($productmap["name"])."' />";
print "<br /><br />";
print "<input type='submit' name='submit' value='Save' /> ";
A "Rename Mapping" box will then appear just above the Save / Cancel buttons. Note that if a new name is entered that already exists the rename process will simply silently fail but any other changes made will still be saved.
Cheers,
David.
--
PriceTapestry.com