You are here:  » Adding PT to existing WP-site with loads of data


Adding PT to existing WP-site with loads of data

Submitted by Rik on Tue, 2014-10-07 14:57 in

Hi David,

have been using PT a lot in the past and am planning to use it for a existing site again. Before I get started installing and implementing everything I would like to hear your opinion on the best way to use PT and the WP-plugin on an existing site.

At the moment I have a WP-site using posts and custom posts. The posts (which actualy are products) have been extended using custom fields (loads of them). My goal is to import datafeeds with prices and stock-info so visitors can compare prices of the products.

These products are allready added to Wordpress manually and completed with visuals, specs and custom text. All future products will be added manually too because it's a personal selection, not just aggregated data from affiliate programs.

PT (and the plugin) should be used only to import current prices and stock/availability to these existing posts and be updated daily.

Visitors should be able to filter and search posts (products) on specs (will be done using custom queries in WordPress) and prices (this is where PT comes in)

What's the best way to achieve this? Install PT with the WP-database, install plugin and manual map products from PT to existing posts or is there a better way?

Kind regards,

Rik

Submitted by support on Tue, 2014-10-07 15:34

Hello Rik,

As you will have no requirement for importing products from the Price Tapestry database as posts, get started with the latest current version (PriceTapestry.org for WordPress 2.0) rather than using the 3.0 beta version.

I suggest using the shortcodes exposed by the plugin in this case so ultimately you would have no requirement for the "container" permalink page (a page created with the permalink /shopping/ by default as described in the installation instructions) however you may want to create this for testing in the first instance.

Within the Price Tapestry back end, you would then use Product Mapping to match up your datafeed product name(s) with the names used on your site, and then finally it would simply be case of adding the shortcode:

[pto prices="Product Name"]

...to your WordPress posts to pull in the PriceTapestry.org generated price comparison table for your products.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Rik on Tue, 2014-10-07 16:03

Hi David,

thanks for the fast response. Exactly the way I had in mind so I'll give this a try. Will get back to you with the results later this week ;)

Thanks again.

Submitted by Rik on Thu, 2014-10-09 14:42

Hello again David,

PT is installed and I decided to skip the WP-plugin and use pricesExternal.php to add price comparison to my templates.

I added a new field called EAN and use this for searching products. In pricesExternal.php I changed the following code:

 $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' ORDER BY price";

to

 $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE ean = '".database_safe($q)."' ORDER BY price";

This works fine as long as I only use one keyword/EAN-number. Whenever I use more then one EAN number the output of pricesExternal.php stays blank. I tried all kind of separators for my keywords (pipes, semicolomns, OR statement and so on) but can't get it to work.

I realy like to use multiple EAN's every now and then when a shop has different models (i.e. the German modelversion uses EAN XXXXXXX12 and the English version has EAN XXXXXXX23).

Which way can I use multiple keywords/EAN-numbers with pricesExternal.php? Hope you can help me out again :)

Kind regards,

Rik

Submitted by support on Thu, 2014-10-09 15:10

Hello Rik,

To support multiple values of $q (ean in your case), comma separated, have a go with:

  $eans = explode(",",$q);
  $ins = array();
  foreach($eans as $ean)
  {
    $ins[] = "'".database_safe($ean)."'";
  }
  $in = implode(",",$ins);
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE ean IN (".$in.") ORDER BY price";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com