You are here:  » Product Mapping - Possible to Maintain Original Individual Product Titles?

Support Forum



Product Mapping - Possible to Maintain Original Individual Product Titles?

Submitted by npaitken on Fri, 2009-09-04 08:56 in

Hi David,

Just a quick question regarding product mapping.

Is it possible to maintain the original individual product titles when product mapping? I'm asking the question because sometimes I want to map a product like this one.

Red Widget 9.99
Red Widget 9.99
Red Widget + FREE thingy 10.00

If I mapped it using the title 'Red Widget' obviously the '+ FREE thing' info disappears. I know there's a good argument to not map examples like this but in many instances I want to map to make things easier to find on my site

If it's possible I'd like to try it to see how it looks.

Thanks,
Neil

Submitted by support on Fri, 2009-09-04 09:08

Hi Neil,

Yes - that's straight forward - essentially it just involves adding a new field to the products table, call it 'name_original" and then populate that with the the pre-mapped name, and use name_original when displaying the product name in the prices table.

To create the new field, the quickest way would be to use phpMyAdmin - just add a new varchar(255) field to the 'products' table, or alternatively create and browse to the following script:

dbmod.php

<?php
  
require("includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products` ADD `name_original` VARCHAR(255) NOT NULL";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Then, in includes/admin.php, look for the following comment (line 228 in the distribution)

    /* apply product mappings */

...and INSERT the following code immediately BEFORE that line:

  $name_original = $record[$admin_importFeed["field_name"]];

...and lower down, add the new field to the SQL. Look for:

                    name='%s',

...and REPLACE with:

                    name='%s',
                    name_original='%s',

and then:

                    database_safe($record[$admin_importFeed["field_name"]]),

...and REPLACE with:

                    database_safe($record[$admin_importFeed["field_name"]]),
                    database_safe($name_original),

Finally, in html/prices.php, the product name is displayed by the following code on line 12:

      <td><?php print $product["name"]; ?></td>

REPLACE this with:

      <td><?php print $product["name_original"]; ?></td>

Hope this helps!

Cheers,
David.

Submitted by npaitken on Fri, 2009-09-04 09:26

Excellent!!

Thanks David.

Submitted by npaitken on Fri, 2009-09-11 10:57

Hi David,

Finally got around to implementing this mod and it worked perfectly first time. First impressions are I really like. I've got lots of products where there's 6 or 7 merchants all on the same price point but one might have a + FREE CASE or something similar. That merchant, rightly, now stands out from the crowd.

Thanks again for a great mod,
Neil