You are here:  » Use %PRICE% in a post


Use %PRICE% in a post

Submitted by mennov on Thu, 2012-03-01 12:17 in

Is it possible to show only the highest prices of a product within a wordpress post?

So to have a shortcode for the highest prices of a certain product?

Submitted by support on Thu, 2012-03-01 12:32

Hi,

Shortcodes could be added easily for both minprice and maxprice of a product. In pto.php look for the following code at line 520:

  case "debug":

...and REPLACE with:

  case "minprice":
  case "maxprice":
    global $pto_config_currencyHTML;
    $sql = "SELECT MIN(price) AS minprice,MAX(price) AS maxprice FROM `".$pto_config_databaseTablePrefix."products` WHERE name = '".$wpdb->escape($v)."' GROUP BY name LIMIT 1";
    $wpdb->query($sql);
    $html .= $pto_config_currencyHTML.$wpdb->last_result[0]->$k;
    break;
  case "buyurl":
    $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE name = '".$wpdb->escape($v)."' ORDER BY price LIMIT 1";
    $wpdb->query($sql);
    $html .= "<a href='".pto_common_buyURL($wpdb->last_result[0])."'>".$wpdb->last_result[0]->merchant."</a>";
    break;
  case "debug":

With that in place, for the highest price of a product, use

[pto maxPrice="Product Name"]

...or for the lowest price of a product, use

[pto minPrice="Product Name"]

...and for the merchant name linked to the buy URL link of the cheapest merchant use:

[pto buyURL="Product Name"]

Cheers,
David.
--
PriceTapestry.com

Submitted by mennov on Thu, 2012-03-01 16:13

David,

thanks for the quick reply. However, it doesn't show the result (it shows nothing). I did change something with shipping, I don't no if this changes anything?

Menno

Submitted by mennov on Thu, 2012-03-01 16:15

And I forgot, I actually need the minimum price :) But this should be easy to change.

And is is also possible to have the 'product link' for the product with the lowest price?

thanks.

Submitted by support on Thu, 2012-03-01 16:53

Hi,

Sorry about that there was a typo in the original reply above which I have corrected. Please use the new version, which adds support for:

[pto buyURL="Product Name"]

...with the Buy URL being that of the cheapest merchant (link text being the cheapest merchant name)...

Cheers,
David.
--
PriceTapestry.com

Submitted by mennov on Thu, 2012-03-01 20:15

hi David,

thanks for looking into it, but still no luck. It doesn't show anything when I use it in a wordpress post.

Menno

Submitted by support on Fri, 2012-03-02 10:18

Hello Meno,

Please use the updated modification above; shortcodes are actually lower cased as presented by WordPress to the plugin. You shouldn't need to change your post content at all. As a complete example, with the above in place the following could be used within a post:

The best price is [pto minprice="Product Name"] from [pto buyurl="Product Name"]

Cheers,
David.
--
PriceTapestry.com

Submitted by mennov on Fri, 2012-03-02 10:39

Thanks David!