Hi David,
Is it possible with product mapping to be able to exclude for example “size 12 Ribbon” when I only want to show “Size 1 Ribbon” without having to use exact matches?
Hi David,
I have tried this but can't get it to work, it only returns one merchant even in I use "Size 1 Ribbon !zzz", When I use "Size 1 Ribbon" again the different merchant records come back.
Thanks
Mark.
Sorry Mark, the negative match needs to be removed from the array for the count() test to work afterwards, please use:
foreach($words as $k => $word)
{
if (substr($word,0,1)=="!")
{
if (strpos($importRecord["name"],substr($word,1)) !== FALSE)
{
$found = 0;
break;
}
else
{
unset($words[$k]);
}
}
elseif ($word)
{
if (strpos($importRecord["name"],$word) !== FALSE) $found++;
}
}
Cheers,
David.
--
PriceTapestry.com
Hi David,
That works great....thanks for the help.
Mark
Hi David,
Which syntax would you use if you have to exclude many words from the same product name?
product name !word1 word2
product name !word1 !word2
product name !word1
product name !word2
Thanks !
Bak
Hello Bak,
The second...
product name !word1 !word2
You can have as many negative keywords in a single Alternative expression as you want, position / order doesn't matter...
Cheers,
David.
--
PriceTapestry.com
Hi Mark,
It's straight forward to add negative keywords to Product Mapping. In includes/admin.php look for the following code around line 284:
foreach($words as $word)
{
if ($word)
{
if (strpos($importRecord["name"],$word) !== FALSE) $found++;
}
}
...and REPLACE with:
foreach($words as $word)
{
if (substr($word,0,1)=="!")
{
if (strpos($importRecord["name"],substr($word,1)) !== FALSE)
{
$found = 0;
break;
}
}
elseif ($word)
{
if (strpos($importRecord["name"],$word) !== FALSE) $found++;
}
}
"!" means "not" in many programming languages so it's a logical character to use; so as an alternative for this mapping use:
Size 1 Ribbon !12
Cheers,
David.
--
PriceTapestry.com