php code for simple plots

2

I have this code php to show the number of parcels, but it shows like this: Parcele up to 6x without interest. I want him to show it like this: Parcele in up to 6x of 30 reais.

In the case of 30 reais is just an example, he would have to divide the total number by 6 and show.

The code is this:

<?php
    $vezes = $_product->getData('parcelas');
    echo '<p><small><b>Parcele em até '.$vezes.' X sem juros</b></small><br />';
        for ( $i=1; $i <= $vezes; $i++ ) {
             echo '<small>'.$i.'x de '.$_coreHelper->currency($_product->getFinalPrice()/$i, true, false).'</small><br />';
        }
    echo '</p>';
?>

It also shows the parcels in rows, but that's fine.

How would you look?

    
asked by anonymous 11.08.2015 / 05:24

1 answer

1

You can construct a variable to do the calculation and print it. Like this example:

<?php
$vezes = $_product->getData('parcelas');
$calc = $_coreHelper->currency($_product->getFinalPrice()/$vezes, true, false);
echo "<p><small><b>Parcele em até '".$vezes."' X sem juros de '".$calc."'</b></small><br />";
    for ( $i=1; $i <= $vezes; $i++ ) {
        echo '<small>'.$i.'x de '.$_coreHelper->currency($_product->getFinalPrice()/$i, true, false).'</small><br />';
    }
echo '</p>';
?>

I think you should resolve your issue.

    
11.08.2015 / 06:13