/** * Check if a default currencies has been selected, * and if the selected currency really exists * @return boolean */ function checkDefaultCurrency() { $default_currencyid = Citruscart::getInstance()->get('default_currencyid', '-1'); if ($default_currencyid == '-1') { JError::raiseNotice('checkDefaultCurrency', JText::_('COM_CITRUSCART_NO_DEFAULT_CURRENCY_SELECTED')); // do not return false here to enable users to actually change the default currency return true; } else { Citruscart::load('CitruscartHelperCurrency', 'helpers.currency'); $currency_helper = new CitruscartHelperCurrency(); $currency = $currency_helper->load($default_currencyid); // Check if the currency exists if (empty($currency->currency_id)) { JError::raiseNotice('checkDefaultCurrency', JText::_('COM_CITRUSCART_CURRENCY_DOES_NOT_EXISTS')); // do not return false here to enable users to actually change the default currency return true; } } return true; }