Jump to content


This topic is now archived and is closed to further replies.


X-Cart Multi Department send to 1 email!

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:



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']);

    $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')

        $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 (
        ) {
            $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;


    } 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')




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

Share this post

Link to post
Share on other sites

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