Hi David,
I would like to have my search results page go direct to the merchant as outlined in node/414. I am using searchExternal.php and the part of the script relevant seems a little different from search.php. Can you tell me exactly what I should use?
Many thanks
shabbysheep
Excellent David, thanks for that. Could you tell me how to do the same with pricesExternal - so that the link goes direct to the merchant?
Thanks again,
shabbysheep
Hi,
priceExternal.php uses the existing html/prices.php - in which the "Visit Store" link is already a direct link to the merchant (for that product) - so i'm guessing you mean the first link in the table (the Merchant Name)...?
To do this, look for the following code beginning at line 62 of priceExternal.php:
if ($config_useRewrite)
{
$rows[$k]["merchantHREF"] = $config_baseHREF."merchant/".tapestry_hyphenate($row["merchant"])."/";
$rows[$k]["reviewHREF"] = $config_baseHREF."review/".tapestry_hyphenate($row["name"]).".html";
}
else
{
$rows[$k]["merchantHREF"] = $config_baseHREF."search.php?q=merchant:".urlencode($row["merchant"]).":";
$rows[$k]["reviewHREF"] = $config_baseHREF."reviews.php?q=".urlencode($row["name"]);
}
...and REPLACE this with:
if ($config_useRewrite)
{
$rows[$k]["merchantHREF"] = tapestry_buyURL($row);
$rows[$k]["reviewHREF"] = $config_baseHREF."review/".tapestry_hyphenate($row["name"]).".html";
}
else
{
$rows[$k]["merchantHREF"] = tapestry_buyURL($row);
$rows[$k]["reviewHREF"] = $config_baseHREF."reviews.php?q=".urlencode($row["name"]);
}
Cheers,
David.
Thanks David, the direct link from merchant name works perfectly, but I've just realised clicking on the search external results list still links to the product description. How can I get 'more information' to link directly to the merchant.
Thanks in advance,
shabbysheep
Hi,
This is a change in searchExternal.php; but note that it should only link directly to the merchant if there is only 1 merchant.... To do this, look for the following 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"]);
}
...and replace this with:
if ($searchresults["products"][$k]["numMerchants"]==1)
{
$searchresults["products"][$k]["productHREF"] = tapestry_buyURL($searchresults["products"][$k]);
}
else
{
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"]);
}
}
Cheers,
David.
Thanks David,
I was just writing an amend when you replied (too quick for me). I haven't added your new script yet as I just noticed that the searchExternal results list DOES link directly to the merchant as you predicted, but pages with my script (see below example) do not.
<?php
$common_baseHREF = "http://compare-pushchairs.co.uk/";
$common_path = "\\\\iis6119\\domains\\c\\compare-pushchairs.co.uk\\user\\htdocs\\";
$_GET["q"] = "Britax ";
require($common_path."searchExternal.php");
?>
Links from the list generated here go to the product description instead. Does make any difference to your suggested amendment?
Regards,
shabbysheep
Hi,
Yes - it should be the same (except for the line number). If you're not sure - email me your version and I'll patch it up for you...
Cheers,
David.
Hi,
The equivalent section in searchExternal.php that you need to replace is...
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"]);
}
...beginning at line 212
Cheers,
David.