You are here:  » Product Mapping now in distribution

Support Forum



Product Mapping now in distribution

Submitted by support on Mon, 2007-10-22 15:07 in

Hi Everyone,

Further to the discussion in this thread I have now decided to add a simple Product Mapping feature to the distribution. It works in exactly the same way as category mapping, in that it allows you to specify a single product name that you want to use, and then all the alternative names that are found across your merchants.

I would only recommend using this feature for small, niche sites where the number of mappings required to accurately link products across merchants is limited. For larger sites, remember that Price Tapestry uses MySQL's Full Text indexing for most searches, so a user is almost certain to discover all merchants selling a particular product if not in the related products list then in the search results.

Files Modified:
setup.sql
includes/admin.php
admin/admin_menu.php

New Files:
admin/productsmap.php
admin/productsmap_delete.php
admin/productsmap_configure.php

If you want to add this feature to an existing site, simply download the latest distribution, and then extract and upload the above files over the top of your existing installation. Finally, to create the new product mapping table, browse to:

http://www.yoursite.com/setup.php?installDB=1

This will not delete anything from your existing database - all it will do is add the new table from the latest version of setup.sql.

Cheers,
David.

Submitted by mally on Mon, 2008-07-14 13:00

Hello David

I've tried to add product mapping to my existing price tapestry website however the problem I have is that its already heavily modifed and I'm afraid to overwrite files incase it causes new problems.

Would you be able to cover whats been changed with the following files so myself and no doubt others can make manual changes?

setup.sql
includes/admin.php
admin/admin_menu.php

Cheers

Mally

Submitted by support on Mon, 2008-07-14 14:14

Hi Mal,

setup.sql

Added the table definition for the productsmap table:

CREATE TABLE productsmap (
  id int(11) NOT NULL auto_increment,
  name varchar(255) NOT NULL,
  alternates text,
  PRIMARY KEY (id)
) TYPE=MyISAM;

includes/admin.php

Added the following code:

    /* apply product mappings */
    if (isset($admin_importProductMappings[$record[$admin_importFeed["field_name"]]]))
    {
      $record[$admin_importFeed["field_name"]] = $admin_importProductMappings[$record[$admin_importFeed["field_name"]]];
    }

...immediately after the equivalent section for category mapping within the admin__importRecordHandler() function. To locate this, search for the comment:

    /* apply category mappings */

Then further down added the following code:

    $admin_importProductMappings = array();
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."productsmap`";
    if (database_querySelect($sql,$rows))
    {
      foreach($rows as $productsmap)
      {
        $alternates = explode("\n",$productsmap["alternates"]);
        foreach($alternates as $alternate)
        {
          $alternate = trim($alternate);
          $admin_importProductMappings[$alternate] = $productsmap["name"];
        }
      }
    }

...immediately after the equivalent section for Category Mapping. This is within the admin_import() function; look for and insert the above after the following code:

          $admin_importCategoryMappings[$alternate] = $category["name"];
        }
      }
    }

admin/admin_menu.php

Added the following line:

print "<a href='productsmap.php'>Product Mapping</a>&nbsp;&nbsp;";

...immediately after the equivalent line for Category Mapping (line 16 in the distribution)

If it's not working properly and you'd like me to check over any files that you have modified to include product mapping feel free to email them to me and i'll take a look for you...

Cheers,
David.

Submitted by mally on Sun, 2008-07-20 09:08

great stuff it works now.

Thanks Mal