kep@ Posted February 22, 2022 Share Posted February 22, 2022 PHP Fatal error: Cannot declare class currencies_mod, because the name is already in use in /home/public_html/includes/modules/bootstrap/bt_price_display.php on line 63 How to solve this problem? bt_price_display.php st_tax_below_price.php Link to comment Share on other sites More sharing options...
Hotclutch Posted February 22, 2022 Share Posted February 22, 2022 Replace line 23 function bt_price_display() { with function __construct() { Link to comment Share on other sites More sharing options...
kep@ Posted February 22, 2022 Author Share Posted February 22, 2022 When I replace it I still get the same error PHP Fatal error: Cannot declare class currencies_mod, because the name is already in use in /home/public_html/includes/modules/bootstrap/bt_price_display.php on line 63 HTTP ERROR 500 Link to comment Share on other sites More sharing options...
Hotclutch Posted February 22, 2022 Share Posted February 22, 2022 Check the first few lines of your includes/classes/currencies.php class currencies { var $currencies; // class constructor function __construct() { Link to comment Share on other sites More sharing options...
kep@ Posted February 22, 2022 Author Share Posted February 22, 2022 I already have that // class constructor function __construct() { $this->currencies = array(); $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from 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' => (int)$currencies['decimal_places'], 'value' => $currencies['value']); } } Link to comment Share on other sites More sharing options...
Hotclutch Posted February 22, 2022 Share Posted February 22, 2022 I am out of ideas then, I am not familiar with this addon / module. Link to comment Share on other sites More sharing options...
kep@ Posted February 22, 2022 Author Share Posted February 22, 2022 Thanks for trying Link to comment Share on other sites More sharing options...
Jack_mcs Posted February 22, 2022 Share Posted February 22, 2022 @kep@In the bt_price file try changing this line if (class_exists('currencies')) { to if (class_exists('currencies') && ! class_exists('currencies_mod')) { That may get rid of the error but the code may fail if that class exists for some other purpose. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
kep@ Posted February 23, 2022 Author Share Posted February 23, 2022 Problem is that st_tax_below_price.php also calls class mod_currencies st_tax_below_price.php Link to comment Share on other sites More sharing options...
kep@ Posted February 23, 2022 Author Share Posted February 23, 2022 5 hours ago, Jack_mcs said: @kep@In the bt_price file try changing this line if (class_exists('currencies')) { to if (class_exists('currencies') && ! class_exists('currencies_mod')) { That may get rid of the error but the code may fail if that class exists for some other purpose. After this change, it shows the prices that should be available only to registered users. Link to comment Share on other sites More sharing options...
Jack_mcs Posted February 23, 2022 Share Posted February 23, 2022 9 hours ago, kep@ said: Problem is that st_tax_below_price.php also calls class mod_currencies You can make the same change in that file. 9 hours ago, kep@ said: After this change, it shows the prices that should be available only to registered users. I don't know if this means it is working or not but, if not, it is probably because the existing currencies_mod class doesn't have the needed function. You can rename all occurrences of currencies_mod in those two files to something unique and that should allow it to work as designed. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
kep@ Posted February 23, 2022 Author Share Posted February 23, 2022 When I change the class name from currencies_mod to for example mod_currencies then I don't have a problem with error 500 but it doesn't show me the tax. And what this module should do Link to comment Share on other sites More sharing options...
Jack_mcs Posted February 23, 2022 Share Posted February 23, 2022 If you haven't done so, be sure to also change the line with "new currencies_mod" to the changed name. Other than that I can only suggest you contact the person that wrote the code. Since it isn't an addon I have installed I can't check why it is failing. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
kep@ Posted February 23, 2022 Author Share Posted February 23, 2022 If I had changed. I tried to contact the author. Link to comment Share on other sites More sharing options...
♥clustersolutions Posted March 24, 2022 Share Posted March 24, 2022 On 2/23/2022 at 7:03 AM, kep@ said: When I change the class name from currencies_mod to for example mod_currencies then I don't have a problem with error 500 but it doesn't show me the tax. And what this module should do Geez, it is a wild wild west. The tax below price module used the same technique and class name to extend the currencies class to display tax. Ya, pick either module, do a search and replace of all the "currencies_mod" to "currencies_mod_copy" should fix ur problem. I recall these module files were self-contained within the module's directory. Do a uninstall and install of that module afterward to activate the change. I suggest to use something like Sublime text editor to do the search and replace...unless PHPStorm is available to you...good luck! Yeah, you can't redeclare a class name. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.