You are here:  » Can I modify searchExternal directly link to merchant page?

Support Forum



Can I modify searchExternal directly link to merchant page?

Submitted by maxbear on Mon, 2009-03-30 10:51 in

Hello,

I want to use searchExternal to do price comparison under wordpress. But I found it shows "more information" (link back to the pt site) instead of "visit store" (link directly to merchant page). Can I show "visit store" in searchExternal? is it possible? Thanks.

Submitted by support on Mon, 2009-03-30 11:13

Hi,

Sure - in seachExternal.php you will find this code beginning at line 210:

      if ($config_useRewrite)
      {
        $searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["name"]).".html";
      }
      else
      {
        $searchresults["products"][$k]["productHREF"] = $config_baseHREF."products.php?q=".urlencode($product["name"]);
      }

The following alternative version will link directly to the merchant if there is only one merchant for the product:

      if ($searchresults["products"][$k]["numMerchants"] == 1)
      {
        $searchresults["products"][$k]["productHREF"] = tapestry_buyURL($searchresults["products"][$k]);
      }
      elseif ($config_useRewrite)
      {
        $searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["name"]).".html";
      }
      else
      {
        $searchresults["products"][$k]["productHREF"] = $config_baseHREF."products.php?q=".urlencode($product["name"]);
      }

Cheers,
David.

Submitted by maxbear on Tue, 2009-03-31 03:11

Thanks David.

Submitted by support on Tue, 2009-03-31 07:57

Hi,

Just to confirm, do you mean that you would rather it show each product separately within the search results rather than grouped?

If that's the case, it should do the trick if you simply remove every instance of:

GROUP BY name

...from searchExternal.php (4 instances), and that should do the trick!

Cheers,
David.