WCMp Core
Tagged: divivsion by zero error, uncaught error
-
AuthorPosts
-
-
March 2, 2023 at 7:23 PM #187356Beats24-7Participant
Hi there,
I am still using WCMP in version 3.6.0 and I am not able to update it anytime soon. It was working fine for my needs until today I received this uncaught error. It appears when checking the vendor tab in reports:An error of type E_ERROR was caused in line 139 of the file /wp-content/plugins/dc-woocommerce-multi-vendor/classes/reports/class-wcmp-report-vendor.php. Error message: Uncaught DivisionByZeroError: Division by zero in /wp-content/plugins/dc-woocommerce-multi-vendor/classes/reports/class-wcmp-report-vendor.php:139
Stack trace:
#0 /wp-content/plugins/dc-woocommerce-multi-vendor/admin/class-wcmp-settings-reports.php(123): WCMp_Report_Vendor->output_report()
#1 /wp-content/plugins/dc-woocommerce-multi-vendor/admin/class-wcmp-settings-reports.php(99): WCMp_Settings_WCMp_Reports::wcmp_get_report()
#2 /wp-content/plugins/dc-woocommerce-multi-vendor/admin/class-wcmp-settings.php(879): WCMp_Settings_WCMp_Reports->settings_page_init()
#3 /wp-includes/class-wp-hook.php(292): WCMp_Settings->reports_tab_init()
#4 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
#5 /wp-includes/plugin.php(484): WP_Hook->do_action()
#6 /wp-content/plugins/dc-woocommerce-multi-vendor/admin/class-wcmp-settings.php(546): do_action()
#7 /wp-includes/class-wp-hook.php(292): WCMp_Settings->wcmp_reports()
#8 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
#9 /wp-includes/plugin.php(484): WP_Hook->do_action()
#10 /wp-admin/admin.php(259): do_action()
thrownIs this due to a php update? I didn’t do anything though but maybe my server got updated automatically. Still looks I’m on php 8.0 though. These should be the lines causing the error as it divides by 0.
foreach ($total_sales as $vendor_id => $report) {
$vendor = get_wcmp_vendor( $vendor_id );
$total_sales_width = ( $report[‘total_sales’] > 0 ) ? round($report[‘total_sales’]) / round($report[‘total_sales’]) * 100 : 0;
$admin_earning_width = ( $report[‘admin_earning’] > 0 ) ? ( $report[‘admin_earning’] / round($report[‘total_sales’]) ) * 100 : 0;
$vendor_earning_width = ( $report[‘vendor_earning’] > 0 ) ? ( $report[‘vendor_earning’] / round($report[‘total_sales’]) ) * 100 : 0;How can I fix this please? I also attached the file for you (had to zip it because I am not allowed to uplaod php files).
Please get back to me asap, thanks! -
March 3, 2023 at 6:28 PM #187415Beats24-7Participant
Hello,
any update please? Thanks -
March 3, 2023 at 7:17 PM #187418Sangita Support SquadKeymaster
Our team is looking into the matter .Please provide them some time.
-
March 3, 2023 at 8:41 PM #187426Beats24-7Participant
Ok, thank you.
-
March 3, 2023 at 9:49 PM #187435NerdySupportExpert MoumitaKeymaster
@Beats24-7, as this is related to WCMp, which is now no longer supported.
So please access the backup of your site when there was no error. Make sure not to update WooCommere, WordPress as WCMp is no longer compatible with the latest version of WordPress and WooCommerce.
-
March 3, 2023 at 10:38 PM #187441Beats24-7Participant
I didn’t perform any update and I turned off WooCommerce and WordPress updates. I don’t know why it’s not working anymore.
Please help me to fix it. It’s just 3 lines of code. What do I need to change in the php code to not get the division by zero error. This should be fairly easy to fix for you. Please let me know, thanks!$total_sales_width = ( $report[‘total_sales’] > 0 ) ? round($report[‘total_sales’]) / round($report[‘total_sales’]) * 100 : 0;
$admin_earning_width = ( $report[‘admin_earning’] > 0 ) ? ( $report[‘admin_earning’] / round($report[‘total_sales’]) ) * 100 : 0;
$vendor_earning_width = ( $report[‘vendor_earning’] > 0 ) ? ( $report[‘vendor_earning’] / round($report[‘total_sales’]) ) * 100 : 0 -
March 3, 2023 at 10:42 PM #187442Beats24-7Participant
I am still running WordPress 5.7.2 and WooCommerce Version 5.5.4, so there hasn’t been any update.
-
March 4, 2023 at 1:14 AM #187443Beats24-7Participant
I also contacted the support of my webhost and they confirmed that nothing has been updated. Unfortunately, they also weren’t able to help but advised that you should be able to help as debugging can only be done by the plugin team, as you have all the necessary tools and access to the plugin files.
The only thing that might have been changed on the server automatically is the sub version of php 8.0.xx to 8.0.28, but that’s not confirmed.
I am on version 3.6.0 of WCMp. Do you have any newer version where this issue might have been fixed, 3.7.x or 3.8.x maybe? Please let me know, thanks!
-
March 6, 2023 at 12:27 PM #187492NerdySupportExpert MoumitaKeymasterThis reply has been marked as private.
-
March 6, 2023 at 9:01 PM #187532Beats24-7ParticipantThis reply has been marked as private.
-
March 7, 2023 at 11:17 AM #187529Beats24-7ParticipantThis reply has been marked as private.
-
March 7, 2023 at 11:20 AM #187580NerdySupportExpert MoumitaKeymasterThis reply has been marked as private.
-
March 7, 2023 at 6:44 PM #187593Beats24-7ParticipantThis reply has been marked as private.
-
March 7, 2023 at 7:42 PM #187594Sangita Support SquadKeymasterThis reply has been marked as private.
-
March 7, 2023 at 8:24 PM #187600Beats24-7ParticipantThis reply has been marked as private.
-
March 7, 2023 at 8:31 PM #187602Beats24-7ParticipantThis reply has been marked as private.
-
March 8, 2023 at 1:05 PM #187649NerdySupportExpert MoumitaKeymaster
Hi, our team will check and get back to you.
Kindly provide them some time. -
March 8, 2023 at 1:05 PM #187651NerdySupportExpert MoumitaKeymaster
Hi, our team will check and get back to you.
Kindly provide them some time. -
March 8, 2023 at 8:31 PM #187664Beats24-7ParticipantThis reply has been marked as private.
-
March 9, 2023 at 12:03 PM #187693Sangita Support SquadKeymaster
Sorry to inform you that we are still not able to connect through the ftp.
-
March 10, 2023 at 2:03 AM #187734Beats24-7ParticipantThis reply has been marked as private.
-
March 10, 2023 at 11:09 AM #187742Raju The Cool GuyKeymaster
Hi,
We have fixed this issue on your site.
Please check.
Thanks -
March 10, 2023 at 10:51 PM #188920Beats24-7Participant
Hi @Raju,
yes, it’s working again. Thank you! -
March 10, 2023 at 10:58 PM #188923NerdySupportExpert MoumitaKeymasterThis reply has been marked as private.
-
-
AuthorPosts
The topic ‘An error of type E_ERROR – Uncaught DivisionByZeroError’ is closed to new replies.