You are here:  » Category mapping - case sensitive??

Support Forum



Category mapping - case sensitive??

Submitted by paul30 on Wed, 2008-09-17 12:28 in

Hello David, I am using the category mapping for mapping brands mod from http://www.pricetapestry.com/node/169 and I am wondering is the category mapping case sensitive?

I have BLUE in the filter and for some reason Blue did not get mapped...

Thanks a lot.

Submitted by support on Wed, 2008-09-17 12:34

Hi,

Yes - as it stands it will be case sensitive, but easily changed.

In includes/admin.php; firstly where the mappings are loaded into an array; look for this code; around about line 351 (but will have moved if you have added the brand mapping mod!):

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

Replace this with:

          $admin_importCategoryMappings[strtolower($alternate)] = $category["name"];

Then, in the section where the mappings are applied, you would have added this code to apply category mappings to brands:

    /* apply category mappings to brands */
    if (isset($admin_importCategoryMappings[$brand]))
    {
      $brand = $admin_importCategoryMappings[$brand];
    }

Replace this as follows:

    /* apply category mappings to brands */
    if (isset($admin_importCategoryMappings[strtolower($brand)]))
    {
      $brand = $admin_importCategoryMappings[strtolower($brand)];
    }

...and similarly in the section above where almost identical code is used to apply the category mappings:

    /* apply category mappings */
    if (isset($admin_importCategoryMappings[$category]))
    {
      $category = $admin_importCategoryMappings[$category];
    }

...replace this with:

    /* apply category mappings */
    if (isset($admin_importCategoryMappings[strtolower($category)]))
    {
      $category = $admin_importCategoryMappings[strtolower($category)];
    }

Cheers,
David.

Submitted by paul30 on Wed, 2008-09-17 14:53

Got it! Thanks!

You are THE BEST!

Submitted by rsachoc on Sun, 2010-04-11 11:20

Hi David

Was trying to do this mod to my installation, but my code looks like this

    /* apply category mappings */
    if (isset($admin_importCategoryMappings["=".$importRecord["category"]]))
    {
      $importRecord["category"] = $admin_importCategoryMappings["=".$importRecord["category"]];
    }

What would I need to do here?

Thanks

Submitted by support on Sun, 2010-04-11 11:26

Hi,

For the latest distribution, replace that section with

    /* apply category mappings */
    if (isset($admin_importCategoryMappings["=".strtolower($importRecord["category"])]))
    {
      $importRecord["category"] = $admin_importCategoryMappings["=".strtolower($importRecord["category"])];
    }

Cheers,
David.