You are here:  » One Price tapestry Install for multiple Websites


One Price tapestry Install for multiple Websites

Submitted by Fuzzy on Thu, 2016-05-05 06:30 in

Is it possible to have the one install for multiple websites running wordpress, this would severely cut down on duplication.

All sites are hosted on the same linux server:

Domain One: Price Tapestry.

Domain 2: Wordpress.
Domain 3: Wordpress.
Domain 4: Wordpress.

Cheers in advance.

Submitted by support on Thu, 2016-05-05 08:34

Hi Fuzzy,

That should work fine - the main criteria would be that Price Tapestry and all WordPress installations share the same MySQL database. Price Tapestry uses a table prefix of "pt_" by default, and WordPress uses wp_ by default so you would need to change this for each WordPress installation at line 62 in wp-config.php;

$table_prefix = 'wp_';

e.g. wp1_ , wp2_ etc.

The only other issue you may come across is merchant logo support if each installation is in a separate user account on the server and the WordPress installations do not have read access to the /logos/ folder to check whether a logo exists (displaying the logo is no problem as the script simply generates the HTTP URL to the logo based on the Base HREF setting from the External section of the PriceTapestry.org configuration ( wp-admin > Settings > PriceTapestry.org ).

The scripts use a file_exists() check using the Install Path (also in the External settings section) so if it is the case that this would fail because of file system access permissions but you want to use merchant logos then as long as they will always exist the test can simply be bypassed - to do this, edit pto_product.php and look for the following code at line 101:

  if (file_exists($pto_config_externalPath."logos/".$product->merchant))

...and REPLACE with:

  if (TRUE)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Fuzzy on Thu, 2016-05-05 09:35

Thanks for the help David.

Having the one database may not be feasible - purely for management reasons.

Had a bit of a search and it appears using a method like

$second_db = new $wpdb( 'user', 'pass', 'dbname', 'host' );

So basically we alter the pt plugin on each install to only query the one database - still may not be feasable, just researching the best way to do something like this.

Submitted by support on Thu, 2016-05-05 09:51

Hi,

That should be an option.

You'd need to do a Search and Replace on all the plugin .php files from wp-content/plugins/pto/ as follows;

Search:

$wpdb

Replace:

$pto_wpdb

And then in pto.php look for the following code at line 31:

  require("pto_settings.php");

...and REPLACE with:

  require("pto_settings.php");
  $pto_wpdb = new wpdb("username","password","databasename","hostname");

(connection parameters passed as per the database containing the associated Price Tapestry installation...)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by richard on Mon, 2017-11-27 23:28

Hi David

I thought this was going to be very simple and I guess it is if you know what you are doing!!!

I have a wordpress and PT set up (website 1) and now creating a second worpdress site referencing the PT database from website 1.

Steps taken:
a) I have set the configuration page for PTO on website 2 to reference Base HREF and Install Path on website 1

b) Changed all instances of wpdb to $pto_wpdb in PTO files and then added $pto_wpdb = new wpdb("username","password","databasename","hostname"); using the username, password etc... related to website 1 PT configuration

Is there something else I should do to make website 2 pull data from PT installation for website 1?

Best regards

Richard

Submitted by support on Tue, 2017-11-28 09:34

Hi Richard,

There's no reason why multiple WordPress installations cannot use the same MySQL database as the table prefix is configurable in wp-config.php at line 66:

$table_prefix = 'wp_';

So assuming that Website 1 is using the default of wp_ you could install Website 2 (WordPress) using;

$table_prefix = 'wp2_';

And then both sites would have no problem accessing the Price Tapestry installation also in the same database using table prefix pt_

If that's not a possible configuration let me know and I'll check it out further with you of course...

Cheers,
David.
--
PriceTapestry.com

Submitted by richard on Tue, 2017-11-28 22:42

Hi David,

Many thanks. Yes I will take that route.

Best regards

Richard