SOLVED - see below
Hi folks,
I'm using ProductPriceRaw to return the price of a product for various things. However, the price returned misses off any training 0's e.g. 3.50 become 3.5, 100.00 is 100 etc
Whats the best way to return the following:
£3.50
rather than just 3.5??
i'm assuming PHP, but i'm unable to do what I need to.
on a product, with price £3.50
<actinic:block php="true" >
$var = "<actinic:variable name="ProductPriceRaw" />";
echo $var;
</actinic:block>
this returns 3.5
fine.
now, with PHP I thought that variables were of a type depending on what you do with them...
so,
<actinic:block php="true" >
$var = "<actinic:variable name="ProductPriceRaw" />";
$num = number_format($var, 2, '.', '');
echo $num;
</actinic:block>
I assumed would return 3.50 as well, but it returns 0.00
I can't seem to get ProductPriceRaw out as a number - can someone shed any light on my inability as a PHP programmer please!!
also note, this is a return string for pinterest.com and it seems that pinterest is reading 3.5 as 3 because if you dont have 2 decimals, it truncates the value....
Thanks
-------------------------------
SOLVED: used this:
<actinic:block php="true" >
echo "£" . number_format((<actinic:variable encoding="perl" name="ProductPriceRaw" selectable="false" />), 2);
</actinic:block>
and it worked.
the important bit is setting the Selectable=false bit
from here:
http://community.actinic.com/archive...p/t-46620.html
Hi folks,
I'm using ProductPriceRaw to return the price of a product for various things. However, the price returned misses off any training 0's e.g. 3.50 become 3.5, 100.00 is 100 etc
Whats the best way to return the following:
£3.50
rather than just 3.5??
i'm assuming PHP, but i'm unable to do what I need to.
on a product, with price £3.50
<actinic:block php="true" >
$var = "<actinic:variable name="ProductPriceRaw" />";
echo $var;
</actinic:block>
this returns 3.5
fine.
now, with PHP I thought that variables were of a type depending on what you do with them...
so,
<actinic:block php="true" >
$var = "<actinic:variable name="ProductPriceRaw" />";
$num = number_format($var, 2, '.', '');
echo $num;
</actinic:block>
I assumed would return 3.50 as well, but it returns 0.00
I can't seem to get ProductPriceRaw out as a number - can someone shed any light on my inability as a PHP programmer please!!
also note, this is a return string for pinterest.com and it seems that pinterest is reading 3.5 as 3 because if you dont have 2 decimals, it truncates the value....
Thanks
-------------------------------
SOLVED: used this:
<actinic:block php="true" >
echo "£" . number_format((<actinic:variable encoding="perl" name="ProductPriceRaw" selectable="false" />), 2);
</actinic:block>
and it worked.
the important bit is setting the Selectable=false bit
from here:
http://community.actinic.com/archive...p/t-46620.html
Comment