says in the manual :
"Like Category Mapping, Product Mapping enables you to create a single master product name to be used in place of any number of alternative names that might be found in different feeds. This feature is only really recommended for small, niche sites where the number of products that require mapping is manageable."
How do we deal with large sites? If we have a couple hundred of feeds, and each have 1000-3000 products, do we have to manually map them all? How is everyone automating this task?
Hello, I'm interested by this mod can I have it?
And Also, is there a way to display product picture on product mapping page?
Because sometime I know that I have already mapped a product but don't remember the name. With a rollover effect it could be easier to find the mapped name in the list. Other solution could be to create a new admin mapping page which display Mapped Products pictures instead of there name. And simply click the picture to go to the productsmap_configure page.
Hi Klyde,
Have a go with this modification. In includes/admin.php, look for the existing product mapping section, beginning at around line 228
/* apply product mappings */
if (isset($admin_importProductMappings[$record[$admin_importFeed["field_name"]]]))
{
$record[$admin_importFeed["field_name"]] = $admin_importProductMappings[$record[$admin_importFeed["field_name"]]];
}
Either comment our delete that section, and replace it with the following code:
foreach($admin_importProductMappings as $k => $v)
{
$found = 0;
$words = explode(" ",$k);
foreach($words as $word)
{
if (strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE) $found++;
}
if ($found == count($words))
{
$record[$admin_importFeed["field_name"]] = $v;
break;
}
}
This will make product mapping keyword based, so rather than products having to exactly match an alternative it will match if all words in the alternative are present - so you can have more than one combination of keywords if required.
It's straight forward to the product image to the main product mapping page. In admin/productsmap.php, look for the following code on line 65:
print "<th align='left'>".$productmap["name"]."</th>";
...and REPLACE with:
print "<th align='left'>";
$sql2 = "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($productmap["name"])."' LIMIT 1";
database_querySelect($sql2,$rows2);
$image_url = $rows2[0]["image_url"];
if ($image_url)
{
print "<img src='".$image_url."' /><br />";
}
print $productmap["name"];
print "</th>";
Hope this helps!
Cheers,
David.
This is great mate, great support! :)
I have added a sku field to the feed, product and also productsmap tables, how do I change the code so when importing, if the products.sku field is same as productsmao.sku the product can be mapped to the master product?
This is excellent for computer products as all SKU are the same.
Hello Hec,
The easiest way to do this would be to dynamically add the SKU as an alternative when loading the Product Mapping array; and then check for it when applying the Product Mapping during import.
To do this, first add the SKU to the array. Look for the following code around line 365 of includes/admin.php
$alternates = explode("\n",$productsmap["alternates"]);
...and REPLACE this with:
$alternates = explode("\n",$productsmap["alternates"]);
$alternates[] = $productsmap["sku"];
And then as alternative to the keyword based product mapping mod described above, replace the original code with the following:
foreach($admin_importProductMappings as $k => $v)
{
$found = 0;
$words = explode(" ",$k);
foreach($words as $word)
{
if (
(strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE)
||
(strpos($record[$admin_importFeed["field_sku"]],$word) !== FALSE)
)
{
$found++;
}
}
if ($found == count($words))
{
$record[$admin_importFeed["field_name"]] = $v;
break;
}
}
Cheers,
David.
hi,
i like to have this modification (keyword based product mapping) to.
but wich file needs to be edit ? cant find the includes.php in my system
thanks
alecs
JoJoGo.CoM
Hello Alecs,
Sorry - that was a mistake in the post - it is includes/admin.php. Corrected above also.
Cheers,
David.
That works like a charm, I have added the textarea etc to the productmapping configure page, but I am not sure how to make it search for the SKU? (it is mapping the product map ok, but straight search for the model number is not set up)
Thanks David! :)
Hello Hec,
Just to clarify, do you mean that you have added an "sku" field to your site (as per this thread, and you would like it to be included in search?
Cheers,
David.
That's right David,
I have put in the SKU field in the tables as per the other post, mapped to the product.
Example
Wonderderful Product A 's model number/sku is abc123
when I search by Wonderful, it finds all products model as abc123, which is what I want
but when I search by abc123, the product entry is not found as we are not yet searching the SKU for the products.
thank you for your help! :)
Hello Hec,
In that case, it should just be case of following the instructions for including the description field in search but replacing "description" with "sky" throughout....
http://www.pricetapestry.com/node/1224
Cheers,
David.
Hi David,
I wanted to know whether there's a chance to improve this keyword-based mapping. My problem is that I need some place to set up also a "negative rule".
For example I have mapped product "Nokia 5220 Red" (=main name) with keyword-based alternates like Nokia 5220 red, Nokia 5220 xpressmusic,... . But it also maps together products like "battery for Nokia 5220 red", "charger for Nokia 5220 red". Then I have created a rule for "Nokia 5220 battery" with another rules, but the "battery for Nokia 5220 red" product keeps mapping to the first one (Nokia 5220 Red) instead of (Nokia 5220 battery), maybe because that rule was set up first.
So I need to make a rule like - map this one when keyword based mapping is ok AND it NOT includes word like "battery, charger". And of course there must be an option that it is going to map this "battery for Nokia 5220 red" product to "Nokia 5220 battery".
Hopefully, it makes sense to you, I didn't know how to explain it correctly:-)
Thanks, David
Hi David,
How about using a minus sign to indicate a negative keyword, e.g. -battery. This would be easy to patch into the modification. In place of:
foreach($words as $word)
{
if (strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE) $found++;
}
Try:
foreach($words as $word)
{
if (substr($word,0,1)=="-")
{
$word = substr($word,1);
if (strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE)
{
$found = 0;
break;
}
}
elseif (strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE) $found++;
}
Cheers,
David.
I have downloaded the latest version and want to add the keyword product mapping mod.
What changes do I need to make to the new includes/admin.php code?
/* apply product mappings */
if (isset($admin_importProductMappings["=".$importRecord["name"]]))
{
$importRecord["name"] = $admin_importProductMappings["=".$importRecord["name"]];
}
Hi,
Product Mapping is now keyword based by default. To specify an exact match, preceed an alternative with "="; otherwise a match will be applied if all words in the alternative are found in a product name being tested - so there shouldn't be any changes required..!
Cheers,
David.
Thanks for your reply.
I have the following entered as a product name Britney Spears Curious Eau de Parfum Spray 30ml and Britney Spears Curious Eau de Parfum Spray 30ml listed as the alternative.
But when I import - Curious Eau De Parfum Spray 30ml by Britney Spears - is not matched, but instead shows as a related product.
I understood that putting Britney Spears Curious Eau de Parfum Spray 30ml into the product mapping would map against it any other products with the containing all the words Britney Spears Curious Eau de Parfum Spray 30ml. But it did not match Curious Eau De Parfum Spray 30ml by Britney Spears - The only difference being the word by. Is the matching case sensitive so didn't match because of de and De?
Any advice appreciated.
Thanks
Hi,
Yes - that will be it; the matching uses PHP string comparison functions and therefore will be case sensitive (as opposed to many functions that use MySQL comparison and are not...)
Cheers,
David.
Hi David,
Just a quickie, using this on the new distribution, what changes should I make to add the negative words mod?
Kind Regards
Hayden
Hi Hayden,
In the new version, look for the following block of code in includes/admin.php, beginning at line 251:
foreach($words as $word)
{
if ($word)
{
if (strpos($importRecord["name"],$word) !== FALSE) $found++;
}
}
...and REPLACE with:
foreach($words as $k => $word)
{
if ($word)
{
if (substr($word,0,1)=="-")
{
$word = substr($word,1);
if (strpos($record[$admin_importFeed["field_name"]],$word) !== FALSE)
{
$found = 0;
break;
}
unset($words[$k]);
}
elseif (strpos($importRecord["name"],$word) !== FALSE) $found++;
}
}
Cheers,
David.
Hi Hayden,
I double-checked the code above and had actually missed a section - updated in my post...
Cheers,
David.
Hi David,
I am having a problem getting any products at all to map correctly for some reason, I tried the mod above that you recommended to Klyde and still no luck, what do you think could be wrong?
Here's an example: {link saved}
You'll notice the top 2 results are basically the same, any idea how I can get these to map correctly?
Cheers,
Chris
Hi Chris,
With the above mod in place (dynamic product mapping); you should be able to create a new mapping with a "master" product name of "LG 42H7000", and then in the alternatives box, simply enter "42H7000". After the next import of all affected feeds; anything with 42H4000 in the product name will be imported as "LG 42H7000" regardless of the actual name in that feed.
If that's not happening after your next import of all feeds; if you want to email me your modified includes/admin.php i'll check the changes over for you...
Cheers,
David.
Hi David
I've implemented these changes as described (to get the negative keywords), but I can't seem to get it working. Is it correct to do the following in the product mapping box (product is called Kenwood KM010 Chef Food Mixer)
km010
KM010
-km020
-KM020
Which I was hoping would map any products with km010 or KM010 in the name, but not with KM020 or km020 in the name.
Is that correct?
PS sorry to bug you on a Sunday.
Hi,
That should be how it behaves - although -KM020 would only be relevant if there are other keywords in your alternatives list that trigger the mapping regardless of KM010/KM020.
If you're not sure, email me your modified includes/admin.php plus full details of the mapping you're trying to apply (master product name + alternatives list) and I'll check it out for you.
Don't forget of course that all affected feeds must be re-imported after creating a mapping as they are only applied at import time, not in real time...
Cheers,
David.
How would I map these two together using the latest version ?
SACCHI S35 PREMIUM ALLOY WHEEL
and
Sacchi S35 Wheels For Cars
?? When I search for sacchi they come back seperately. I have done no other mods or maping, this is a default installation.
Hi,
Assuming that S35 is a keyword unique to this product, simply create a new Product Mapping with a product name of, for example:
Sacchi S35 Premium Alloy Wheel
...and then in the alternatives box, simply enter
S35
Cheers,
David.
Hi there,
A couple of things that may help, firstly helper.php (unzip, upload to /admin/) enables you to quickly search the database for similar product names which you can then copy / paste into the Product Mapping alternatives box.
More significantly, I have a keyword based product mapping mod that will enable you to match products by keywords rather than having to provide alternatives. For example, if you create a master product name of "Sony KDL32W4000", any product name containing any or all of those words (depending on what works best on your site) - for example "Sony 32 inch LCD TV KDL32W4000" will be imported as "Sony KDL32W4000". If you'd like me to incorporate this modification for you, if you could email me your includes/admin.php i'll merge the changes for you...
Cheers,
David.