Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

An error of type E_ERROR – Uncaught DivisionByZeroError

WCMp Core

Resolved
Viewing 23 reply threads
  • Author
    Posts
    • #187356
      Beats24-7
      Participant

      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()
      thrown

      Is 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!

    • #187415
      Beats24-7
      Participant

      Hello,
      any update please? Thanks

    • #187418

      Our team is looking into the matter .Please provide them some time.

    • #187426
      Beats24-7
      Participant

      Ok, thank you.

    • #187435

      @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.

    • #187441
      Beats24-7
      Participant

      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

    • #187442
      Beats24-7
      Participant

      I am still running WordPress 5.7.2 and WooCommerce Version 5.5.4, so there hasn’t been any update.

    • #187443
      Beats24-7
      Participant

      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!

    • #187492
      This reply has been marked as private.
    • #187532
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187529
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187580
      This reply has been marked as private.
    • #187593
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187594
      This reply has been marked as private.
    • #187600
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187602
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187649

      Hi, our team will check and get back to you.
      Kindly provide them some time.

    • #187651

      Hi, our team will check and get back to you.
      Kindly provide them some time.

    • #187664
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187693

      Sorry to inform you that we are still not able to connect through the ftp.

    • #187734
      Beats24-7
      Participant
      This reply has been marked as private.
    • #187742

      Hi,
      We have fixed this issue on your site.
      Please check.
      Thanks

    • #188920
      Beats24-7
      Participant

      Hi @Raju,
      yes, it’s working again. Thank you!

    • #188923
      This reply has been marked as private.
Viewing 23 reply threads

The topic ‘An error of type E_ERROR – Uncaught DivisionByZeroError’ is closed to new replies.