hi
is it possible to show the results on external websites?
for example:
Domain A is a website they shows specific products. so we will take a product punch bag.
Domain B is the price comparison site.
ok Domain A's puchbag page will show the product details etc but on that page it shows the price comparison table that comes from Domain B.
the reason i am looking for this is Domain A wil be heavily optimised for search engines and domain B is just a data site.
if this is possible then i will have 20 domains as product sites all taking specific comparison tables from Domain A
Hope you understand :)
thanks in advance
paul
yes all on same hosting as i have a dedicated server to myself
Hi Paul,
I've just tested a way to do this on my development server which should do the trick. Basically, what i've done is create a script based on products.php that performs the same queries and then just displays the price comparison table HTML module. Here's the script:
Unzip, and then upload to your Price Tapestry installation directory. Now, to use this script on any other website running on this server, simply do the following:
<?php
$common_path = "/path/to/pricetapestry/";
$_GET["q"] = "Product Name";
require($common_path."pricesExternal.php");
?>
...where /path/to/ is the full, absolute path the Price Tapestry installation folder on your server. For example, you might need something like:
$common_path = "/home/httpd/sites/DomainB/";
Hope this helps!
Cheers,
David.
Hi Paul,
Do you mean in terms of showing search results, rather than the Price Comparison table directly?
Cheers,
David.
well i want to show results on widgets on the product site, which is taking them from the price tapestry main site
Hi Paul,
Sure - i've just done a version of the same implementation method as above; but for search results rather than the price comparison table:
Unzip, and upload to your main Price Tapestry installation directory. Then, as above; implementation within any other script on the same server would be as follows:
<?php
$common_path = "/path/to/pricetapestry/";
$_GET["q"] = "Widgets";
require($common_path."searchExternal.php");
?>
Hope this helps!
Cheers,
David.
hi
nearly there but ive got a problem. if you look at http://www.discount.org.uk/20q.php it is bringing the feeds in but when you click on more information how do i get it to go back to directdiscount.co.uk or open a new window showing the result the want
also how to limit the amount of product, ie just show 5 maybe.
Hi,
I went to the page in your URL but the links seemed to work OK - where on the page would I find the links that don't work?
Changing the number of results displayed is easy. In your searchCode.php; look for:
require($common_path."config.php");
...and on the NEXT line; add this code:
$config_resultsPerPage = 5;
...and this will override the value from config.php!
Cheers,
David.
Hi Paul,
Assuming that you want results when you're including the search on your other sites to use a new window; whereas on your main Price Tapestry site you don't the popup; then this will require a new version of searchresults.php to be used by searchCode.php.
To do this, make a copy of html/searchresults.php and save it is, for example, html/searchresultsPopup.php
Edit the new file, and search for each instance of:
<a href
...and replace with:
<a target='_BLANK' href
Finally, edit your searchExternal.php, and change the following code on line 189:
require($common_path."html/searchresults.php");
to:
require($common_path."html/searchresultsPopup.php");
Hope this helps!
Cheers,
David.
Hi David
Would it be possible to do this on websites with deifferent servers?
Cheers
Mally
Hi Mally,
I've just tested this and it works fine remotely (i.e. from a different server). There's no need to pre-set $common_path; and you can supply $q in the URL as normal. So, assuming that URL wrappers are enabled on the server that you wish to access results remotely from. simply use the following code:
<?php
require("http://www.example.com/searchExternal.php?q=Search+Terms");
?>
If the script you wish to include this on is dynamic, and, for example, the query you want to perform on the remote site is in a variable called $keywords; you would use the code:
<?php
require("http://www.example.com/searchExternal.php?q=".urlencode($keywords));
?>
Cheers,
David.
Hi David , i have just niced that my external results that are displayed on the same site but in the top level of the site (non pricetapestry) the link to the product is missing the sub level
so is displaying
http://www.site.co.uk/product/Maria-Long-Sleeve-T-Shirt.html
instead of
http://www.site.co.uk/shops/product/Maria-Long-Sleeve-T-Shirt.html
amy idea how to get the sub level "shops" in the link so the link works?
cheers
Hi Jonny,
Sure - in your searchExternal.php, look for the following code starting at line 172:
if ($config_useRewrite)
{
$searchresults["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
if ($rewrite) $searchresults["products"][$k]["productHREF"] = "../../".$searchresults["products"][$k]["productHREF"];
}
...and replace this with just:
if ($config_useRewrite)
{
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["name"]).".html";
}
Cheers,
David.
Hello David, I would like to know how do I get the external product search and/or external prices to show up on different niche websites or blogs located on different servers (such as Weebly, Tumblr, etc.) that accepts html code & others that may allow php code? I tried following code with no luck within a weebly site that allowed html code to be added to blog. I also tried it on another php website with no luck.
<?php
require("http://www.example.com/searchExternal.php?q=Search+Terms");
?>
Hi,
An IFRAME would be an alternative option, e.g.
<iframe src='http://www.example.com/searchExternal.php?q=Search+Terms' style='width:100%;height:300px;' />
However, for inclusion on a remote site the script would need to be modified to return the fully qualified URL rather than just the path. To do this, edit searchExternal.php and look for the following code at line 391:
$searchresults["products"][$k]["productHREF"] = tapestry_productHREF($searchresults["products"][$k]);
...and REPLACE with:
$searchresults["products"][$k]["productHREF"] = "http".(isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]?"s":"")."://".$_SERVER["HTTP_HOST"].tapestry_productHREF($searchresults["products"][$k]);
Further, as the remote site is unlikely to have the same style framework or other resources you may prefer to make a separate searchresults.php file for use with searchExternal.php - so if saved as for example;
html/searchresultsexternal.php
...then you would edit searchExternal.php and where you have the following code at line 396:
if (isset($searchresults)) require($external_path."html/searchresults.php");
...REPLACE with:
if (isset($searchresults)) require($external_path."html/searchresultsexternal.php");
For syntactical correctness, it may also be worth including html/body tags. Here's a minimum basic table version to get started with...
<html>
<head>
<style type='text/css'>
table {
width: 100%;
}
img {
width: 100px;
}
</style>
</head>
<body>
<table>
<?php foreach($searchresults["products"] as $product): ?>
<tr>
<td>
<?php if ($product["image_url"]): ?>
<img src='<?php print $product["image_url"]; ?>' />
<?php endif; ?>
</td>
<td>
<?php if ($product["description"]): ?>
<p><a target='_blank' href='<?php print $product["productHREF"]; ?>'><?php print $product["name"]; ?></a></p>
<p><?php print $product["description"]; ?></p>
<?php endif; ?>
</td>
<td valign='middle' align='center'>
<?php if ($product["numMerchants"] > 1): ?>
<em><?php print translate("from"); ?></em> <strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
<span class='nobr'><a target='_blank' href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare")." ".$product["numMerchants"]." ".translate("Prices"); ?></a></span>
<?php else: ?>
<strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
<span class='nobr'><a target='_blank' href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
Cheers,
David.
--
PriceTapestry.com
Thanks David.
That worked perfect with the iframe. I just needed to change the links to open in a new window because the iframe kept everything in the frame, including merchant site.
Good point - i've added target='_blank' to the links in the above example...
Cheers,
David.
--
PriceTapestry.com
Hi Paul,
It's certainly do-able, but quite a bit involved.
Is Domain B on the same server as Domain A?
Cheers,
David.