You are here:  » If price is 0


If price is 0

Submitted by henk on Thu, 2012-11-01 21:06 in

Hi David,

Is it possible when the price is zero create a text with "click on the link for more info"

Thx
Henk

Submitted by support on Fri, 2012-11-02 10:10

Hello Henk,

Sure - to do this in the price comparison table, look for the following code at line 86 in pto_product.php:

    $each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);

...and REPLACE with:

    if ($product->price=="0.00")
    {
      $each = str_replace("%PRICE%","Check Website",$each);
    }
    else
    {
      $each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);
    }

Replace "Check Website" with whatever text required, and that should do the trick!

Other locations where the price is displayed is not necessarily merchant specific but similar changes could be made in pto_featured.php (135) and pto_search.php (490) - let me know of course if you're not sure of any additional changes you required...

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Fri, 2012-11-02 15:05

Hi David,

Thx, it runs on product not on featured and search. all the prices are blanco.

Henk

Submitted by support on Fri, 2012-11-02 15:24

Hi Henk,

Because prices are stored as DECIMAL(10,2) any price that is imported as zero should be 0.00 but you may have other modifications in place that can result in a `price` value being empty - so in place of:

    if ($product->price=="0.00")

...use:

    if (($product->price=="0.00") || ($product->price==""))

Hope this helps!
Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Fri, 2013-01-25 21:54

I would like to do this as well but it keeps replacing all my prices with CHECK WEBSITE even if they are not 0.00.

I can't find the code

$each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);

But I do have the code

$each = str_replace("%PRICE%",$pto_config_currencyHTML.$row->minPrice,$each);

around the same line. I tried replacing it but that's when everything changes to Check Website. Idea?

Submitted by support on Sat, 2013-01-26 08:21

Hi twdesigns,

The above referred to an early beta version, my apologies - in the latest distribution, each price in the price comparison table is output by this code at line 79:

    $each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);

..so you could REPLACE with:

    if ($product->price=="0.00")
    {
      $each = str_replace("%PRICE%","Check Website",$each);
    }
    else
    {
      $each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);
    }

Cheers,
David.
--
PriceTapestry.com