Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP help needed.


Floob

Recommended Posts

Hi,

 

In the file

catalogincludesmodulesot_total.php

 

there is the following code:

 

      $this->output[] = array('title' => $this->title . ':',

                             'text' => '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',

                             'value' => $order->info['total']);

   }

 

How can I alter this so it still displays the total, but if the currency is anything other than GBP, it displays GBP in brackets after the total.

 

Eg,

Total: 340EUR (?476)

 

Thanks for any help.

Link to comment
Share on other sites

Here is how its done in the Tax module.

 

 if ($value > 0 && $order->info['currency'] != 'GBP') {

         $this->output[] = array('title' => $key . ':',

                                 'text' => $currencies->format($value, true, $order->info['currency'], $order->info['currency_value']) . ' (' . $currencies->format($value, true, 'GBP', $currencies->get_value('GBP')) . ')',

                                 'value' => $value);

 

Can anyone apply this logic to the code above (ot_total.php).

 

Thanks

 

Floob.

Link to comment
Share on other sites

Well I've had a bash but get an error.

 

Here is the code I tried:

 

    function process() {

     global $order, $currencies;



if ($order->info['currency'] != 'GBP') {

     $this->output[] = array('title' => $this->title . ':',

                             'text' => '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . ' (' . $currencies->format($order->info['total'], true, 'GBP', $currencies->get_value('GBP')) . ')</b>',

                             'value' => $order->info['total']);

   }

} else {

$this->output[] = array('title' => $this->title . ':',

                             'text' => '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',

                             'value' => $order->info['total']);

   }

 

 

And here is the error I got:

 

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /home/adultfun/public_html/catalog/includes/modules/order_total/ot_total.php on line 37

 

Fatal error: Cannot instantiate non-existent class: ot_total in /home/adultfun/public_html/catalog/includes/classes/order_total.php on line 29

 

Any ideas how I can get this to act like the tax module above?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...