Jump to content

X-Cart Multi Department send to 1 email!


makenoiz

Recommended Posts

I am using x-cart 4.4.3. The default contact us form allows the viewer to choose from several departments to send the mail form to  however, the x-cart developers have decided that it is a "feature" that all emails from the form, regardless of which department is chosen on the form, go to One email address that is defined in the settings.  Its really ridiculous however I cannot seem to  modify it.

 

If anyone has time, Id love some assistance on making the work "right".

 

Here is one part of the code that Im sure is integral in making the modification:

 

include/help.php

if ($REQUEST_METHOD == 'POST' && $action == 'contactus') {

    // Send mail to support

    $body = $_POST['body'] = stripslashes($_POST['body']);

    $contact = $_POST;

    $contact['titleid'] = func_detect_title($contact['title']);

    x_session_register('antibot_contactus_err');
    $antibot_contactus_err = (!empty($active_modules['Image_Verification']) && func_validate_image("on_contact_us", $antibot_input_str));

    // For email as login option, replace username with email
    if ($default_fields['username']['avail'] == 'Y' && $config['email_as_login'] == 'Y') {
        $contact['username'] = $contact['email'];
    }

    //Fill values for func_check_required_fields/emails templates
    if (is_array($additional_fields)) {
        $contact['additional_fields'] = array();
        foreach ($additional_fields as $k => $v) 
            $additional_fields[$k]['value'] = $contact['additional_fields'][$k]['value'] = stripslashes($contact['additional_values'][$k]);
    }


    // Check required fields
    $fillerror = !func_check_required_fields($contact, $current_area, 'contact_us');

    // Check email
    if (
        (
            $default_fields['email']['required'] == 'Y'
            || !empty($contact['email'])
        )
        && !func_check_email($contact['email'])
    ) {
        $fillerror = true;
    }

    // Check subject and body
    if (!$fillerror) {
        $fillerror = (empty($subject) || empty($body));
    }

    if (!$fillerror && !$antibot_contactus_err) {

        $contact['b_statename'] = func_get_state(stripslashes($contact['b_state']), stripslashes($contact['b_country']));
        $contact['b_countryname'] = func_get_country(stripslashes($contact['b_country']));

        if ($config['General']['use_counties'] == 'Y')
            $contact['b_countyname'] = func_get_county($contact['b_county']);

        $contact = func_stripslashes($contact);

        if (!empty($active_modules['SnS_connector']) && $current_area == 'C')
            func_generate_sns_action('FillContactForm');

        $mail_smarty->assign('contact', $contact);
        $mail_smarty->assign('default_fields', $default_fields);
        $mail_smarty->assign('is_areas', $is_areas);
        $mail_smarty->assign('additional_fields', $additional_fields);

        if (
            !func_send_mail(
                $config['Company']['support_department'],
                'mail/help_contactus_subj.tpl',
                'mail/help_contactus.tpl',
                $contact['email'],
                false
            )
        ) {
            $top_message = array(
                'type'         => 'E',
                'content'     => func_get_langvar_by_name("lbl_send_mail_error")
            );

            $userinfo = $_POST;
            $userinfo['login'] = $userinfo['uname'];
            $store_contactus = $userinfo;

        } else {

            $store_contactus = false;
            func_header_location("help.php?section=contactus&mode=sent");

        }

    } else {

        $userinfo                          = func_stripslashes($_POST);
        $userinfo['login']                 = $userinfo['uname'];
        $userinfo['fillerror']             = $fillerror;
        $userinfo['antibot_contactus_err'] = $antibot_contactus_err;

        $store_contactus = $userinfo;

        $top_message = array(
            'type'    => 'E',
            'content' => func_get_langvar_by_name($fillerror ? 'txt_registration_error' : 'msg_err_antibot')
        );

    }

    func_header_location("help.php?section=contactus&mode=update&err=1");
}

 

My site is not live yet or I would post the URL, however you can look at the x-cart demo: http://xcart-demo.qtmsoft.com/demo/help.php?section=contactus&mode=update

 

Here is the thread confirming that all departs go to the same address: http://forum.x-cart.com/showthread.php?t=9520&page=2

 

Any help would be greatly appreciated

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.