Warning: explode() [function.explode]: Empty delimiter
#1
Posted 19 June 2012 - 12:03 PM
So I'm getting this error:
Warning: explode() [function.explode]: Empty delimiter in .../includes/classes/currencies.php on line 55
And I just don't understand where it's coming from!
Line 55 says:
$format_string = explode($this->currencies[$currency_type]['decimal_point'], $format_string);
And also if I use the currencies box to click on the default currency or switch to another currency, this error disappears.
My default currency is USD and I also have euro and gbp.
Does anybody know what could be the issue here?
#2 ONLINE
Posted 20 June 2012 - 06:27 AM
#3
Posted 20 June 2012 - 06:55 PM
Thanks for replying!
I do have a dot in admin where the decimal point must be inserted....
So that's not the problem..
#4 ONLINE
Posted 21 June 2012 - 06:29 AM
Can you say what version you are using, if you modified that file in any way and place the complete contents of classes/currencies to here?
Please use <> (code tags) for this, like this
This is in code tags
#5
Posted 21 June 2012 - 06:07 PM
I just checked the vanilla osC classes/currencies.php and sure enough you're right!!
It seems I changed the format function. Mine looks like this now...
I don't remember doing that though.... I'm just going to revert back to the original function...
// class methods
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'];
$format_string = explode($this->currencies[$currency_type]['decimal_point'], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . $format_string[1];
} 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'];
$format_string = explode($this->currencies[$currency_type]['decimal_point'], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . $format_string[1];
}
return $format_string;
}
#6
Posted 21 June 2012 - 06:23 PM
#7
Posted 21 June 2012 - 10:24 PM
JSR, on 20 June 2012 - 06:55 PM, said:
Thanks for replying!
I do have a dot in admin where the decimal point must be inserted....
So that's not the problem..
Check and be sure that's true for all the currencies.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#8
Posted 21 June 2012 - 11:57 PM
I have 3 currencies installed (USD default) and all have a dot inserted as decimal point...
English is the only language and language currency is defined as USD.
I also have use default language of currency set to true in admin configuration...
#9 ONLINE
Posted 22 June 2012 - 04:08 AM
#10
Posted 22 June 2012 - 09:58 AM
<?php
/*
$Id: currencies.php,v 1.16 2003/06/05 23:16:46 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
////
// Class to handle currencies
// TABLES: currencies
class currencies {
var $currencies;
// class constructor
function currencies() {
$this->currencies = array();
$currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
while ($currencies = tep_db_fetch_array($currencies_query)) {
$this->currencies[$currencies['code']] = array('title' => $currencies['title'],
'symbol_left' => $currencies['symbol_left'],
'symbol_right' => $currencies['symbol_right'],
'decimal_point' => $currencies['decimal_point'],
'thousands_point' => $currencies['thousands_point'],
'decimal_places' => $currencies['decimal_places'],
'value' => $currencies['value']);
}
}
///Begin of addition to currencies.php for deposit(deposit payments) mod
function price() {
global $order;
$number = $order->info['total'];
$currency_value = $order->info['currency_value'];
$rate = (tep_not_null($currency_value)) ? $currency_value :
$this->currencies[$currency_type]['value'];
$price = round (($rate * $number), 2) ;
return $price;
}
//End of addition to currencies.php for deposit (deposit payments) mod
// class methods
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'];
$format_string = explode($this->currencies[$currency_type]['decimal_point'], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . $format_string[1];
} 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'];
$format_string = explode($this->currencies[$currency_type]['decimal_point'], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . $format_string[1];
}
return $format_string;
}
function is_set($code) {
if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
return true;
} else {
return false;
}
}
function get_value($code) {
return $this->currencies[$code]['value'];
}
function get_decimal_places($code) {
return $this->currencies[$code]['decimal_places'];
}
function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
}
}
?>
#11
Posted 25 June 2012 - 10:46 AM
if (empty($currency_type)) $currency_type = $currency;
ADD this code:
if ( $this->currencies[$currency_type]['decimal_point'] == '' ) {
$this->currencies[$currency_type]['decimal_point'] = '.';
}
This fix is only a "band-aid". It just covers up a problem somewhere else. Where ? - I haven't a clue....
As long as all your currencies use a period for the 'decimal_point" it should work.
Cross your fingers another error doesn't pop up somewhere else.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#12
Posted 26 June 2012 - 02:41 PM
Thanks for the band aid, but all prices turn up as "0." right now.
I'm completely lost
All currencies have use a period forthe decimal point so I don't even know where to look anymore...
#13
Posted 26 June 2012 - 09:19 PM
I'm also guessing it used to work fine, then something happened to cause the error you first posted about.
So maybe if you elaborate on how you've wound up where you are now we can backtrack and find the malfunction.
Without a little history I wouldn't know where to start looking either.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#14
Posted 27 June 2012 - 11:40 AM
I have an alteration in application_top that gets the customer country from the ip address and changes the currency accordingly.
But I also removed countries that I don't ship to.
So last year I moved to a country that isn't listed in admin.
That's why prices where showing up as 0 (even with the default code); my country ip could not be verified anymore...
I'm so very sorry about bothering you guys with this issue when it's something that you had no way of knowing in the 1st place...
Please accept my apologies
#15 ONLINE
Posted 27 June 2012 - 02:16 PM
#16
Posted 02 July 2012 - 02:05 PM
It's a good thing though, cause now I know how the site looks for people in unlisted countries...
Thanks again guys!
Edited by JSR, 02 July 2012 - 02:05 PM.









