We will be moving over to BC in 9 months...
![Shocked :shock:](./images/smilies/icon_eek.gif)
ISC is getting behind and I'm getting BC to iron out the remaining bugs WELL in advance!
Daft question, what version of ISC are you running?busi6292 wrote:Thanks for your help Martin. Can't get it to work but I'll live with it for the moment.
Most likely that you haven't updated the code in pricing.php properly.busi6292 wrote:I'm running 6.1.1 but it's still the error from my message a few months ago appearing in the log. Is this file correct? The error points to something on line 17. Thank you
Code: Select all
if(!key_exists('CurrentCurrency', $GLOBALS) && !$currencyId) {
return $options;
}
Code: Select all
/*
* MOD set flag for Price format based on the currency being displayed
* eg: If VAT set for EU/UK countries it will show inclusive for GBP/EURO
* and exclusive for any non-VAT currencies
*/
function formatPriceDependentOnCurrency($options=array(), $currencyId=false) {
if(!key_exists('CurrentCurrency', $GLOBALS) && !$currencyId) {
return $options;
}
$toCurrencyId = $currencyId ? $currencyId : $GLOBALS['CurrentCurrency'];
$toCurrency = GetCurrencyById($toCurrencyId);
if(!in_array($toCurrency['currencycode'], array('GBP', 'EUR'))) {
$options['displayFormat'] = TAX_PRICES_DISPLAY_EXCLUSIVE;
$options['dropLabel'] = true;
$currency2Country = array(
'USD' => 'US',
'CAD' => 'CA',
'AUD' => 'AU'
);
if(key_exists($toCurrency['currencycode'], $currency2Country)) {
$options['countryID'] = GetCountryIdByISO2($currency2Country[$toCurrency['currencycode']]);
/* $GLOBALS['ISC_CLASS_LOG']->LogSystemDebug('php', "CountryISO {$currency2Country[$toCurrency['currencycode']]} CountryID : {$options['countryID']}" ,
"New Country set based on currency : {$toCurrency['currencycode']}");
*/
}
}
else {
$options['displayFormat'] = TAX_PRICES_DISPLAY_INCLUSIVE;
// Default back to UK to ensure pricing updates back to tax inclusive
$options['countryID'] = GetCountryIdByISO2('GB');
}
return $options;
}
// MOD END
Code: Select all
/*
* MOD set flag for Price format based on the currency being displayed
* eg: If VAT set for EU/UK countries it will show inclusive for GBP/EURO
* and exclusive for any non-VAT currencies
*/
function formatPriceDependentOnCurrency($options=array(), $currencyId=false) {
if(!key_exists('CurrentCurrency', $GLOBALS) && !$currencyId) {
return $options;
}
$toCurrencyId = $currencyId ? $currencyId : $GLOBALS['CurrentCurrency'];
$toCurrency = GetCurrencyById($toCurrencyId);
if(!in_array($toCurrency['currencycode'], array('GBP', 'EUR'))) {
$options['displayFormat'] = TAX_PRICES_DISPLAY_EXCLUSIVE;
$options['dropLabel'] = true;
$currency2Country = array(
'USD' => 'US',
'CAD' => 'CA',
'AUD' => 'AU'
);
if(key_exists($toCurrency['currencycode'], $currency2Country)) {
$options['countryID'] = GetCountryIdByISO2($currency2Country[$toCurrency['currencycode']]);
/*
$GLOBALS['ISC_CLASS_LOG']->LogSystemDebug('php', "CountryISO {$currency2Country[$toCurrency['currencycode']]} CountryID : {$options['countryID']}" ,
"New Country set based on currency : {$toCurrency['currencycode']}");
*/
}
}
else {
/*
* Determine current country used for quote (if any)
* If in EU, use that as country we need.
* Defaults to GB otherwise
*/
$countryISO2 = 'GB';
if(isset($_SESSION['QUOTE'])) {
$iso2 = $_SESSION['QUOTE']->getBillingAddress()->getCountryIso2();
$query = "SELECT countrycouregid FROM [|PREFIX|]countries WHERE countryiso2 = '{$iso2}'";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if(!$result) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemDebug('php', "CountryISO Revert to GB or other EU country DB query failed", "SQL: ".$query);
}
else {
$row = $GLOBALS['ISC_CLASS_DB']->FetchOne($result);
if(count($row)>=1 && $row['countrycouregid'] == 1) {
$countryISO2 = $iso2;
}
}
}
$options['displayFormat'] = TAX_PRICES_DISPLAY_INCLUSIVE;
// Default back to UK to ensure pricing updates back to tax inclusive
$options['countryID'] = GetCountryIdByISO2($countryISO2);
}
return $options;
}
// MOD END