Is a pull down search (like on {link saved}) fairly straight forward - complex?
Thanks - Steve
Do you think multiple installations in folders like {link saved} is the best way to get the best search results for a home shopping style site?
Hi Julian,
A number of users are getting good results with this kind of setup. Given the complexities of search and the limitations within which a script such as Price Tapestry is working it is probably the best solution for a shopping site instead of creating one huge database.
Cheers,
David.
Is it possible to search the whole site - as well as each category if we go down the multiple data base route ?
Hi Julian,
Not using this method i'm afraid. If you want an entire site search you would need to create a single installation. Please note that it is a conscious decision not to provide sub-category support in Price Tapestry - there just is not the quality of data within feeds necessary to make is easy to do and most people would just end up very disappointed with the result. We have to make the best we can with the quality of affiliate product feed data available i'm afraid so regrettably there has to be a trade off somewhere.
Cheers,
David.
what happens if you put thousands and thousands of products into 1 database ?
-slow performance?
-bad results ?
just trying to work out if i will need to go the multiple data base route
Is it possible to query more than one data base ?
Theoretically there shouldn't be a problem with many thousands of products. Individual product search is normally fast; the only slowdown you might see is a search on specific merchant. I'm afraid it's not possible within the script to query more than one database.
Cheers,
David.
So would multiple databases give better results?
if i use the above code do i just paste it into my template ?
and upload price tapestry into serveral directorys - or is there more to it ?
Hi Julian,
You won't need to make any changes to the templates at all, the code above is a standalone search page that you would need to incorporate into the index page of your top level directory (above all the Price Tapestry installations).
In its simplest form, just save the code above as index.php in your top level folder, just making sure to change the folder names of each category as required for your site.
Within the individual installations; remember to set $config_baseHREF in config.php and if you're using mod_rewrite; you will also need to set RewriteBase in your .htaccess file (copied from htaccess.txt). For example, if you create a Home Electronics site in the sub-directory "electronics", then config.php should contain:
$config_baseHREF = "/electronics/";
...and .htaccess would require:
RewriteBase /electronics/
Cheers,
David.
thanks - i tried to put the script into a drop-menu.php script and called it with
require("html/drop-menu.php");?
but i am getting an error
Warning: Cannot modify header information - headers already sent by (output started at /home/me/public_html/my-site/html/drop-menu.php:1) in /home/me/public_html/my-site/html/drop-menu.php on line 6
any ideas?
PS - i have also checked for any spaces that might have crept in as mentioned in another post but i could not see any
Thanks Julian
Hi Julian,
Where are you calling the file? It could be that you have included it before require("html/header.php"); - check if that's the case. If not, can you post the code to your drop-menu.php and i'll take a look...
Cheers,
David.
hi
i have included it after html/header.php - further down the page
and the drop-menu.php is exactly the script you have posted above made into a php file and called in the index with
<?php
require("html/drop-menu.php");
?>
so if i change the drop menu (add more catogory's) the change would be site wide without having to edit every index in each subcat folder
Sorry Julian, I understand the problem now.
The reason for the cannot modify headers error is because part of the script above has to redirect into the appropriate sub-directory with the header() statment. This cannot happen after the script has started to generate content, so the two parts of the script above have to be split up. The following section:
if ($_POST["submit"] == "Search")
{
$url = "/".$_POST["category"]."/search.php?q=".$_POST["q"];
header("Location: ".$url);
exit();
}
...should go right at the top of the script - just after the openning PHP tag and before anything else. I suggest you incorporate this directly into index.php if that is the only file that you are including the sub-directory search box on.
The part of the script that generates the form can go where you currently have it; just comprising of the following part of the code:
print "<form method='POST'>";
print "<input type='text' name='q' />";
print "<select name='category'>";
print "<option value='electricals'>Home Electronics</option>";
print "<option value='appliances'>Appliances</option>";
print "<option value='gadgets'>Gadgets and Gifts</option>";
print "</select>";
print "<input type='submit' name='submit' value='Search' />";
print "</form>";
That should do the trick. The combined script was intended to work "standalone" and not part of the rest of an existing Price Tapestry page.
Hope this makes sense,
Cheers,
David.
Thanks David
just tried it - still getting
Warning: Cannot modify header information - headers already sent by (output started at /home/me/public_html/my-site/index.php
i have tried the script on its own and it works fine i just cant get it to work with my index.php
also if i click on a feature product i have to click it twice to go to the page - 1st click refreshes the page second click take me to the product (not sure if the 2 are related)
Thanks
Hi Julian,
Can you email me your modified index.php and i'll take a look - shouldn't be too hard to spot. Reply to your reg code or forum signup email is the easiest thing to do...
Cheers,
David.
I am taking every opportunity for selfless promotion!
I have used a drop down box on UK Price Comparison Search.
I have linked this to an amazon feed so that if you search for a book called wintersmith, two amazon options appear at the top of the page, then the normal feeds appear. Wintersmith example.
Likewise, this works when no results are found in my local database. Search for Now 64 in Music and you will find no results in my feeds but two Amazon results are found. Now 64.
I did think of multiple installations and using the drop down box to split the site up but there was one problem - some retailers (e.g. Tesco) sell electricals, books, music, etc. Having multiple installations would require a splitting of these export files so that books goes in the books database, electricals goes in the electricals database, etc. Too much hassle for what essentially is designed as a simple system.
I have found one database to be fine for most things. Just don't create a page that lists all the products in the database on one page!
I know this is old but I was wondering if you ever solved this mystery. Or if anyone has a suggestion for creation a drop down search to search separate installations under the same domain.
Thanks!
Hi,
I might be worth reading over some of the solutions proposed for dealing with Commission Junction "multi-merchant" feeds; but working with categories instead...
Hi David,
I was wondering when doing a multi-domain installation whether it made sense to use a single database and use different table prefixes for the different stores or to use totally seperate databases, one for each store?.
Would I be right in thinking that as open database connections are utelized as much as possible, the route of a single database would certainly limit the amount of database connections?
Thanks,
Simon
Hi Simon,
It doesn't make any difference as far as resources are concerned. If you are allowed, for example, 100 simultaneous connections; then it could either be 100 connections to 1 database or 1 connection each to 100 databases.
If I was developing a multi-site Price Tapestry installation I would use just 1 database and use a table-prefix, purely for easy of administration. The other reason you might do this is if your hosting account is limited to "n" MySQL databases.
Cheers,
David.
Hi David,
Have got this to work on sub-directories on my site on the index page. My site template is made up of 3 columns, menu on left, content in middle and menu on right. My search box with categories (sub-directories) is in the right menu.
Have coppied the following code into index.php
if ($_POST["submit"] == "Search")
{
$url = "/".$_POST["category"]."/search.php?q=".$_POST["q"];
header("Location: ".$url);
exit();
}
I have also inserted the code in products.php and search.php for the search to work when viewing a product and search results. This is where I'm getting stuck. I presume the search won't work due to the location of search.php?q in this line?
$url = "/".$_POST["category"]."/search.php?q=".$_POST["q"];
Any ideas?
Hope this makes sense.
Adrian
Hi Adrian,
It looks ok - the important thing is that it goes right at the top of the script before any output has been generated. This is because the header() function cannot send headers if the page content has already begun. If you want me to take a look feel free to email me a copy of your modified search.php or product.php and i'll check it over for you...
Cheers,
David.
Hi David,
After rechecking my files and hadn't inserted the code in search.php !!
Working great now, thanks for your time.
Adrian
Hello again David,
I'm using the drop down search as described above and it works a treat, however it only performs a search if the search button is clicked, nothing happens if you just hit enter. Is there a way to solve this?
Thanks again,
Hayden
Hi Hayden,
To fix this, it's best to use a hidden field rather than $_POST["submit"]. To do this, replace:
if ($_POST["submit"] == "Search")
...with:
if ($_POST["action"] == "Search")
...and then in the form code, between the form tags, add this line:
print "<input type='hidden' name='action' value='Search' />";
Cheers,
David.
Thanks again kind Sir, you are a legend!
Regards,
Hayden
Hi David,
There might be a newer thread regarding this but I can't find it!
When using multiple installations to separate out category groups, is it possible to just have one actual installation that contains all the html etc. and then the various sub-folders relating to the categories with an edited config.php in each sub-folder, or do you need the full PT install in each folder? I ask because mine is now so customised if I make any more changes I'd rather only have to change the code at one level rather than have to change several instances. Also, is there a solution for a single top level search form that will search the multiple databases?
Cheers.
Keeop
Hi Keeop,
Just about to head out but wanted to reply quickly as there is a possible easy option regarding the customisation of multiple installations.
If your hosting account is running on a Linux server, and you have shell (SSH) access, you should have the facility to create soft-links, which would mean that each of your category installations could have their html/ folder link to a master / template installation (either one of your actual installations; or a separate installation that you use only to maintain the template).
In other words, you could set-up a "dummy" Price Tapestry installation at:
www.example.com/template/
And then for, let's say, an "/electronics/" installation; you could create the soft-link from html/ to /template/html/ (and ditto all other installations). Via SSH, the commands would be something like
$cd /electronics/
$rmdir html
$ln -s ../template/html/ html/
(where $ is your command prompt)
Regarding a top level search form searching all sub-installation; yes - I have a neat solution for this that presents a search form and a drop-down list of categories, with "All" as an option. If a category is selected; the form handler submits the form to the appropriate /category/ installation; otherwise the number of results from each category is returned, with the category name being a link to the actual results, with the number of results in that category shown in brackets, e.g.
Electronics (130)
Home and Garden (15)
Fashion and Beauty (40)
If you want to go with that approach, if you could email me the search.php from one of your installations (so that I can replicate the exact search code) I'll return the template scripts that you can incorporate into your top level site...
Cheers,
David.
Hi David,
Thanks for replying - hope it didn't make you too late!
I'm using Windows as the OS so I'm guessing this might scupper things? I'll also email you the search.php but obviously ignore it if the first part can't be done.
Cheers.
Keeop
Hi David
just wondering is there an html version for doing this for using the searchform.php file?
i would like to make it possible to search all sub installations from every page on my site
thanks in advance
regards
Phil
www.buy24-7.net
Hi Phil,
It should just be a case of making sure that the action attribute of the form tag is pointing to the full path (i.e. beginning with "/") so that from wherever it is submitted it is submitted to sitesearch.php.
If you're not sure, if you could email me with a link to the installation; the existing locations of sitesearch.php and any HTML you are using so far and I'll check it out...
Cheers,
David.
--
PriceTapestry.com
Hi David,
How can i make a dropdown wit:
electricals.example.com
appliances.example.com
gadgets.example.com
And:
I have one feeds map for different installations will the cron only update the files in that installation?
Thx
Henk
Hello Henk,
Almost identical to the search handler code from the first reply at the top of this thread; except that the category value is used to construct the subdomain for the redirect URL:
<?php
if ($_POST["submit"] == "Search")
{
$url = "http://".$_POST["category"].".example.com/search.php?q=".$_POST["q"];
header("Location: ".$url);
exit();
}
print "<form method='POST'>";
print "<input type='text' name='q' />";
print "<select name='category'>";
print "<option value='electricals'>Home Electronics</option>";
print "<option value='appliances'>Appliances</option>";
print "<option value='gadgets'>Gadgets and Gifts</option>";
print "</select>";
print "<input type='submit' name='submit' value='Search' />";
print "</form>";
?>
The easiest thing to do is probably to split the above up and just have a single handler on www.example.com/searchredir.php containing:
<?php
if ($_POST["submit"] == "Search")
{
$url = "http://".$_POST["category"].".example.com/search.php?q=".$_POST["q"];
header("Location: ".$url);
exit();
}
?>
And then your search form HTML, which can be included anywhere is just:
<?php
print "<form method='POST' action='http://www.example.com/searchredir.php'>";
print "<input type='text' name='q' />";
print "<select name='category'>";
print "<option value='electricals'>Home Electronics</option>";
print "<option value='appliances'>Appliances</option>";
print "<option value='gadgets'>Gadgets and Gifts</option>";
print "</select>";
print "<input type='submit' name='submit' value='Search' />";
print "</form>";
?>
Even whilst using a common /feeds/ directory for all installations cron.php will only process jobs and feeds registered against the installation from which it is called.
Therefore, what I would suggest is having one "master" installation which is the only installation in which you use the Automation Tool to create jobs, and then instead of using cron.php use fetch.php on the master installation; followed by import.php @ALL on each installation to import the feeds being used by that installation...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
It looks like the webmaster of {link saved} has created multiple installations of Price Tapestry for each category using sub-domains. Then, when making a search on the homepage, a script is redirecting the query to the search script on the sub-domain for the selected category.
As an alternative to using sub-domains, you could also achive this by installing Price Tapestry multiple times into sub-directories for each catgeory, for example:
www.example.com/electricals/
www.example.com/appliances/
www.example.com/gadgets/
For each installation; you would specify a different base HREF and table prefix in the configuration file.
Next, you would need to write a search script for the homepage that redirected the query to the appropriate installation. An easy way to do this would be use the value="" part of the drop down select box to work out what URL is required, and then issue a 302 redirect (using PHP's header() function) to that URL. The following code shows how to do this:
<?php
if ($_POST["submit"] == "Search")
{
$url = "/".$_POST["category"]."/search.php?q=".$_POST["q"];
header("Location: ".$url);
exit();
}
print "<form method='POST'>";
print "<input type='text' name='q' />";
print "<select name='category'>";
print "<option value='electricals'>Home Electronics</option>";
print "<option value='appliances'>Appliances</option>";
print "<option value='gadgets'>Gadgets and Gifts</option>";
print "</select>";
print "<input type='submit' name='submit' value='Search' />";
print "</form>";
?>
That's the basics of how it's done. There would be a little more to it of course; for example using the new search form on each sub-site (you could do this by customising html/searchform.php) but this should give you a general idea of what's required.
Hope this helps!
David.