Below is the code I have, it should take the price of a product then divide by 1000 then times by 38 to get and print the lease_price for products over £500. However, all it does it print NA, even when the product is over £500 it still shows NA. I don't know what is wrong with this? As far as I know this should work.
<p> <i class="fa fa-chevron-down"></i> <b>Lease To Buy Price:</b>
<span>
<?php
$tempPrice = str_replace(',',"", $price); //gets rid of ","
$tempPrice = substr($tempPrice,1); //removes currency from the front
$tempPrice = floatval($tempPrice); //converts to double from string
if($special > 0)
{
$lease_price = (($special/1000)*38);
}
else
{
$lease_price = (($tempPrice/1000)*38);
}
$lease_price = $this->currency->format($lease_price);
if($tempPrice > 500)
{
echo $lease_price;
}
else
{
echo 'NA';
}
?>
</span></p>