katonboard Posted October 18, 2005 Share Posted October 18, 2005 This piece of code gives the price of an item (no postage) as $xx.xx. Can anyone tell me what I need to do to make this give me the cost just as xx.xx ??? I would really appreciate the tip. $orders_total=$currencies->format($cart->show_total()); tep_session_register('orders_total'); Thank you, Kat Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2005 Share Posted October 18, 2005 See your osc admin panel Localization->Currencies. Edit the currency you're using and set the symbol you want or leave it blank. Link to comment Share on other sites More sharing options...
katonboard Posted October 19, 2005 Author Share Posted October 19, 2005 Thank you - that does work but I don't want my whole website not to have the format $xx.xx I want to be able to print the cost (minus postage) for something else (one use only) as xx.xx Does anyone know how I can get the code below to do that or a piece of new code to do that? Thank you, Kat Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2005 Share Posted October 19, 2005 ok then, what is the name of the page you want to change (to eliminate the currency symbol)? Link to comment Share on other sites More sharing options...
katonboard Posted October 19, 2005 Author Share Posted October 19, 2005 ok then, what is the name of the page you want to change (to eliminate the currency symbol)? Thankyou enigma1... on the checkout_success.php page I have the following code <img width=1 height=1 src="https://members.commissionmonster.com/track_sale/36/ <?php print $orders_total ?>/<?php print $orders2['orders_id'] ?>/1 "> but I need $orders_total to be of the form xx.xx not $xx.xx which is what I have now using $orders_total=$currencies->format($cart->show_total()); tep_session_register('orders_total'); Kat Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2005 Share Posted October 19, 2005 ok lets try this: open catalog\includes\classes\currencies.php locate this function: function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') { global $currency; if (empty($currency_type)) $currency_type = $currency; if ($calculate_currency_value == true) { $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value']; $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; // if the selected currency is in the european euro-conversion and the default currency is euro, // the currency will displayed in the national currency and euro currency if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) { $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>'; } } else { $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; } return $format_string; } right below it add this code: function format1($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') { global $currency; if (empty($currency_type)) $currency_type = $currency; if ($calculate_currency_value == true) { $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value']; $format_string = number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']); // if the selected currency is in the european euro-conversion and the default currency is euro, // the currency will displayed in the national currency and euro currency if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) { $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>'; } } else { $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; } return $format_string; } I just removed the symbols left/right. Now instead of calling this: $orders_total=$currencies->format($cart->show_total()); call this: $orders_total=$currencies->format1($cart->show_total()); See if this works. Backup your files before changing them. :D Link to comment Share on other sites More sharing options...
katonboard Posted October 19, 2005 Author Share Posted October 19, 2005 enigma1 --- that worked a treat Thank you so much for your time. Kat :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.