jerry1962 Posted June 20, 2011 Share Posted June 20, 2011 (edited) Hello folks i have a test site i use to get the code right, before adding to the main page. i have a fresh install of 2.3.1 and i get this mesg Fatal error: Cannot redeclare class language in /usr/local/4admin/apache/vhosts/xxxlatindivas.com/addon/3g4ginternet.com/includes/classes/language.php on line 16. i have delete the data base and reinstalled it twice but i still get this mesg any ideas? Thanks for your help im just trying to get a additional box to put some text in. Jerry P.S im using this download (29 Jan 2011) Edited June 20, 2011 by jerry1962 Quote Link to comment Share on other sites More sharing options...
KDM Posted June 20, 2011 Share Posted June 20, 2011 Hello folks i have a test site i use to get the code right, before adding to the main page. i have a fresh install of 2.3.1 and i get this mesg Fatal error: Cannot redeclare class language in /usr/local/4admin/apache/vhosts/xxxlatindivas.com/addon/3g4ginternet.com/includes/classes/language.php on line 16. i have delete the data base and reinstalled it twice but i still get this mesg any ideas? Thanks for your help im just trying to get a additional box to put some text in. Jerry P.S im using this download (29 Jan 2011) Check this: "Cannot redeclare ..." The definitive help Quote Link to comment Share on other sites More sharing options...
Boldman Posted June 4, 2016 Share Posted June 4, 2016 (edited) Hello. I followed that link and the code mentioned I put in the language.php but it din't find a second call "require" so it must be something else. This error comes up when use desktop/laptop when I choose payment by banktransfer and push the checkout button, the site goto checkout success and then I get this Cannot redeclare error. Few years back the the mini template system is installed and no problems.The Mobile addon 7.5.9 is installed and works but some customers cannot checkout, it returns back on the product page.Header Tags SEO V3.3.4 is installed. I'm not sure if the Mobile addon have influance on the desktop version. Any idee Edited June 4, 2016 by Boldman Quote Link to comment Share on other sites More sharing options...
♥kymation Posted June 5, 2016 Share Posted June 5, 2016 This error used to happen with installs of older versions of osCommerce. As far as I know, it is not caused by a second include of the language class, but instead it's a related error involving that class and certain server settings. I don't believe that anyone ever found the exact cause, but the problem went away with later updates to osCommerce. osCommerce 2.3.1 is pretty old now. There are several known security holes in that old software, as well as a lot of bugs like this one. I suggest that you upgrade to the latest Responsive version, which means you won't need the separate Mobile addon, and probably a bunch of other addons as well. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Boldman Posted June 11, 2016 Share Posted June 11, 2016 I ran Osc 2.3.3.4 but the problem is solved. In de language.php file I made the following changes First row change to : if (!class_exists('language')) {class language { var $languages, $catalog_languages, $browser_languages, $language; Then at the end of the file change to: for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) { reset($this->languages); while (list($key, $value) = each($this->languages)) { if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) { $this->language = $this->catalog_languages[$key]; break 2; class_exists.close(); } } } } } } ?> Quote Link to comment Share on other sites More sharing options...
yeno Posted June 18, 2016 Share Posted June 18, 2016 This error used to happen with installs of older versions of osCommerce. As far as I know, it is not caused by a second include of the language class, but instead it's a related error involving that class and certain server settings. I don't believe that anyone ever found the exact cause, but the problem went away with later updates to osCommerce. osCommerce 2.3.1 is pretty old now. There are several known security holes in that old software, as well as a lot of bugs like this one. I suggest that you upgrade to the latest Responsive version, which means you won't need the separate Mobile addon, and probably a bunch of other addons as well. Regards Jim I don't think this error is not caused by installs of older versions. I run @@gburton's Responsive-osCommerce 2.3.4 (master) and there is the same "banktransfer class" issue. Quote Link to comment Share on other sites More sharing options...
yeno Posted June 18, 2016 Share Posted June 18, 2016 Fatal error: Cannot redeclare class banktransfer in /path-to-your-dir/includes/modules/payment/banktransfer.php on line 13 The problem seems to be caused by the banktransfer module, the others work fine. This error has been included during the banktransfer module installation. @@Boldman's solution works in this case too: 1. before class banktransfer { add if (!class_exists('banktransfer')) { 2. before ?> in the end add } <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ if (!class_exists('banktransfer')) { // prevents "Cannot redeclare class banktransfer" issue class banktransfer { var $code, $title, $description, $enabled; // class constructor function banktransfer() { global $order; $this->code = 'banktransfer'; $this->title = MODULE_PAYMENT_BANKTRANSFER_TEXT_TITLE; $this->description = MODULE_PAYMENT_BANKTRANSFER_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_BANKTRANSFER_SORT_ORDER; $this->enabled = (( MODULE_PAYMENT_BANKTRANSFER_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_BANKTRANSFER_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_BANKTRANSFER_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->email_footer = MODULE_PAYMENT_BANKTRANSFER_TEXT_EMAIL_FOOTER; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_BANKTRANSFER_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_BANKTRANSFER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return array('title' => MODULE_PAYMENT_BANKTRANSFER_TEXT_DESCRIPTION); } function process_button() { return false; } function before_process() { return false; } function after_process() { return false; } function output_error() { return false; } function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_BANKTRANSFER_STATUS'"); $this->check = tep_db_num_rows($check_query); } return $this->check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Allow Bank Transfer Payment', 'MODULE_PAYMENT_BANKTRANSFER_STATUS', 'True', 'Do you want to accept Bank Transfer Order payments?', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Sort Code', 'MODULE_PAYMENT_BANKTRANSFER_SORTCODE', '00-00-00', 'Bank sort code in the format 00-00-00', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Account No.', 'MODULE_PAYMENT_BANKTRANSFER_ACCNUM', '12345678', 'Bank Account No.', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Account Name', 'MODULE_PAYMENT_BANKTRANSFER_ACCNAM', 'Fred Bloggs', 'Bank account name', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank Name', 'MODULE_PAYMENT_BANKTRANSFER_BANKNAM', 'The Bank', 'Bank Name', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_BANKTRANSFER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_BANKTRANSFER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('IBAN Number', 'MODULE_PAYMENT_BANKTRANSFER_IBAN', '00000000', 'IBAN number', '6', '1', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('SWIFT Number', 'MODULE_PAYMENT_BANKTRANSFER_SWIFT', '00000001', 'SWIFT number', '6', '1', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_BANKTRANSFER_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return $keys = array( 'MODULE_PAYMENT_BANKTRANSFER_STATUS', 'MODULE_PAYMENT_BANKTRANSFER_SORTCODE', 'MODULE_PAYMENT_BANKTRANSFER_ACCNUM', 'MODULE_PAYMENT_BANKTRANSFER_ACCNAM', 'MODULE_PAYMENT_BANKTRANSFER_BANKNAM', 'MODULE_PAYMENT_BANKTRANSFER_IBAN', 'MODULE_PAYMENT_BANKTRANSFER_SWIFT', 'MODULE_PAYMENT_BANKTRANSFER_SORT_ORDER', 'MODULE_PAYMENT_BANKTRANSFER_ZONE', 'MODULE_PAYMENT_BANKTRANSFER_ORDER_STATUS_ID'); } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.