You are here:  » merchant in search results

merchant in search results

Submitted by jbdob on Mon, 2014-12-01 13:38 in

Hello David,

I have a problem with pto version 14/06a.

When i do a normal search (Search results: each) in the results i get everything ok except for merchant, it gives back: %MERCHANT%. But in other places, the same %MERCHANT% gives back the name of the merchant, for example at PRICE: each, then it is ok.

What can be the cause of this? Or do i have something wrong? I also tried with a new feed, same problem.


Submitted by support on Mon, 2014-12-01 13:54


The merchant field isn't included in search results as it stands, since they are generated using a "Summary" query so if the number of merchants available for a product is greater than 1 if the merchant field is included it isn't necessarily the cheapest merchant, although this can be achieved with a re-query if necessary.

If that's not an issue, the field can be added to the SELECT SQL by looking for the following code at line 357 of pto_search.php:

$sql2 = "SELECT id,name,normalised_name,image_url,description,price,rating FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

...and REPLACE with:

$sql2 = "SELECT id,name,normalised_name,merchant,image_url,description,price,rating FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

And then the following code at line 372:

      $pto_searchResults[$k]->name = $rows3[$product->id]->name;

...and REPLACE with:

      $pto_searchResults[$k]->name = $rows3[$product->id]->name;
      $pto_searchResults[$k]->merchant = $rows3[$product->id]->merchant;

With that in place, you can then use %DB_merchant% in your Search Results / Each template.

Hope this helps!