Hi David,
I'm wondering if it's possible to modify searchExternal.php so that when search results are displayed the resulting links go straight to affiliate links and not the product pages?
In practice I want to have a Wordpress post with embedded products using searchExternal.php. Then on clicking a search result listing, I'd like to go straight to the merchant rather than the product page.
Hope there's an easy fix.
Thanks,
Neil
Excellent, thanks David, worked a treat.
Just thinking of something else. Is it possible to make all links in searchExternal.php search results rel="nofollow". I'm planning to do quite a bit of embedding and don't want to dilute things too much.
Thanks
Neil
Hello Neil,
Sure - you could plumb that in to the above modification without having to make any changes to html/searchresults.php. Instead of the replacement code above, use this:
$searchresults["products"][$k]["productHREF"] =
tapestry_buyURL($product)."' rel='nofollow";
Notice that the closing ' on nofollow is missing - this is intentional, because searchresults.php is just expecting this to be the value of the href attribute, so by including the closing ' of the URL but not after nofollow the net result will be that it comes out correctly... although double check with the HTML being generated to confirm that it is working correctly.
Cheers,
David.
Hi Neil,
Sure - if using rewrite, look for the following code in searchExternal.php around line 212:
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["name"]).".html";
...and REPLACE with:
$searchresults["products"][$k]["productHREF"] = tapestry_buyURL($product);
...or if you're not using rewrite; the same code to replace line 216.
Cheers,
David.