One of my merchants has several versions (red, blue, green, etc) of the same product at different prices. I have used Product Mapping to combine the different versions into one and I would like only the lowest priced version to show but that's not what's happening.
I have also tried removing the version during import with search and replace but that also does not result in the lowest priced one being imported.
That code seems to do the same thing as the regular Drop Record If Not RegExp. It's keeping the products i'm trying to filter instead of dropping them.
My apologies - I'd left the ! character in the line that calls eregi. I've removed it from the above code - in other words, instead of:
$filter_dropRecordFlag = !ereg($filter_data["text"],$text);
...it should be:
$filter_dropRecordFlag = ereg($filter_data["text"],$text);
Cheers,
David.
Hi,
The best option in this case would be to add an opposite sense version of the "Drop Record If Not RegExp" filter, and then use this to discard the more expensive versions of the same product that you do not wish to import.
To do this, first add the following new code into includes/filter.php
/*************************************************/
/* dropRecordRegExp */
/*************************************************/
$filter_names["dropRecordRegExp"] = "Drop Record RegExp";
function filter_dropRecordRegExpConfigure($filter_data)
{
print "Drop record if field matches regular expression:<br />";
print "<input type='text' size='40' name='text' value='".widget_safe($filter_data["text"])."' />";
widget_errorGet("text");
}
function filter_dropRecordRegExpValidate($filter_data)
{
}
function filter_dropRecordRegExpExec($filter_data,$text)
{
global $filter_dropRecordFlag;
if($filter_dropRecordFlag)
{
return $text;
}
else
{
$filter_dropRecordFlag = ereg($filter_data["text"],$text);
}
return $text;
}
Then, add a new "Drop Record RegExp" filter to the product name field for this feed, and enter the following text in the box on the configuration page;
(Product Name|Product Name|Product Name)
...where each "Product Name", separated by the pipe character, are the names of the products you do not wish to be imported...
Hope this helps!
Cheers,
David.