You are here:  » Product Mapping Tool - Display only unmapped products


Product Mapping Tool - Display only unmapped products

Submitted by ChrisNBC on Wed, 2015-01-07 15:07 in

Hi David,

Happy New Year! Hope you had a great Christmas....

I wondered if you might be able to give me some advise re the mapping tool in v14/06....I would like to modify the search result so that when I search for products only those which have not yet been mapped are displayed in the results box.....also I have extended the results to return 20 results instead of the original 6 but I still have to scroll down to view the results if there are more than 6 ...would be grateful if you could suggest how I might extend the height of the results box?

Thanks in advance.

Regards
Chris

Submitted by support on Wed, 2015-01-07 16:15

Hi Chris,

Sure! In admin/helper.php, having changed the limit to 20 you should now have the following code at line 18:

  $sql = "SELECT DISTINCT(".$field.") FROM `".$config_databaseTablePrefix."products` WHERE ".$field." LIKE '%".database_safe($q)."%' ORDER BY ".$field." LIMIT 6";

...if you REPLACE that with:

  if ($field == "name")
  {
    $sql = "SELECT DISTINCT(".$field.") FROM `".$config_databaseTablePrefix."products` WHERE ".$field." LIKE '%".database_safe($q)."%' AND name NOT IN (SELECT name FROM `".$config_databaseTablePrefix."productsmap`) ORDER BY ".$field." LIMIT 20";
  }
  else
  {
    $sql = "SELECT DISTINCT(".$field.") FROM `".$config_databaseTablePrefix."products` WHERE ".$field." LIKE '%".database_safe($q)."%' ORDER BY ".$field." LIMIT 20";
  }

To increase the size of the results box, in the same file look for the following code at line 101:

  print "<select id='helper_results' name='helper_results' size='7' multiple='multiple' style='width:100%;height:110px;' onchange='JavaScript:helper_resultsOnChange();'>";

...and adjust the value of the height style as required.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Wed, 2015-01-07 16:46

Hi David,

Thanks for your quick reply. I have updated the code. The box size is now much larger but the code to exclude products already mapped from the search result does not appear to have any effect. Would be grateful for any suggestions you might have to resolve this.

Thanks in advance.

Regards
Chris

Submitted by support on Wed, 2015-01-07 17:13

Hi Chris,

Ah - just to clarify then, by already added do you in fact mean items already added to the Alternatives box of the mapping that you are currently editing, rather than already created mappings that have already affected the current import?

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Wed, 2015-01-07 17:24

Hi David,

I had in mind mappings that have already been created (mpt necessarily affecting the current import). I take it from your question that I need to re import all the products to remove the mapped ones from the alternative box? Is there a simple way that the alternative box could test the mapping table 'on the fly' to remove mapped products from those available?

Regards
Chris

Submitted by support on Wed, 2015-01-07 17:43

Hi Chris,

I created a "Apply Now" script for product mapping ( http://www.pricetapestry.com/node/5220 ) that would probably the best alternative to avoiding a full import - could you drop me an email noting this thread and I'll forward to you...

Cheers,
David.
--
PriceTapestry.com