• Resolved mlchrt

    (@mlchrt)


    Hi there,
    i was wondering why calculation fields are reduced down to one digit in custom made notification mails. So is the setting set to two decimals in the calculation field settings but when referring to the calculation in the mail via {calculation-22} it just displays 230.0 instead of 230.00. Any ideas why?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @mlchrt

    I hope you are doing good today.

    Please export your form, upload it to google drive or dropbox and share a link in your next reply so that we could take a closer loo at this.

    Kind Regards,
    Kris

    Thread Starter mlchrt

    (@mlchrt)

    Hi there,
    i’m currently not able to provide an export. Any clues why this could happen? The calculation fields look fine in the form but are missing one decimal in the e-mail export.
    Thanks and kind regards

    Thread Starter mlchrt

    (@mlchrt)

    Hi there,
    i did some testruns with a demo form and the now got two mistakes regarding the decimals.

    See my demo form here: https://pastebin.com/4mcNaqUA (PW: 3yri10HEDp)

    First I see all decimals normal in the {all_fields} export, but if I address one seperatly it just shows the first decimal nevertheless what the settings are. Now if I also change the formating of the decimals (in all form fields), calculations will not work if I include a calculation field inanother calculation field todo a calculation. If I turn back to the original formatting this works again.

    I would be happy to get the decimal problem fixed first because this is really limiting when dealing with money calculations.

    75.50$ is currently when addressing it seperatly with {calculation-1} just 75.5$ which is quite a bummer.

    Here is the format of the e-mail template:

    You have a new website form submission:
    {all_fields}
    
    // Here are all decimals shown
    
    {calculation-1}?
    
    // Here are the decimals not shown
    
    {calculation-2}
    
    //This calculation is not working

    Do you got any ideas?

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @mlchrt,

    I’m afraid, I’m not able to replicate this when tested with the latest version of Forminator. From checking the form export, it seems like you are testing on Forminator v 1.17.2.

    Could you please update to the latest version and check whether it works fine? Or are you still able to replicate with the latest version 1.18.1?

    Please do advise, so that we could check further if needed. Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter mlchrt

    (@mlchrt)

    Hi Nithin,
    the update didn’t fix the missing decimal. The e-mail I receive from the form above is:

    You have a new website form submission:
    
    Number
    10
    Calculations
    10.505,00
    Calculations
    106.100,50
    // Here are all decimals shown
    
     
    
    10505 
    
    // Here are the decimals not shown
    
    106100.5
    
    // Here are the decimals not shown too
    ---
    

    Any ideas why the “0” is missing in 106100.5 and why the formating is not applied as in the {all-fields}?

    Thanks!

    • This reply was modified 2 years, 6 months ago by mlchrt.
    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @mlchrt,

    I was able to replicate the issue at my end.

    I have now escalated this as a confirmed bug, and a fix for this will be released as soon as possible. However, I cannot provide an ETA on this at the moment.

    Kind Regards,
    Nebu John

    Thread Starter mlchrt

    (@mlchrt)

    Hi there,
    thanks for confirming the bug. Is there any known workaround for this kind of bug?

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @mlchrt,

    I am sorry, but a workaround for this bug is not available at the moment. I have pinged our developers to see if a quick workaround could be provided. We will update you here once we have feedback on this as soon as possible.

    Kind Regards,
    Nebu John

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mlchrt

    Thanks for response!

    Please try this code instead of all the fixes that you’ve tried so far:

    
    <?php 
    add_filter( 'forminator_prepared_data', 'wpmudev_fix_calculation_notifications', 10, 2 );
    function wpmudev_fix_calculation_notifications( $prepared_data, $module_object ) {
    	if ( $prepared_data['form_id'] != 3474 ) {
    		return $prepared_data;
    	}
    
    	$custom_form = Forminator_Form_Model::model()->load( $prepared_data['form_id'] );
    
    	foreach ( $prepared_data as $key => $value ) {
    		if ( false !== strpos( $key, 'calculation' ) ) {
    			$calc_field = $custom_form->get_field( $key, true );
    			$prepared_data[$key] = Forminator_Field::forminator_number_formatting( $calc_field, $prepared_data[ $key ] );
    		}
    	}
    
    	return $prepared_data;
    }

    To add it to the site:

    – create an empty file with a .php extension (e.g. “formiantor-round-zero-fix.php”)
    – copy and paste above code into it
    – in this line

    if ( $prepared_data['form_id'] != 3474 ) {

    replace number 3474 with an ID of your form (same number as you can see in form’s shortcode)

    – save the file and upload it (using FTP, cPanel’s “File Manager” or similar way) to the “/wp-content/mu-plugins” folder of your site’s WordPress install

    Once it’s there, test the form to see if it solves the issue.

    Best regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mlchrt ,

    We haven’t heard from you for some time now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Numbers rounded to one digit in confirmation mail’ is closed to new replies.