How to add custom text to price or How to display EMI prices in order review?
-
16-10-2019 - |
Question
As my site uses EMI options for payment the prices in Order review section should be shown in
Rs.xxx per month
format.
I've made changes to phtml files only [to do this], because it should only be shown like that but price calculations should happen as it is.
Now my problem is, I've used FlyWebdesign_PaypalFee extension to add payment method charges, I need to display the payment method charge in the above mentioned format.
the prices in the image may not be correct, it's just the format I want. I want Payment charge to be shown as 120 per month
I don't know how to do this, can anyone help please?
I know the payment charge is passed like
$address->addTotal(array(
'code' => $this->getCode(),
'title' => Mage::helper('sales')->__('Payment Charge'),
'full_info' => array(),
'value' => $amount,
'emi' => 'per month' // custom line to show per month.
));
and i can add an extra element in the array, to fetch it in payment review. But how to appended it to Rs120.00
Solution
I used
$address->addTotal(array(
'code' => $this->getCode(),
'title' => Mage::helper('sales')->__('Payment Charge'),
'full_info' => array(),
'value' => $amount,
'text' => $appendText // text to be appended
));
in app/code/local/FlyWebdesign/PaypalFee/Model/Sales/Quote/Address/Total/Paymentcharge.php fetch() method and
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
<?php echo $this->getTotal()->getText(); // print text to be appended ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
in app/design/frontend/my_theme/default/template/checkout/total/default.phtml
That does the trick!