Automatic Product Mapping by Unique ID
As you will know, Price Tapestry compares by exact matches between product names from different merchants. This has obvious SEO benefits, as it enables clean /product/Product-Name.html URLs that do not require any additional ID values to be included in the URL. Where merchants do not use identical product names, the script includes the Product Mapping feature, which lets you easily map the same product from different merchants to your preferred "master" product name.
Traditionally; affiliate data feeds have rarely included unique product ID fields, such as EAN (European Article Number) that are relevant across merchants; but more recently such values have become more readily available so I have created a method for performing an automatic product mapping by a unique product ID field as a post-import process operating on the entire product database.
Note that implementing it this way preserves the SEO benefit of having a single, clean product URL; and is much more efficient than attempting to re-query the database at various points in order to achieve the same.
Step 1 - Add the unique ID field to your database
Following the standard instructions for adding a custom field to your Price Tapestry database, add an appropriate unique ID fieldname, such as "ean" or "sku", and then re-register / import your feeds to populate the new field in the database.
Step 2 - Add a new config variable declaring the name of your unique ID field
To do this, edit config.advanced.php, and add the following code to the end of the file, just before the closing PHP tag - replacing the value with the name of your unique ID field as added in Step 1:
$config_uidField = "ean";
Step 3 - Install the scripts, test and set-up as a CRON job
Download ProductMappingByUID.zip, extract the files to your local computer and upload to your Price Tapestry installation as
After uploading, browse to scripts/uiddbmod.php once to create the intermediate table used by the mapping process, and to add an index to your unique ID field on the products table. This file can then be deleted as it is no longer required.
Finally, to test the process; immediately after a full import of all products run scripts/uidmap.php. This can be run from the browser, but ideally should be run from the command line as it may take a few minutes to complete on large databases; for example, from a command prompt:
If everything is working as expected, uidmap.php can be included in your CRON job. In most cases, multiple commands can be included in the same CRON job using semi-colon separation, for example, if your existing command is:
cd /home/example/public_html/scripts/;/usr/bin/php cron.php
...then to include uidmap.php, use:
cd /home/example/public_html/scripts/;/usr/bin/php cron.php;/usr/bin/php uidmap.php