You are here:  » Shortcode [pto prices ""] and [pto product ""] not working


Shortcode [pto prices ""] and [pto product ""] not working

Submitted by sanniep on Mon, 2017-01-23 21:29 in

Hi David,

I am using PT in a Wordpress installation. I want to use the price comparison table for a product. This worked fine before but now this shortcode (as well as the pto product shortcode) is not working anymore. Examples of not working shortcode:
[pto prices="APPLE iPad Pro 9.7 WiFi 32GB Space Gray"]

The [pto search] still works with the complex product name:
[pto search="APPLE iPad Pro 9.7 WiFi 32GB Space Gray"]

And the prices and product shortcode do work if I use a simple product name like "iPad Pro".

I think it has something to do with the encoding maybe? I tried this solution from a older post (replacing in pto.php) but that did not work:
http://www.pricetapestry.org/node/494

Do you have a clue?

Kind regards, Sander

Submitted by support on Tue, 2017-01-24 10:14

Hello Sander,

There is one other mod related to PHP upgrade (all will be resolved in next distribution of PriceTapestry.org for WordPress) regarding /e modifier deprecation in pto_common.php - to check if this is the case, look for the following code at line 20:

  $text = preg_replace('/[^A-Za-z0-9'.$allow.' ]/e','',$text);

...and REPLACE with:

  $text = preg_replace('/[^A-Za-z0-9'.$allow.' ]/','',$text);

And then the following code at line 47:

  $price = preg_replace('/[^0-9\.]/','',$price);

Cheers,
David.
--
PriceTapestry.com

Submitted by sanniep on Tue, 2017-01-24 12:30

Hi David, I replaced the code (this mod and the one in the other post) but this didn't do the trick.

SO, this does not work: [pto prices="APPLE iPad Pro 9.7 WiFi 32GB Space Gray"]
This does: [pto prices="12W USB Power Adapter"]

Is it the dot or the length of the string? Any ideas?

Submitted by support on Tue, 2017-01-24 12:41

Hello Sander,

My apologies I should have spotted this straight away as the same issue came up just the other day - plugin version 2.0 does not permit the "." character in normalisation as permitted throughout the rest of the script. To correct across all instances; edit pto_common.php and look for the following code at line 16:

  $allow = chr(0x80).'-'.chr(0xFF).$allow;

...and REPLACE with:

  $allow = chr(0x80).'-'.chr(0xFF)."\.".$allow;

Cheers,
David.
--
PriceTapestry.com

Submitted by sanniep on Tue, 2017-01-24 14:21

Yes, that did the trick! Thanks