Hi David,
Hope all is well there.
Have a question if it would be possible to have a select field on a search reg exp filter, say to select image, brand or product name.
and if that Exp is there, say like (cloudfront) to have the mod replace that entire image url with one of our own?
Example images/noimage.jpg
Thanks in advance,
Your support is the greatest.
Bob L.
Bob L.
Spot on, Mr. David.
Thank you very much for the great support and great software.
Bob L.
Hi David,
Hope all is well.
I really like this script.
Used it in a few places already where images from feeds were broken.
The problem came when searching for a product name with a broken image, it replaces the product name that contained the text with the /images/noimagejpg.
Example :
Product name - MyBlueWidgets
searchRexExpAll (Blue)
replace (/images/noimage.jpg)
Bob L.
Hi Bob,
It sounds like there may be an instance of the filter accidentally associated with the Product Name field instead of the Image URL field - that would be the only way that the product name field would be affected - that should be all it is...
Cheers,
David.
--
PriceTapestry.com
Hello Bob,
To add a Search and Replace All RegExp filter, add the following code to your includes/filter.php:
/*************************************************/
/* searchReplaceAllRegExp */
/*************************************************/
$filter_names["searchReplaceAllRegExp"] = "Search and Replace All (RegExp)";
function filter_searchReplaceAllRegExpConfigure($filter_data)
{
print "Search (Regular Expresion):<br />";
print "<input type='text' name='search' value='".widget_safe($filter_data["search"])."' />";
widget_errorGet("search");
print "<br /><br />";
print "Replace:<br />";
print "<input type='text' name='replace' value='".widget_safe($filter_data["replace"])."' />";
widget_errorGet("replace");
}
function filter_searchReplaceAllRegExpValidate($filter_data)
{
if (!$filter_data["search"])
{
widget_errorSet("search","required field");
}
}
function filter_searchReplaceAllRegExpExec($filter_data,$text)
{
if (preg_match($filter_data["search"],$text))
{
return $filter_data["replace"];
}
return $text;
}
With this in place, add a Search and Replace All (RegExp) filter to the Image URL field, and for Search e.g.
(example1|example2)
...and Replace e.g.
/images/noimage.jpg
And then any Image URL containing "example1" or "example2" will be fully replaced with no image URL...
Cheers,
David.
--
PriceTapestry.com