• Resolved mtempel

    (@mtempel)


    Hey, I ran into a problem when including a contact form with CRM.

    I created a form with Contact Form 7 (later with Ninja Forms) and I don’t get any contacts in my CRM. Instead, I receive the usual email the form creates.

    When I doublechecked the settings in WP ERP -> Settings -> Contact Forms, I see that the mapping is not saved. I set all fields, click “Save changes” and see the green checkmark. But when I refresh the page, it is gone.

    https://prnt.sc/qok2wb

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello @mtempel

    We are really sorry for the inconvenience. Yes, it was an issue somehow which we have fixed already and pinned to ship with the next release.

    However, you can implement the fixes on your site right away if you do not want to wait until the next release.

    Just open the file: /modules/crm/includes/contact-forms/class-erp-settings-contact-forms.php

    And replace the else block from line number 54-66 with the code below:

    $settings = get_option( 'wperp_crm_contact_forms' );
                    $settings[ sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ][ sanitize_text_field( wp_unslash( $_POST['formId'] ) ) ] = [
                        'map'           => array_map( 'sanitize_text_field', wp_unslash( $_POST['map'] ) ),
                        'contact_group' => isset( $_POST['contactGroup'] ) ?
                            sanitize_text_field( wp_unslash( $_POST['contactGroup'] ) ) : '',
                        'contact_owner' => isset( $_POST['contactOwner'] ) ?
                            sanitize_text_field( wp_unslash( $_POST['contactOwner'] ) ) : ''
                    ];
                    update_option( 'wperp_crm_contact_forms', $settings );
                    $response = [
                        'success' => true,
                        'msg' => __( 'Settings saved successfully', 'erp' )
                    ];

    Code replace reference: https://prnt.sc/qov9px

    I hope this helps ??

    Thread Starter mtempel

    (@mtempel)

    Yes, it worked! The lines to change are 354-368, but after that, the settings are saved. ??

    So if I got this right, it should work like this: A customer visits my site, fills out the form and after sending, it creates a new company in CRM. But it doesn’t happen.
    I receive an email with the data the customer entered, but I don’t see anything in CRM. ??

    Great! Glad that it worked ??

    It’ll save under the contacts, not in the company.

    Thanks

    Thread Starter mtempel

    (@mtempel)

    I’m afraid not:

    https://prnt.sc/qoxpj8

    Can you please share a screenshot of how you mapped the fields?

    Please note: If you map the full name with the name field, then it needs to write a complete name with the First and Last name. Otherwise, it won’t be saved.

    In case people fill only first or last name, then map with the first name only. Ref: https://prnt.sc/qp1hy2

    Thanks

    Thread Starter mtempel

    (@mtempel)

    Oh ok, I mapped it like this.:

    https://prnt.sc/qp1ydm

    I changed it so that first and last name are now seperate. What it does is it’s creating a company but no contact:

    https://prnt.sc/qp1z16

    So do I have to refresh the page by myself to see new leads? I also received an email as notification. Is that it or does my installation/browser block something?

    Mapping seems okay so far. Though it should not save under the company anyway. Would you please consider contact our support center for further investigation? Maybe there is something else happening on your site which needs to be sorted out.

    Thanks

    Hi,

    I have the same problem but can you tell me which code because the lines you say are not the same at my code.

    Check my code:
    /**
    * Initializes the class
    *
    * Checks for an existing instance
    * and if it doesn’t find one, creates it.
    */
    public static function init() {
    static $instance = false;

    if ( ! $instance ) {
    $instance = new self();
    }

    return $instance;
    }

    /**
    * Include required CSS and JS
    *
    * @return void
    */
    public function admin_scripts() {
    $crm_contact_forms_settings = [
    ‘nonce’ => wp_create_nonce( ‘erp_settings_contact_forms’ ),
    ‘plugins’ => array_keys( $this->active_plugin_list ),
    ‘forms’ => $this->forms,
    ‘mappedData’ => get_option( ‘wperp_crm_contact_forms’, ” ),
    ‘crmOptions’ => $this->crm_options,
    ‘scriptDebug’ => defined( ‘SCRIPT_DEBUG’ ) ? SCRIPT_DEBUG : false,
    ‘contactGroups’ => erp_crm_get_contact_groups_list(),
    ‘contactOwners’ => erp_crm_get_crm_user_dropdown(),
    ‘i18n’ => [
    ‘notMapped’ => __( ‘Not Set’, ‘erp’ ),
    ‘labelOK’ => __( ‘OK’, ‘erp’ ),
    ‘labelContactGroups’ => __( ‘Contact Group’, ‘erp’ ),
    ‘labelSelectGroup’ => __( ‘Select Contact Group’, ‘erp’ ),
    ‘labelContactOwner’ => __( ‘Contact Owner’, ‘erp’ ),
    ‘labelSelectOwner’ => __( ‘Select Owner’, ‘erp’ ),
    ],
    ];

    wp_enqueue_style( ‘erp-sweetalert’ );
    wp_enqueue_script( ‘erp-sweetalert’ );
    wp_enqueue_script( ‘erp-vuejs’ );
    wp_enqueue_script( ‘erp-settings-contact-forms’, WPERP_CRM_ASSETS . ‘/js/erp-settings-contact-forms.js’, [ ‘erp-vuejs’, ‘jquery’, ‘erp-sweetalert’ ], WPERP_VERSION, true );
    wp_localize_script( ‘erp-settings-contact-forms’, ‘crmContactFormsSettings’, $crm_contact_forms_settings );
    }

    Please help me. Thanks

    Thread Starter mtempel

    (@mtempel)

    The lines to change are 354-368 in this file:

    /modules/crm/includes/contact-forms/class-erp-settings-contact-forms.php

    If you change only lines 354-366, there is a ]; too much and the plugin throws up an error. At least it did for me.

    Thread Starter mtempel

    (@mtempel)

    @thebengalboy Thanks for your help so far. ?? I contacted support. Have an nice weekend.

    Hello @100mdc2019

    We’ll release a new update very soon. So, you can skip modifying the codes to avoid an unexpected error.

    @mtempel Yes, I’m also observing your email. You’ll get a solution soon ??

    Thanks all

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Contact form mapping’ is closed to new replies.