You are here:  » Multi Database


Multi Database

Submitted by oneilus on Sun, 2013-12-08 15:28 in

Good day :)

Is there I can setup PT to use 3 or 4 databases ?
Each database would contain a different merchant.

Submitted by support on Mon, 2013-12-09 09:16

Hello oneilus,

You could set this up in exactly the same way that many users build multi-category sites with each "master" category, or in your case "merchant" installation in a separate sub directory e.g.

example.com/merchant1
example.com/merchant2
etc.

In each installation, don't forget to set $config_baseHREF appropriately at line 6 of config.php e.g.

  $config_baseHREF = "/merchant1/";

It also straight forward to include a multi-installation search form at your top level, for example:

<form method='get' action='searchredir.php'>
  <input type='text' name='q' />
  <select name='merchant'>
    <option value='merchant1'>Merchant 1</option>
    <option value='merchant2'>Merchant 2</option>
  </select>
  <input type='submit' value='Search' />
</form>

And then create the file searchredir.php as follows, which accepts the form submission and then redirects the query to search.php of the installation specified in the merchant field:

<?php
  header
("Location: ".$_GET["merchant"]."search.php?q=".urlencode($_GET["q"]));
  exit();
?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by oneilus on Tue, 2013-12-10 09:11

Hi David,
Thank you for this but my target was to use 1 installation with multi databases.
I mean, to show the content of all databases together, so in front-end visitors have everything just like with single database.

example for search queries I thought to use JOIN to search in all databases at the same time. But then im not sure how to manage the admin and import process.

Is it possible ?

Submitted by support on Tue, 2013-12-10 11:53

Hello oneilus,

It's not trivial to merge separate tables into a single search style query i'm afraid - it becomes particular complicated with regards to pagination etc.

Could you perhaps describe why you would prefer to have separate database per merchant (e.g. concerned about overall database size for instance) - there maybe an alternative method that doesn't require installation segregation...?

Cheers,
David.
--
PriceTapestry.com

Submitted by oneilus on Tue, 2013-12-10 14:12

Unfortunately I reached the maximum of my database space(1Go) I have approx 900k products.
Bigger database are very expensive so I was looking for this option with multi database.

Submitted by support on Tue, 2013-12-10 14:25

Hello oneilus,

If you're in a hosting environment that is charging for databases by size it would almost certainly be much cheaper to migrate to a VPS (I much prefer VPS over dedicated servers these days as you don't run the risk of hardware failure affecting your own server) and there are many good providers about with VPS offers that are not much more expensive than standard shared hosting - and then of course you are not restricted to database size at all (well, only by disk space - which is usually in the 100's of GB so not a problem there...)

But back to your current platform, are you able to create unlimited databases but each being limited to 1GB in size?

Cheers,
David.
--
PriceTapestry.com

Submitted by oneilus on Tue, 2013-12-10 15:07

Exactly.. this is crazy! I can create unlimited databases but all limited to 1GB :((
I will have a look at VPS :)

Submitted by oneilus on Thu, 2013-12-12 13:38

I just spoke with the hosting company, he said to me that even with a VPN the maximum database size is 1GB...
Very strange, I don't understand that and he advice me to search of a company that provides only a database.

So basically I could have my website hosted on this company and my database on an other company. Is that possible?

Sorry this is a bit out of the topic.

Submitted by support on Thu, 2013-12-12 14:04

Hello oneilus,

No problem - drop me an email and let me know what country you want your site to be hosted in and help you look at various options...

Cheers,
David.
--
PriceTapestry.com