You are here:  » Prioritize research on mapped products


Prioritize research on mapped products

Submitted by Tobix on Sat, 2021-04-17 06:33 in

Hi, David,
when I type a "washing machine" key on the search string, all the products that have that word appear (including toys, spare parts, etc.). I would like to give priority to the products I am mapping, then inserting toys, accessories etc in the last pages. How can I do?

Submitted by support on Mon, 2021-04-19 10:01

Hi Tobix,

This can be done easily for searches that trigger the FULLTEXT query. First run the following dbmod.php script from the top level of your Price Tapestry installation to add a`mapped` field to the products table:

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products` ADD `mapped` INT(11) NOT NULL default '0'";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Edit includes/admin.php and look for the following code at line 304:

      if ($admin_importProductMappingsOverrides[$importRecord["name"]]["image_url"]) $importRecord["image_url"] = $admin_importProductMappingsOverrides[$importRecord["name"]]["image_url"];

...and REPLACE with:

      if ($admin_importProductMappingsOverrides[$importRecord["name"]]["image_url"]) $importRecord["image_url"] = $admin_importProductMappingsOverrides[$importRecord["name"]]["image_url"];
      $importRecord["mapped"] = 1;

Then edit search.php and look for the following code at line 89:

    $orderByFullText["relevance"] = "relevance DESC";

...and REPLACE with:

    $orderByFullText["relevance"] = "mapped DESC,relevance DESC";

Finally re-import all feeds to get the new mapped field set for mapped products, and they should appear first in the results...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Tue, 2021-04-20 15:55

Error 500 :(

Submitted by support on Wed, 2021-04-21 09:44

Hi Tobix,

At which stage in the mods to you get the 500 error - is it trying to import after making the changes to includes/admin.php or doing a search after modifying search.php?

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Wed, 2021-04-21 15:09

yes. the problem is if I look for an unmapped product it gives me an error!

Submitted by support on Thu, 2021-04-22 07:11

Hi Tobix,

I have just tried a few searches on your site which looked OK, can you confirm a keyword to try that causes the error?

Thanks,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2021-04-22 19:25

I put everything back as before :(

Submitted by support on Fri, 2021-04-23 07:18

Hi Tobix,

Please could you double check the database changes from /admin/ by going to Tools > Feed Utilities and then click Imported Analysis alongside one of the feeds that you know has mapped products. On the results page, use the search box to locate one of those products to go to the product record. When viewing the product record, can you see the `mapped` field with the value 1?

If that looks OK, please could you restore the modified search.php and let me know when it is online as well as a mapped product name that is causing the error...

Thanks,
David.
--
PriceTapestry.com