Ejemplo n.º 1
0
 function cart_fields($get_fields_order, $key)
 {
     $order_field = '';
     $cf = new Rcl_Custom_Fields();
     foreach ((array) $get_fields_order as $custom_field) {
         $custom_field = apply_filters('custom_field_cart_form', $custom_field);
         if ($key == 'profile' && $custom_field['order'] != 1) {
             continue;
         }
         $slug = $custom_field['slug'];
         if ($custom_field['type'] == 'checkbox') {
             $chek = explode('#', $custom_field['field_select']);
             $count_field = count($chek);
             for ($a = 0; $a < $count_field; $a++) {
                 $number_field++;
                 $slug_chek = $slug . '_' . $a;
                 $this->values[$key][$number_field]['chek'] = $slug_chek;
             }
         } else {
             if ($custom_field['type'] == 'agree') {
                 $this->values[$key][$number_field]['chek'] = $slug;
             } else {
                 if ($custom_field['type'] == 'radio') {
                     $radio = explode('#', $custom_field['field_select']);
                     $count_field = count($radio);
                     for ($a = 0; $a < $count_field; $a++) {
                         $number_field++;
                         $slug_chek = $slug . '_' . $a;
                         $this->values[$key][$number_field]['radio']['name'] .= $slug;
                         $this->values[$key][$number_field]['radio']['id'] .= $slug_chek;
                     }
                 } else {
                     $this->values[$key][$number_field]['other'] = $slug;
                 }
             }
         }
         $requared = $custom_field['requared'] == 1 ? '<span class="required">*</span>' : '';
         $val = isset($custom_field['value']) ? $custom_field['value'] : '';
         $order_field .= '<tr>' . '<td><label>' . $cf->get_title($custom_field) . $requared . ':</label></td>' . '<td>' . $cf->get_input($custom_field, $val) . '</td>' . '</tr>';
         $number_field++;
     }
     return $order_field;
 }
Ejemplo n.º 2
0
function rcl_custom_fields_regform($field)
{
    $get_fields = get_option('custom_profile_field');
    if ($get_fields) {
        $get_fields = stripslashes_deep($get_fields);
        $cf = new Rcl_Custom_Fields();
        foreach ((array) $get_fields as $custom_field) {
            if ($custom_field['register'] != 1) {
                continue;
            }
            $custom_field = apply_filters('custom_field_regform', $custom_field);
            $class = isset($custom_field['class']) ? $custom_field['class'] : '';
            $id = isset($custom_field['id']) ? 'id=' . $custom_field['id'] : '';
            $attr = isset($custom_field['attr']) ? '' . $custom_field['attr'] : '';
            $field .= '<div class="form-block-rcl ' . $class . '" ' . $id . ' ' . $attr . '>';
            $star = $custom_field['requared'] == 1 ? ' <span class="required">*</span> ' : '';
            $field .= '<label>' . $cf->get_title($custom_field) . $star . '';
            if ($custom_field['type']) {
                $field .= ':';
            }
            $field .= '</label>';
            $field .= $cf->get_input($custom_field, $_POST[$custom_field['slug']]);
            $field .= '</div>';
        }
    }
    return $field;
}
Ejemplo n.º 3
0
 function detail_order($get_fields, $user_id = false)
 {
     $order_custom_field = '<p><b>IP-address:</b> ' . $this->get_ip() . '</p>';
     $cf = new Rcl_Custom_Fields();
     foreach ((array) $get_fields as $custom_field) {
         $slug = $custom_field['slug'];
         if ($user_id && $custom_field['order'] != 1) {
             continue;
         }
         if ($user_id) {
             $val = get_the_author_meta($slug, $user_id);
         }
         $val = $_POST[$slug];
         $order_custom_field .= $cf->get_field_value($custom_field, $val);
     }
     return $order_custom_field;
 }
