Php Fatal Error: Cannot Redeclare _Fn_Get_Orders_Taxes_Subtotal()

Hi,

We are using "MV 4.7.3"; When vendor tries to add "Option Combinations" he gets the following error.
Any Help please?

PHP Fatal error: Cannot redeclare _fn_get_orders_taxes_subtotal() (previously declared in xxxx/public_html/app/functions/fn.control.php(697) : eval()'d code:329) in xxxx/public_html/app/functions/fn.control.php(697) : eval()'d code on line 358

Looks like someone modified core files. fn.control.php file does not contain such a function out of the box

Looks like someone modified core files. fn.control.php file does not contain such a function out of the box

Thanks eComLab for the reply ..

I have checked the "File Change Detector" in no such file has been changed .. I am not sure but we have updated the cs-cart couple days ago ..

Note that there is no function named "_fn_get_orders_taxes_subtotal" in standard cs-cart but there is a "fn_get_orders_taxes_subtotal" declared within the backend/index.php controller It is used for calculating statistic info on the admin home page. If you're getting a "re-declaration" then something is loading fn_control.php twice and I can assure you it is not standard cs-cart code.

So my guess is that someone added that function to fn.control.php (not the right place either) and changed the name by adding an underscore to the name. They are then using it as a variable modifier in a smarty template. There are several things wrong with this approach. Suggest you either contact your developer who made the changes and have them correct it or work with a developer who is more familiar with cs-cart and will utilize best-practices so that upgrading will not impact your customizations.

Thanks eComLab for the reply ..

I have checked the "File Change Detector" in no such file has been changed .. I am not sure but we have updated the cs-cart couple days ago ..

Download distributive from CS-Cart website and compare fn.control.php files. I am sure that the files will be different

Anyway, you should address this issue to your developer

Many thanks Tony and eComLab for your kind support.

@Tony:

Note that there is no function named "_fn_get_orders_taxes_subtotal" in standard cs-cart but there is a "fn_get_orders_taxes_subtotal" declared within the backend/index.php controller It is used for calculating statistic info on the admin home page. If you're getting a "re-declaration" then something is loading fn_control.php twice and I can assure you it is not standard cs-cart code.

So my guess is that someone added that function to fn.control.php (not the right place either) and changed the name by adding an underscore to the name. They are then using it as a variable modifier in a smarty template. There are several things wrong with this approach. Suggest you either contact your developer who made the changes and have them correct it or work with a developer who is more familiar with cs-cart and will utilize best-practices so that upgrading will not impact your customizations.

I tried to track the issue; I searched for both (fn_get_orders_taxes_subtotal) and (_fn_get_orders_taxes_subtotal) in (fn_control.php) but I could not find any of them .. and I am not sure why fn_control.php is called ..

We do not give any access to our live website for any developer and we do all of the changes in a test website .. The only new thing we did recently is updating the CS-Cart ..

Download distributive from CS-Cart website and compare fn.control.php files. I am sure that the files will be different

Anyway, you should address this issue to your developer

Thanks for the advise; I did what you advised and the I only found ONE difference:

And the strange point here is that the error happen only with vendors when they try to add "Option Combination"


        

Try to find fn_run_controller function in the app/functions/fn.control.php file and add

fn_print_r($check_included, $path);

after

$code = fn_get_contents($path);

Then reproduce the error and provide us with the debug information

Looks like some controller is called 3 times

Try to find fn_run_controller function in the app/functions/fn.control.php file and add

fn_print_r($check_included, $path);

after

$code = fn_get_contents($path);

Then reproduce the error and provide us with the debug information

Looks like some controller is called 3 times

Many thanks .. I will do that and revert to you ..