Hi,
suppose there's a product called "The 26th Street". The feed lists it as "26th Street, The", which makes it impossible to compare. How can I move "The" back to the beginning and remove the ","?
Since this is probably a regular occurrence for certain types of product it's probably worthy of it's own filter. Add the following code to your includes/filter.php:
/*************************************************/
/* Title Reorder */
/*************************************************/
$filter_names["titleReorder"] = "Title Reorder";
function filter_titleReorderConfigure($filter_data)
{
print "<p>There are no additional configuration parameters for this filter.</p>";
}
function filter_titleReorderValidate($filter_data)
{
}
function filter_titleReorderExec($filter_data,$text)
{
if (preg_match("/^(.*), The$/",$text))
{
$text = "The ".str_replace(", The","",$text);
}
return utf8_decode($text);
}
And then add a new "Title Reorder" filter to the Product Name field and that will re-order for example "26th Street, The" into "The 26th Street" as required.
Hi,
Since this is probably a regular occurrence for certain types of product it's probably worthy of it's own filter. Add the following code to your includes/filter.php:
/*************************************************/
/* Title Reorder */
/*************************************************/
$filter_names["titleReorder"] = "Title Reorder";
function filter_titleReorderConfigure($filter_data)
{
print "<p>There are no additional configuration parameters for this filter.</p>";
}
function filter_titleReorderValidate($filter_data)
{
}
function filter_titleReorderExec($filter_data,$text)
{
if (preg_match("/^(.*), The$/",$text))
{
$text = "The ".str_replace(", The","",$text);
}
return utf8_decode($text);
}
And then add a new "Title Reorder" filter to the Product Name field and that will re-order for example "26th Street, The" into "The 26th Street" as required.
Cheers,
David.
--
PriceTapestry.com