Ejemplo n.º 4
0
function rmag_manage_orders()
{
    global $wpdb;
    echo '<h2>Управление заказами</h2>
			<div style="width:1050px">';
    //начало блока настроек профиля
    $n = 0;
    $s = 0;
    if ($_GET['remove-trash'] == 101 && wp_verify_nonce($_GET['_wpnonce'], 'delete-trash-rmag')) {
        $wpdb->query($wpdb->prepare("DELETE FROM " . RMAG_PREF . "orders_history WHERE order_status = '%d'", 6));
    }
    if ($_GET['order-id']) {
        global $order, $product;
        $order = rcl_get_order($_GET['order-id']);
        if ($_POST['submit_message']) {
            if ($_POST['email_author']) {
                $email_author = sanitize_email($_POST['email_author']);
            } else {
                $email_author = 'noreply@' . $_SERVER['HTTP_HOST'];
            }
            $user_email = get_the_author_meta('user_email', intval($_POST['address_message']));
            $result_mess = rcl_mail($user_email, sanitize_text_field($_POST['title_message']), force_balance_tags($_POST['text_message']));
        }
        $header_tb = array('№ п/п', 'Наименование товара', 'Цена', 'Количество', 'Сумма', 'Статус');
        echo '<h3>ID заказа: ' . $_GET['order_id'] . '</h3>' . '<table class="widefat">' . '<tr>';
        foreach ($header_tb as $h) {
            echo '<th>' . $h . '</th>';
        }
        echo '</tr>';
        foreach ($order->products as $product) {
            $n++;
            $user_login = get_the_author_meta('user_login', $product->user_id);
            echo '<tr>' . '<td>' . $n . '</td>' . '<td>' . get_the_title($product->product_id) . '</td>' . '<td>' . $product->product_price . '</td>' . '<td>' . $product->numberproduct . '</td>' . '<td>' . $product->product_price . '</td>' . '<td>' . rcl_get_status_name_order($product->order_status) . '</td>' . '</tr>';
        }
        echo '<tr>
			<td colspan="4">Сумма заказа</td>
			<td colspan="2">' . $order->order_price . '</td>
		</tr>
	</table>';
        $get_fields = get_option('custom_profile_field');
        $cf = new Rcl_Custom_Fields();
        foreach ((array) $get_fields as $custom_field) {
            $meta = get_the_author_meta($custom_field['slug'], $order->order_author);
            $show_custom_field .= $cf->get_field_value($custom_field, $meta);
        }
        $details_order = rcl_get_order_details($order->order_id);
        echo '<form><input type="button" value="Назад" onClick="history.back()"></form><div style="text-align:right;"><a href="' . admin_url('admin.php?page=manage-rmag') . '">Показать все заказы</a></div>
	<h3>Все заказы пользователя: <a href="' . admin_url('admin.php?page=manage-rmag&user='******'">' . $user_login . '</a></h3>
	<h3>Информация о пользователе:</h3><p><b>Имя</b>: ' . get_the_author_meta('display_name', $order->order_author) . '</p><p><b>Email</b>: ' . get_the_author_meta('user_email', $order->order_author) . '</p>' . $show_custom_field;
        if ($details_order) {
            echo '<h3>Детали заказа:</h3>' . $details_order;
        }
        if ($result_mess) {
            echo '<h3 style="color:green;">Сообщение было отправлено!</h3>';
        }
        echo '<style>.form_message input[type="text"], .form_message textarea{width:450px;padding:5px;}</style>
	<h3>Написать пользователю сообщение на почту ' . get_the_author_meta('user_email', $order->order_author) . '</h3>
	<form method="post" action="" class="form_message" >
	<p><b>Почта отправителя</b> (по-умолчанию "noreply@' . $_SERVER['HTTP_HOST'] . '")</p>
	<input type="text" name="email_author" value="' . sanitize_email($_POST['email_author']) . '">
	<p><b>Тема письма</b></p>
	<input type="text" name="title_message" value="' . sanitize_text_field($_POST['title_message']) . '">
	<p><b>Текст сообщения</b></p>';
        $textmail = "<p>Добрый день!</p>\n\t<p>Вы или кто то другой оформил заказ на сайте " . get_bloginfo('name') . "</p>\n\t<h3>Детали заказа:</h3>\n\t" . rcl_get_include_template('order.php', __FILE__) . "\n\t<p>Ваш заказ ожидает оплаты. Вы можете произвести оплату своего заказа любым из предложенных способ из своего личного кабинета или просто пополнив свой личный счет на сайте <a href='" . get_bloginfo('wpurl') . "'>" . get_bloginfo('wpurl') . "<p>\n\t____________________________________________________________________________\n\tЭто письмо было сформировано автоматически не надо отвечать на него";
        if ($_POST['text_message']) {
            $textmail = force_balance_tags($_POST['text_message']);
        }
        $args = array('wpautop' => 1, 'media_buttons' => 1, 'textarea_name' => 'text_message', 'textarea_rows' => 15, 'tabindex' => null, 'editor_css' => '', 'editor_class' => 'contentarea', 'teeny' => 0, 'dfw' => 0, 'tinymce' => 1, 'quicktags' => 1);
        wp_editor($textmail, 'textmessage', $args);
        echo '<input type="hidden" name="address_message" value="' . $order->order_author . '">
	<p><input type="submit" name="submit_message" value="Отправить"></p>
	</form>';
        echo $table;
    } else {
        global $order, $product;
        $all_pr = 0;
        list($year, $month, $day, $hour, $minute, $second) = preg_split('([^0-9])', current_time('mysql'));
        $args = array();
        if ($_POST['filter-date']) {
            if ($_POST['year']) {
                $args['year'] = $_POST['year'];
                if ($_POST['month']) {
                    $args['month'] = sanitize_text_field($_POST['month']);
                }
            }
            if ($_POST['status']) {
                $args['order_status'] = intval($_POST['status']);
            }
            $orders = rcl_get_orders($args);
        } else {
            if ($_GET['status']) {
                $args['order_status'] = intval($_GET['status']);
            } elseif ($_GET['user']) {
                $args['user_id'] = intval($_GET['user']);
            } elseif ($_GET['search_order']) {
                $args['order_id'] = intval($_GET['search_order']);
                $args['user_id'] = intval($_GET['search_order']);
                $args['search'] = true;
            } else {
                $args['status_not_in'] = 6;
                $args['year'] = $year;
                $args['month'] = $month;
                $_POST['year'] = $year;
                $_POST['month'] = $month;
            }
            //$where = apply_filters('string_where_get_orders',$where);
        }
        $orders = rcl_get_orders($args);
        if ($orders) {
            foreach ($orders as $rdr) {
                $n++;
                foreach ($rdr as $prods) {
                    $all_pr += $prods->product_price * $prods->numberproduct;
                }
            }
        }
        //if(!isset($_GET['status'])||$_GET['status']!=6)
        $table .= rcl_get_chart_orders($orders);
        $table .= '<h3>Всего заказов: ' . $n . ' на ' . $all_pr . ' рублей</h3>';
        $table .= '<form method="get" action="' . admin_url('admin.php?page=manage-rmag') . '"><p class="search-box">
	<label class="screen-reader-text" for="order-search-input">Поиск заказов:</label>
	<input type="search" id="order-search-input" name="search_order" placeholder="ID заказа или покупателя" value="">
	<input type="submit" id="search-submit" class="button" value="Поиск заказов">
        <input type="hidden" name="page" value="manage-rmag">
        </p></form>';
        $table .= '<form action="" method="post">';
        $table .= '<select name="status">';
        $table .= '<option value="">Все заказы</option>';
        for ($a = 1; $a <= 6; $a++) {
            $table .= '<option value="' . $a . '" ' . selected($a, $_POST['status'], false) . '>' . rcl_get_status_name_order($a) . '</option>';
        }
        $table .= '</select>';
        $table .= '<select name="month">';
        $months = array('За все месяцы', 'январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь');
        foreach ($months as $k => $month) {
            if ($k) {
                $k = zeroise($k, 2);
            }
            $table .= '<option value="' . $k . '" ' . selected($k, $_POST['month'], false) . '>' . $month . '</option>';
        }
        $table .= '</select>';
        $table .= '<select name="year">';
        for ($a = 2013; $a <= $year + 1; $a++) {
            $table .= '<option value="' . $a . '" ' . selected($a, $_POST['year'], false) . '>' . $a . '</option>';
        }
        $table .= '</select>';
        $table .= '<input type="submit" value="Фильтровать" name="filter-date" class="button-secondary">';
        if ($_GET['status'] == 6) {
            $table .= '<a href="' . wp_nonce_url(admin_url('admin.php?page=manage-rmag&remove-trash=101'), 'delete-trash-rmag') . '">Очистить корзину</a>';
        }
        $table .= '</form>';
        if (!$orders) {
            echo $table;
            exit;
        }
        $cols = array('Заказ ID', 'Пользователь', 'Сумма заказа', 'Дата и время', 'Статус', 'Смена статуса', 'Действие');
        $cols = apply_filters('header_table_orders_rcl', $cols);
        $table .= '<table class="widefat"><tr>';
        foreach ($cols as $col) {
            $table .= '<th>' . $col . '</th>';
        }
        $table .= '</tr>';
        foreach ($orders as $order_id => $order) {
            rcl_setup_orderdata($order);
            $radioform .= '<select id="status-' . $order_id . '" name="status-' . $order_id . '">';
            for ($a = 1; $a < 7; $a++) {
                $radioform .= '<option ' . selected($a, $order->order_status, false) . ' value="' . $a . '">' . rcl_get_status_name_order($a) . '</option>';
            }
            $radioform .= '</select>';
            if ($order->order_status == 6) {
                $delete = '<input type="button" class="button-primary delete-order" id="' . $order_id . '" value="Удалить">';
            }
            $button = '<input type="button" class="button-secondary select_status" id="' . $order_id . '" value="Изменить статус"> ' . $delete;
            $user_id = $order->order_author;
            $pagelink = admin_url('admin.php?page=manage-rmag');
            $cols_content = array('<a href="' . $pagelink . '&order-id=' . $order_id . '">Заказ ' . $order_id . '</a>', '<a href="' . $pagelink . '&user='******'">' . get_the_author_meta('user_login', $user_id) . '</a>', $order->order_price, $order->order_date, '<a href="' . $pagelink . '&status=' . $order->order_status . '"><span class="change-' . $order_id . '">' . rcl_get_status_name_order($order->order_status) . '</span></a>', $radioform, $button);
            $cols_content = apply_filters('content_table_orders_rcl', $cols_content, $user_id);
            $table .= '<tr id="row-' . $order_id . '">';
            foreach ($cols_content as $content) {
                $table .= '<td>' . $content . '</td>';
            }
            $table .= '</tr>';
            $radioform = '';
            $delete = '';
        }
        $cnt_cols = count($cols);
        if ($_GET['status'] != 6) {
            $table .= '<tr><td align="right" colspan="' . $cnt_cols . '"><a href="' . admin_url('admin.php?page=manage-rmag&status=6') . '">Перейти в корзину</a></td></tr>';
        }
        $table .= '</table>';
        echo $table;
        if ($_GET['user'] || $_GET['status'] || $_GET['date']) {
            echo '<form><input type="button" value="Назад" onClick="history.back()"></form><div style="text-align:right;"><a href="' . admin_url('admin.php?page=manage-rmag') . '">Показать текущие заказы</a></div>';
        }
    }
    echo '</div>';
    //конец блока заказов
}
Ejemplo n.º 5
0
function rcl_get_custom_fields_profile($user)
{
    $get_fields = get_option('custom_profile_field');
    $cf = new Rcl_Custom_Fields();
    if ($get_fields) {
        $field = '<h3>Произвольные поля профиля:</h3>
        <table class="form-table">';
        foreach ((array) $get_fields as $custom_field) {
            $slug = $custom_field['slug'];
            $meta = get_the_author_meta($slug, $user->ID);
            $field .= '<tr><th><label>' . $cf->get_title($custom_field) . ':</label></th>';
            $field .= '<td>' . $cf->get_input($custom_field, $meta) . '</td>';
            $field .= '</tr>';
        }
        $field .= '</table>';
        echo $field;
    }
}
Ejemplo n.º 6
0
function rcl_payment_order($order_id, $user_id = false)
{
    global $wpdb, $order, $rmag_options;
    $order = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "rmag_orders_history WHERE order_id='%d'", $order_id));
    rcl_setup_orderdata($order);
    if (!$user_id) {
        $user_id = $order->order_author;
    }
    rcl_remove_reserve($order_id);
    rcl_update_status_order($order_id, 2);
    //Если работает реферальная система и партнеру начисляются проценты с покупок его реферала
    if (function_exists('add_referall_incentive_order')) {
        add_referall_incentive_order($user_id, $order->order_price);
    }
    $get_fields = get_option('custom_profile_field');
    if ($get_fields) {
        $cf = new Rcl_Custom_Fields();
        foreach ((array) $get_fields as $custom_field) {
            $slug = $custom_field['slug'];
            $meta = get_the_author_meta($slug, $user_id);
            $show_custom_field .= $cf->get_field_value($custom_field, $meta);
        }
    }
    $table_order = rcl_get_include_template('order.php', __FILE__);
    $args = array('role' => 'administrator');
    $users = get_users($args);
    $subject = 'Заказ №' . $order->order_id . ' оплачен!';
    $admin_email = $rmag_options['admin_email_magazin_recall'];
    $text = '';
    $text = apply_filters('payment_mail_text', $text);
    //print_r($text);exit;
    $textmail = '
    <p>Пользователь оплатил заказ в магазине "' . get_bloginfo('name') . '".</p>
    <h3>Информация о пользователе:</h3>
    <p><b>Имя</b>: ' . get_the_author_meta('display_name', $user_id) . '</p>
    <p><b>Email</b>: ' . get_the_author_meta('user_email', $user_id) . '</p>
    ' . $show_custom_field . '
    <p>Заказ №' . $order_id . ' получил статус "Оплачено".</p>
    <h3>Детали заказа:</h3>
    ' . $table_order . '
	' . $text . '
    <p>Ссылка для управления заказом в админке:</p>
    <p>' . admin_url('admin.php?page=manage-rmag&order-id=' . $order_id) . '</p>';
    if ($admin_email) {
        rcl_mail($admin_email, $subject, $textmail);
    } else {
        foreach ((array) $users as $userdata) {
            $email = $userdata->user_email;
            rcl_mail($email, $subject, $textmail);
        }
    }
    $email = get_the_author_meta('user_email', $user_id);
    $textmail = '
    <p>Вы оплатили заказ в магазине "' . get_bloginfo('name') . '" средствами со своего личного счета.</p>
    <h3>Информация о покупателе:</h3>
    <p><b>Имя</b>: ' . get_the_author_meta('display_name', $user_id) . '</p>
    <p><b>Email</b>: ' . get_the_author_meta('user_email', $user_id) . '</p>
    ' . $show_custom_field . '
    <p>Заказ №' . $order_id . ' получил статус "Оплачено".</p>
    <h3>Детали заказа:</h3>
    ' . $table_order . '
	' . $text . '
    <p>Ваш заказ оплачен и поступил в обработку. Вы можете следить за сменой его статуса из своего личного кабинета</p>';
    rcl_mail($email, $subject, $textmail);
    do_action('payorder_user_count_rcl', $user_id, $order->order_price, 'Оплата заказа №' . $order_id, 1);
}
Ejemplo n.º 7
0
function rcl_get_list_custom_fields($post_id, $posttype = false, $id_form = false)
{
    $get_fields = rcl_get_custom_fields($post_id, $posttype, $id_form);
    if (!$get_fields) {
        return false;
    }
    $public_fields = '';
    $data = array('ID' => $post_id, 'post_type' => $posttype, 'form_id' => $id_form);
    $cf = new Rcl_Custom_Fields();
    foreach ((array) $get_fields as $key => $custom_field) {
        if ($key === 'options') {
            continue;
        }
        $custom_field = apply_filters('custom_field_public_form', $custom_field, $data);
        $star = $custom_field['requared'] == 1 ? ' <span class="required">*</span> ' : '';
        $postmeta = $post_id ? get_post_meta($post_id, $custom_field['slug'], 1) : '';
        $public_fields .= '<tr><th><label>' . $cf->get_title($custom_field) . $star . ':</label></th>';
        $public_fields .= '<td>' . $cf->get_input($custom_field, $postmeta) . '</td>';
        $public_fields .= '</tr>';
    }
    if (isset($public_fields)) {
        $public_fields = '<table>' . $public_fields . '</table>';
        return $public_fields;
    } else {
        return false;
    }
}
function rcl_get_postmeta($post_id)
{
    $post = get_post($post_id);
    switch ($post->post_type) {
        case 'post':
            $id_form = $post ? get_post_meta($post->ID, 'publicform-id', 1) : 1;
            $id_field = 'custom_public_fields_' . $id_form;
            break;
        case 'products':
            $id_field = 'custom_saleform_fields';
            break;
        default:
            $id_field = 'custom_fields_' . $post->post_type;
    }
    $get_fields = get_option($id_field);
    if (!$get_fields) {
        return false;
    }
    $show_custom_field = '';
    $cf = new Rcl_Custom_Fields();
    foreach ((array) $get_fields as $custom_field) {
        $slug = $custom_field['slug'];
        $value = get_post_meta($post_id, $slug, 1);
        $show_custom_field .= $cf->get_field_value($custom_field, $value);
    }
    return $show_custom_field;
}
function rcl_get_custom_post_meta($post_id)
{
    $get_fields = rcl_get_custom_fields($post_id);
    if ($get_fields) {
        $cf = new Rcl_Custom_Fields();
        foreach ((array) $get_fields as $custom_field) {
            $custom_field = apply_filters('rcl_custom_post_meta', $custom_field);
            if (!$custom_field) {
                continue;
            }
            $p_meta = get_post_meta($post_id, $custom_field['slug'], true);
            $show_custom_field .= $cf->get_field_value($custom_field, $p_meta);
        }
        return $show_custom_field;
    }
}
Ejemplo n.º 10
0
function rcl_register_user_order()
{
    global $rmag_options, $wpdb, $order, $rcl_options;
    $reg_user = $rmag_options['noreg_order'] ? false : true;
    $fio_new_user = sanitize_text_field($_POST['fio_new_user']);
    $email_new_user = sanitize_email($_POST['email_new_user']);
    include_once 'rcl_order.php';
    $ord = new Rcl_Order();
    $get_fields = get_option('custom_profile_field');
    $get_order_fields = get_option('custom_orders_field');
    $req_prof = $ord->chek_requared_fields($get_fields, 'profile');
    $req_order = $ord->chek_requared_fields($get_order_fields);
    if ($email_new_user && $req_prof && $req_order) {
        $res_email = email_exists($email_new_user);
        $res_login = username_exists($email_new_user);
        $correctemail = is_email($email_new_user);
        $valid = validate_username($email_new_user);
        if (!$reg_user && (!$correctemail || !$valid)) {
            if (!$valid || !$correctemail) {
                $log['int'] = 1;
                $log['recall'] = '<p style="text-align:center;color:red;">Вы ввели некорректный email!</p>';
                echo json_encode($res);
                exit;
            }
        }
        //var_dump($reg_user);exit;
        if ($reg_user && ($res_login || $res_email || !$correctemail || !$valid)) {
            if (!$valid || !$correctemail) {
                $log['int'] = 1;
                $log['recall'] .= '<p style="text-align:center;color:red;">Вы ввели некорректный email!</p>';
            }
            if ($res_login || $res_email) {
                $log['int'] = 1;
                $log['recall'] .= '<p style="text-align:center;color:red;">Этот email уже используется!<br>' . 'Если это ваш email, то авторизуйтесь и продолжите оформление заказа.</p>';
            }
        } else {
            $user_id = false;
            if (!$reg_user) {
                $user = get_user_by('email', $email_new_user);
                if ($user) {
                    $user_id = $user->ID;
                }
            }
            if (!$user_id) {
                $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
                $userdata = array('user_pass' => $random_password, 'user_login' => $email_new_user, 'user_email' => $email_new_user, 'display_name' => $fio_new_user);
                $user_id = rcl_insert_user($userdata);
            }
            if ($user_id) {
                if ($get_fields && $user_id) {
                    $cf = new Rcl_Custom_Fields();
                    $cf->register_user_metas($user_id);
                }
                //Сразу авторизуем пользователя
                if ($reg_user && !$rcl_options['confirm_register_recall']) {
                    $creds = array();
                    $creds['user_login'] = $email_new_user;
                    $creds['user_password'] = $random_password;
                    $creds['remember'] = true;
                    $user = wp_signon($creds, false);
                    $redirect_url = rcl_format_url(get_author_posts_url($user_id), 'orders');
                } else {
                    $redirect_url = false;
                }
                $order_id = $ord->get_order_id();
                $results = $ord->insert_order($order_id, $user_id);
                if (!$results) {
                    $log['int'] = 1;
                    $log['recall'] = '<p style="text-align:center;color:red;">Возникла ошибка, заказ не был создан!</p>';
                    echo json_encode($log);
                    exit;
                }
                $order_custom_field = $ord->insert_detail_order($get_order_fields);
                $order = rcl_get_order($order_id);
                $table_order = rcl_get_include_template('order.php', __FILE__);
                $ord->send_mail($order_custom_field, $table_order, $user_id, $creds);
                $notice = $rcl_options['confirm_register_recall'] == 1 ? '<p class=res_confirm style="color:orange;">Для отслеживания статуса заказа подтвердите указанный email!<br>' . 'Перейдите по ссылке в высланном письме.</p>' : '';
                if (!$order->order_price) {
                    //Если заказ бесплатный
                    $notice .= "<p class='res_confirm'>Ваш заказ был создан!<br />" . "Заказ содержал только бесплатные товары<br>" . "Заказу присвоен статус - \"Оплачено\"<br>" . "Заказ поступил в обработку. В своем личном кабинете вы можете узнать статус вашего заказа.</p>";
                    $log['recall'] = $notice;
                    $log['redirect'] = $redirect_url;
                    $log['int'] = 100;
                    echo json_encode($log);
                    exit;
                }
                if (function_exists('rcl_payform')) {
                    $type_order_payment = $rmag_options['type_order_payment'];
                    if ($type_order_payment == 1 || $type_order_payment == 2) {
                        $notice .= "<p class='res_confirm'>Ваш заказ был создан!<br />Заказу присвоен статус - \"Неоплачено\"<br />Вы можете оплатить его сейчас или из своего ЛК. Там же вы можете узнать статус вашего заказа.</p>";
                        if ($type_order_payment == 2) {
                            $notice .= "<p class='res_confirm'>Вы можете пополнить свой личный счет на сайте из своего личного кабинета и в будущем оплачивать свои заказы через него</p>";
                        }
                        if (!$rcl_options['confirm_register_recall']) {
                            $notice .= "<p align='center'><a href='" . $redirect_url . "'>Перейти в свой личный кабинет</a></p>";
                            $notice .= rcl_payform(array('id_pay' => $order_id, 'summ' => $order->order_price, 'user_id' => $user_id, 'type' => 2));
                        }
                        $log['recall'] = $notice;
                        $log['redirect'] = 0;
                        $log['int'] = 100;
                    } else {
                        $log['int'] = 100;
                        $log['redirect'] = $redirect_url;
                        $notice .= "<p class=res_confirm>Ваш заказ был создан!<br />Проверьте свою почту.</p>";
                        $log['recall'] = $notice;
                    }
                } else {
                    $log['int'] = 100;
                    $log['redirect'] = $redirect_url;
                    $notice .= '<p class=res_confirm>Ваш заказ был создан!<br />Проверьте свою почту.</p>';
                    $log['recall'] = $notice;
                }
            }
        }
    } else {
        $log['int'] = 1;
        $log['recall'] = '<p style="text-align:center;color:red;">Пожалуйста, заполните все обязательные поля!</p>';
    }
    echo json_encode($log);
    exit;
}