2

It always Return 0 only I can't understand

<?php $emi = Mage::helper('core')->currency($this->helper('tax')->getPrice($_product, $_product->getFinalPrice()),true,false);// 5000?>
<?php $mnth = 12;
echo $emi_value = $emi/$mnth;?>
3
  • Check if $emi is numeric or not first.
    – Prateek
    Commented Mar 1, 2016 at 12:17
  • yes it return 5000 rs
    – user31402
    Commented Mar 1, 2016 at 12:18
  • '5000 rs' is not numeric.
    – Prateek
    Commented Mar 1, 2016 at 12:19

1 Answer 1

2

You are trying to divide a non-numeric value, and so it is returning the 0.

Try with this code instead :

<?php $emi = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice()); ?>
<?php
    $mnth = 12;
    $emi_value = $emi/$mnth;
    echo Mage::helper('core')->currency($emi_value, true, false);
?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.