You are here:  » 2 databases for different countrys

Support Forum



2 databases for different countrys

Submitted by jonny5 on Tue, 2008-04-01 14:20 in

is it possible to have 2 installations of price tapestry , one for UK retailers and one for USA retailers , then on the main site a tick box or drop down menu that you choose which country to search?
On one of my small sites i seem to be getting a lot of Traffic from the USA so would like to give them USA products

Submitted by support on Tue, 2008-04-01 14:42

Hello Jonny,

Sure, the easiest way to do this would be install Price Tapestry in 2 sub-directories, for example:

http://www.example.com/uk/
http://www.example.com/usa/

Then on your home page (index.php), add the following PHP code at the very top:

<?php
  
if ($_POST["submit"] == "Search")
  {
    
$url "/".$_POST["country"]."/search.php?q=".$_POST["q"];
    
header("Location: ".$url);
    exit();
  }
?>

...and then use the following HTML for the main search form:

<form method='POST'>";
<input type='text' name='q' /> ";
<select name='country'>";
<option value='uk'>UK</option>";
<option value='usa'>USA</option>";
</select>";
<input type='submit' name='submit' value='Search' />";
</form>";

Hope this helps!

Cheers,
David.

Submitted by jonny5 on Tue, 2008-04-01 14:51

top man , will give it a go and see what happens :)

Submitted by harican on Mon, 2008-06-16 23:14

Hi David,

Is there a way to search both simultaneously?

For example, to have a drop down show, as in this example, show USA, UK, and BOTH?

Submitted by support on Tue, 2008-06-17 08:20

Hi Steven,

It would be possible with a lot of modification; but i'm afraid there's no easy way to simply merge a query across 2 separate databases.

Cheers,
David.

Submitted by harican on Tue, 2008-06-17 10:28

David,

Can you provide a summary of the modifications needed to make a project such as this work, or if it is not too much to ask, detailed instructions.

Submitted by harican on Fri, 2008-07-25 11:28

David, have you thought this possibility over? Many figured a simpler way to query across two separate databases.

Submitted by support on Fri, 2008-07-25 11:44

Hi,

I'm afraid this would be really difficult to achieve using the existing code base, as the changes would be substantial - it's the sort of project that is better suited to starting from a clean slate.

Sorry...

Cheers,
David.