1

I need to display at the top of the default currency in drupal commerce view the specific currency at the Shopping cart summary view. Something like on the image enter image description here

I tried to ad a custom field if footer tof that view but there is no currency options.

Any idea how to do that?

1 Answer 1

1

I manage to do this using Views PHP module. The variable $results contains the array of all the data.

For "Shopping cart form" and "Shopping cart summary" view you have to add to footer this to the output value of Global: PHP:

<?php 
$amount = 0;
foreach ($results  as $result) {
$amount = $result->field_commerce_total[0]['raw']['amount'] + $amount;
}
$converta = commerce_multicurrency_conversion($amount, 'HRK', 'GBP');
$formatcu = commerce_currency_format($converta, 'GBP');
echo $formatcu;
?>

To the "Commerce add to cart confirmation" you haw to ad to fields Global: PHP output code:

<?php
$amount = $data->field_commerce_total[0]['raw']['amount'];
$converta = commerce_multicurrency_conversion($amount, 'HRK', 'GBP');
$formatcu = commerce_currency_format($converta, 'GBP');
echo $formatcu; 
?>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.