You are here:  » Different Country Feeds / Multi-Installations


Different Country Feeds / Multi-Installations

Submitted by PS on Wed, 2018-06-13 17:35 in

We are only using PT (with PT WP) to display price comparison tables to users.

I don't want to mix dollars and pounds, as I feel this would be confusing for users.

Is it possible to either separate out feeds into different 'categories' or currencies in this case, so we can display two price comparison tables, one in dollars with USA merchant feeds and one in pounds, with UK merchant feeds?

Or would multiple installations be the only way to go? (I'd rather not go this route if possible due to having to manage them both separately).

Thanks very much!

Submitted by support on Thu, 2018-06-14 09:09

Hi,

One option would be to add a new custom field `currency` to the database but set-up like Category / Brand so you can either select a field from the feed or manually enter a value to be used for every product in the feed. Then you could register feeds, and for the currency field either enter "GBP" or "USD" as required for each feed.

Then in the plugin, the prices shortcode could be modified to support an optional currency attribute e.g;

[pto prices="Product Name" currency="GBP"]

and

[pto prices="Product Name" currency="USD"]

Let me know if that sounds like it would do what you want and I'll work out the changes for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Thu, 2018-06-14 19:13

Thanks, David.

Yes, that's exactly what I'm looking to do.

If you would be happy to help me out with the details, I'd be really grateful.

Cheers,

Tim

Submitted by support on Fri, 2018-06-15 12:54

Hi Tim,

The standard instructions for adding a new custom field are in this thread. Have a read through that in the first instance, and then combine the implementation with the instructions in this comment which describes how to add a custom field like category / brand whereby you can either select a field from the feed or enter a fixed value to use for every product.

In all instances, replace "keywords" throughout the instructions with "currency".

With that in place, re-register your feeds with the new currency field in place, using GBP or USD as required for each feed, and re-import all feeds.

Next, edit the plugin file pto.php and look for the following code at line 798:

          $pto_product = pto_common_normalise($v);

...and REPLACE with:

          $pto_product = pto_common_normalise($v);
          global $pto_pricesCurrency;
          if (isset($atts["currency"])) $pto_pricesCurrency = $atts["currency"];

Finally, edit the plugin file pto_product.php and look for the following code at line 17:

  $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".esc_sql($pto_product)."' ORDER BY price";

...and REPLACE with:

  $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".esc_sql($pto_product)."'";
  global $pto_pricesCurrency;
  global $pto_config_currencyHTML;
  if (isset($pto_pricesCurrency))
  {
    $sql .= " AND currency='".esc_sql($pto_pricesCurrency)."'";
    $pto_config_currencyHTML = $pto_pricesCurrency;
  }
  $sql .= " ORDER BY price";

You should then be able to use the currency="..." attribute along with the prices shortcode as described above...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Fri, 2018-06-15 21:07

Ah fantastic, thanks, David.

That seems to have worked perfectly!

Cheers,

Tim