• Resolved albertaugustin

    (@albertaugustin)


    The calculation-feature is very good – thanks also for the option of formatting the numbers.
    It would be very nice if we could have the formatting that was entered in the fields that we could use the same formatting also in the emails!
    Is that possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @albertaugustin,

    By default, it should be using the same format that you have configured in the fields for the emails. Could you please share your form export so that we can check the existing settings to have a better idea of what might be causing it?

    Please check the following doc on how to export a form:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    If you are concerned about any sensitive information in the form, then you can duplicate your form, remove any sensitive information, and then export it.

    You can share the export file via Google Drive, Dropbox or any cloud services in the next reply.

    Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter albertaugustin

    (@albertaugustin)

    Thanks for your help again. Here you’ll have the configuration file: https://cloud.ja.do/s/xxicpmqrDKQqTgQ

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @albertaugustin

    Thank you for the form,

    I found it is related to a known issue that the fix is coming in Forminator 1.21

    Can you please try this as a temporary solution?

    <?php
    
    add_filter( 'forminator_custom_form_mail_admin_message', 'wpmudev_calc_field_sperator_fixes', 10, 5 );
    function wpmudev_calc_field_sperator_fixes( $message, $custom_form, $data, $entry, $cls ){
    	if( $custom_form->id != 361 ){
    		return $message;
    	}
    
    	if( strpos( $message, '{calc-1-seps}' ) !== false ) {
    		if( isset( $entry->meta_data['calculation-1'] ) ) {
    			if( isset( $entry->meta_data['calculation-1']['value']['formatting_result'] ) ) {
    				$GLOBALS['calc-1-seps'] = $entry->meta_data['calculation-1']['value']['formatting_result'];
    				$message = str_replace( '{calc-1-seps}', $entry->meta_data['calculation-1']['value']['formatting_result'], $message );
    			}
    		}
    	}
    
        if( strpos( $message, '{calc-2-seps}' ) !== false ) {
    		if( isset( $entry->meta_data['calculation-2'] ) ) {
    			if( isset( $entry->meta_data['calculation-2']['value']['formatting_result'] ) ) {
    				$GLOBALS['calc-2-seps'] = $entry->meta_data['calculation-2']['value']['formatting_result'];
    				$message = str_replace( '{calc-2-seps}', $entry->meta_data['calculation-2']['value']['formatting_result'], $message );
    			}
    		}
    	}
    
        if( strpos( $message, '{calc-3-seps}' ) !== false ) {
    		if( isset( $entry->meta_data['calculation-3'] ) ) {
    			if( isset( $entry->meta_data['calculation-3']['value']['formatting_result'] ) ) {
    				$GLOBALS['calc-3-seps'] = $entry->meta_data['calculation-3']['value']['formatting_result'];
    				$message = str_replace( '{calc-3-seps}', $entry->meta_data['calculation-3']['value']['formatting_result'], $message );
    			}
    		}
    	}
    
    	return $message;
    }
    
    add_filter( 'forminator_replace_form_data', 'wpmudev_calc_seps_fixing', 10, 3 );
    function wpmudev_calc_seps_fixing( $content, $data, $original_content ){
    	if( $data['form_id'] != 361 ){
    		return $content;
    	}
    	
    	if( strpos( $content, '{calc-1-seps}' ) !== false ){
    		if( $GLOBALS['calc-1-seps'] ) {
    			$content = str_replace( '{calc-1-seps}', $GLOBALS['calc-1-seps'] , $content );
    		}
    	}
    
        if( strpos( $content, '{calc-2-seps}' ) !== false ){
    		if( $GLOBALS['calc-2-seps'] ) {
    			$content = str_replace( '{calc-2-seps}', $GLOBALS['calc-2-seps'] , $content );
    		}
    	}
    
        if( strpos( $content, '{calc-3-seps}' ) !== false ){
    		if( $GLOBALS['calc-3-seps'] ) {
    			$content = str_replace( '{calc-3-seps}', $GLOBALS['calc-3-seps'] , $content );
    		}
    	}
    
    	return $content;
    }

    Replace the 361 to match your form ID, then add the code as mu-plugin:

    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    In your Form, replace the {calculation-NUMBER} to {calc-NUMBER-seps} ( replacing the number for each calc field )

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @albertaugustin ,

    We haven’t heard from you for a week 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 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Calculation formatting Email’ is closed to new replies.