Sure - first the buy_url field must be added to the search results re-query. To do this, edit pto_search.php and look for the following code at line 384:
$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,image_url,description,price,rating,buy_url FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";
As Related Products are also displayed by the Search Results template, also edit pto_product.php and look for the following code at line 245:
$sql2 = "SELECT name,normalised_name,image_url,description,price,rating,MIN(price) AS minPrice, COUNT(id) AS numMerchants FROM `".$pto_config_databaseTablePrefix."products` WHERE name IN (".$in.") GROUP BY name";
...and REPLACE with:
$sql2 = "SELECT name,normalised_name,image_url,description,price,rating,buy_url,MIN(price) AS minPrice, COUNT(id) AS numMerchants FROM `".$pto_config_databaseTablePrefix."products` WHERE name IN (".$in.") GROUP BY name";
For the template, since search results are generated using a summary query, a visit store link should only be displayed if numMerchants is 1. The Search Results / Each template (wp-admin > Settings > PriceTapestry.org) has an IF condition for this, so if you look for the More Information link:
Hello Brent,
Sure - first the buy_url field must be added to the search results re-query. To do this, edit pto_search.php and look for the following code at line 384:
$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,image_url,description,price,rating,buy_url FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";
And then the following code at line 409:
$pto_searchResults[$k]->rating = $rows3[$product->id]->rating;
...and REPLACE with:
$pto_searchResults[$k]->rating = $rows3[$product->id]->rating;
$pto_searchResults[$k]->buy_url = $rows3[$product->id]->buy_url;
And then look for the following code at line 588:
$each = str_replace("%PRODUCT_URL%",pto_common_productHREF($row),$each);
...and REPLACE with:
$each = str_replace("%PRODUCT_URL%",pto_common_productHREF($row),$each);
$each = str_replace("%BUY_URL%",pto_common_buyURL($row),$each);
As Related Products are also displayed by the Search Results template, also edit pto_product.php and look for the following code at line 245:
$sql2 = "SELECT name,normalised_name,image_url,description,price,rating,MIN(price) AS minPrice, COUNT(id) AS numMerchants FROM `".$pto_config_databaseTablePrefix."products` WHERE name IN (".$in.") GROUP BY name";
...and REPLACE with:
$sql2 = "SELECT name,normalised_name,image_url,description,price,rating,buy_url,MIN(price) AS minPrice, COUNT(id) AS numMerchants FROM `".$pto_config_databaseTablePrefix."products` WHERE name IN (".$in.") GROUP BY name";
And finally the following code at line 272:
$pto_searchResults[$k]->rating = $rows3[$key]->rating;
...and REPLACE with:
$pto_searchResults[$k]->rating = $rows3[$key]->rating;
$pto_searchResults[$k]->buy_url = $rows3[$key]->buy_url;
For the template, since search results are generated using a summary query, a visit store link should only be displayed if numMerchants is 1. The Search Results / Each template (wp-admin > Settings > PriceTapestry.org) has an IF condition for this, so if you look for the More Information link:
<a href='%PRODUCT_URL%'>More Information</a>
...to add a Visit Store link use something like:
<a href='%PRODUCT_URL%'>More Information</a>
<br />
<a href='%BUY_URL%'>Visit Store</a>
(of course you could just have the Visit Store link along if you wanted)
Cheers,
David.
--
PriceTapestry.com