Обязательное поле "Номер телефона" вместо "Email" в версии 3

Правила раздела: faq.php?mode=okay
Модератор: Модераторы

Family Mall
Family Mall
Репутация: 0
Сообщения: 17
Зарегистрирован: 04.08.2017
С нами: 2 года 9 месяцев

Сообщение #1 Family Mall » 01.12.2019, 09:28

Добрый день. подскажите, как можно заменить обязательные для заполнения поля - убрать почту, поставить телефон в третей версии. Пытался сделать по аналогии с версией 2. Но не вижу таких же папок и файлов.

Artem-K
Artem-K
Репутация: 1
Сообщения: 17
Зарегистрирован: 03.08.2017
С нами: 2 года 9 месяцев

Сообщение #2 Artem-K » 08.12.2019, 19:09

Не нашли решения? А то тоже необходимо сделать номер телефона обязательным, а e-mail нет.

Elanlar
Elanlar
Репутация: 8
Сообщения: 44
Зарегистрирован: 16.04.2018
С нами: 2 года 1 месяц

Сообщение #3 Elanlar » 08.12.2019, 20:27

меняем всего два файла: cart.tpl
Спойлер
{* The cart page template *}

{* The page title *}
{$meta_title = $lang->cart_title scope=global}

{if $cart->purchases}
<div class="block">
<div class="block__header block__header--boxed block__header--border">
<h1 class="block__heading">
<span data-language="cart_header">{$lang->cart_header}</span>
</h1>
</div>

<div class="block__body">
<form id="captcha_id" method="post" name="cart" class="fn_validate_cart">
<div class="f_row flex-column flex-lg-row" data-sticky-container>
<div class="sticky f_col f_col-lg-6 f_col-xl-5">

{* The list of products in the cart *}
<div id="fn_purchases">
{include file='cart_purchases.tpl'}
</div>

</div>
<div class="sticky f_col f_col-lg-6 f_col-xl-7 flex-lg-first">
<div class="fn_cart_sticky block--boxed block--border d-flex justify-content-center" data-margin-top="75" data-sticky-for="1024" data-sticky-class="is-sticky">
<div class="">
<div class="h6" data-language="cart_title">{$lang->cart_title}</div>

<div class="block form form_cart form--boxed">
<div class="form__header">
{* The form heading *}
<div class="form__title">
{include file="svg.tpl" svgId="comment_icon"}
<span data-language="cart_form_header">{$lang->cart_form_header}</span>
</div>
</div>

<div class="form__body">
{* Form error messages *}
{if $error}
<div class="message_error">
{if $error == 'empty_name'}
<span data-language="form_enter_name">{$lang->form_enter_name}</span>
{/if}
{if $error == 'empty_email'}
<span data-language="form_enter_email">{$lang->form_enter_email}</span>
{/if}
{if $error == 'captcha'}
<span data-language="form_error_captcha">{$lang->form_error_captcha}</span>
{/if}
{if $error == 'empty_phone'}
<span data-language="form_enter_phone">{$lang->form_enter_phone}</span>
{/if}
</div>
{/if}
<div class="f_row">
{* User's name *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group ">
<input class="form__input form__placeholder--focus" name="name" type="text" value="{$name|escape}" data-language="form_name" >
<span class="form__placeholder">{$lang->form_name}*</span>
</div>
</div>

{* User's phone *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="phone" type="text" value="{$phone|escape}" data-language="form_phone" >
<span class="form__placeholder">{$lang->form_phone}*</span>
</div>
</div>

{* User's email *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="email" type="text" value="{$email|escape}" data-language="form_email" >
<span class="form__placeholder">{$lang->form_email}*</span>
</div>
</div>

{* User's address *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="address" type="text" value="{$address|escape}" data-language="form_address" >
<span class="form__placeholder">{$lang->form_address}</span>
</div>
</div>

{* User's message *}
<div class="f_col-xl-12">
<div class="form__group form__group--last">
<textarea class="form__textarea form__placeholder--focus" rows="3" name="comment" data-language="cart_order_comment">{$comment|escape}</textarea>
<span class="form__placeholder">{$lang->cart_order_comment}</span>
</div>
</div>
</div>
</div>
</div>

{* Delivery and Payment *}
<div id="fn_ajax_deliveries">
{include file='cart_deliveries.tpl'}
</div>

<div class="block form form_cart form--boxed">
<div class="form__footer">
{* Captcha *}
{if $settings->captcha_cart}
{if $settings->captcha_type == "v2"}
<div class="captcha">
<div id="recaptcha1"></div>
</div>
{elseif $settings->captcha_type == "default"}
{get_captcha var="captcha_cart"}
<div class="captcha">
<div class="secret_number">{$captcha_cart[0]|escape} + ? = {$captcha_cart[1]|escape}</div>
<div class="form__captcha">
<input class="form__input form__input_captcha form__placeholder--focus" type="text" name="captcha_code" value="" />
<span class="form__placeholder">{$lang->form_enter_captcha}*</span>
</div>
</div>
{/if}
{/if}

<input type="hidden" name="checkout" value="1">
{* Submit button *}
<button class="form__button button--blick g-recaptcha" type="submit" name="checkout" {if $settings->captcha_type == "invisible"}data-sitekey="{$settings->public_recaptcha_invisible}" data-badge='bottomleft' data-callback="onSubmit"{/if} value="{$lang->cart_checkout}">
<span data-language="cart_checkout">{$lang->cart_checkout}</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
{else}
<div class="block">
{* The page heading *}
<h1 class="h1"><span data-language="cart_header">{$lang->cart_header}</span></h1>

<p class="block padding" data-language="cart_empty">{$lang->cart_empty}</p>
</div>
{/if}

и scripts.tpl
Спойлер
<script>

okay.max_order_amount = {$settings->max_order_amount};

/*Сброс фильтра*/
{if $controller == 'ProductsController' || $controller == 'BrandController' || $controller == 'CategoryController'}
$(document).on('click', '.fn_filter_reset', function () {
var date = new Date(0);
document.cookie = "price_filter=; path=/; expires=" + date.toUTCString();
});
{/if}



/* Mobile menu */
$(function(){
var $main_nav = $('.fn_mobile_menu');
var $toggle = $('.fn_menu_switch');
var defaultData = {
maxWidth: false,
navClass: 'mobile_nav',
customToggle: $toggle,
levelTitles: true,
insertClose: -1,
labelBack: '{$lang->mobile_menu_prev|escape}',
labelClose: '{$lang->mobile_menu_close|escape}',
closeLevels: false
};
$main_nav.hcOffcanvasNav(defaultData);
});

/* Показать все в фильтрах по свойствам и в футере категории */
$( document ).on( 'click', '.fn_view_all', function(e) {
$(this).closest('.fn_view_content').toggleClass('opened');
$('.fn_view_all').not($(this)).html('{$lang->filter_view_show|escape}');
$('.fn_view_all').not($(this)).closest('.fn_view_content').removeClass('opened');
if ($(this).closest('.fn_view_content').hasClass('opened')) {
$(this).html('{$lang->filter_view_hide|escape}');
} else {
$(this).html('{$lang->filter_view_show|escape}');
}
return false;
});

/* Предзаказ */
okay.is_preorder = {$settings->is_preorder};

/* Ошибка при отправке комментария в посте */
{if $controller == 'BlogController' && $error}
/* Переход по якорю к форме */
$( window ).on( 'load', function() {
location.href = location.href + '#fn_blog_comment';
$( '#fn_blog_comment' ).trigger( 'submit' );
} );
{/if}

{* Обратный звонок, отправка формы *}
{if $call_sent}
$( function() {
$.fancybox.open( {
src: '#fn_callback_sent',
type : 'inline',
} );
} );
{elseif $call_error}
$(function() {
$.fancybox.open({
src: '#fn_callback',
type : 'inline'
});
});
{/if}

{* Карточка товара, ошибка в форме *}
{if $controller == 'ProductController' && $error}
$( window ).on( 'load', function() {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
} );
{* Карточка товара, отправка комментария *}
{elseif $controller == 'ProductController'}
$( window ).on( 'load', function() {
if( location.hash.search('comment') !=-1 ) {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
}
} );
{/if}

{if $subscribe_success}
$( function() {
$.fancybox.open( {
src: '#fn_subscribe_sent',
type : 'inline',
} );
} );
{elseif $subscribe_error}
$( window ).on( 'load', function() {
location.href = location.href + '#subscribe_error';
$.fancybox.open( {
src: '#subscribe_error',
type : 'inline',
} );
} );
{/if}

var form_enter_name = "{$lang->form_enter_name|escape}";
var form_enter_phone = "{$lang->form_enter_phone|escape}";
var form_error_captcha = "{$lang->form_error_captcha|escape}";
var form_enter_email = "{$lang->form_enter_email|escape}";
var form_enter_password = "{$lang->form_enter_password|escape}";
var form_enter_message = "{$lang->form_enter_message|escape}";

if($(".fn_validate_product").length>0) {
$(".fn_validate_product").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if($(".fn_validate_callback").length>0) {
$(".fn_validate_callback").validate({
rules: {
name: "required",
phone: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
captcha_code: form_error_captcha
}

});
}
if($(".fn_validate_subscribe").length>0) {
$(".fn_validate_subscribe").validate({
rules: {
subscribe_email: "required",
},
messages: {
subscribe_email: form_enter_email
}
});
}
if($(".fn_validate_post").length>0) {
$(".fn_validate_post").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_feedback").length>0) {
$(".fn_validate_feedback").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
message: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
message: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_cart").length>0) {
$(".fn_validate_cart").validate({
rules: {
name: "required",
phone: "required",
email: {
required: true,
email: true
},
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
email: form_enter_email,
captcha_code: form_error_captcha
}
});

var submitted_cart = false;
$('.fn_validate_cart').on('submit', function () {
if ($('.fn_validate_cart').valid() === true) {
if (submitted_cart === true) {
return false;
} else {
submitted_cart = true;
}
}
});
}

if($(".fn_validate_login").length>0) {
$(".fn_validate_login").validate({
rules: {
email: "required",
password: "required",
},
messages: {
email: form_enter_email,
password: form_enter_password
}
});
}

if($(".fn_validate_register").length>0) {
$(".fn_validate_register").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
password: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
captcha_code: form_error_captcha,
password: form_enter_password
}
});
}

{if $settings->sj_shares}
if($(".fn_share").length>0) {
{if $js_custom_socials}
{*Расширяем функционал кастомными соц. сетями*}
{foreach $js_custom_socials as $social=>$params}
jsSocials.shares.{$social|escape} = {$params|json_encode};
{/foreach}
{/if}
$(".fn_share").jsSocials({
showLabel: false,
showCount: false,
shares: {$settings->sj_shares|json_encode}
});
}
{/if}

</script>
Последний раз редактировалось Elanlar 08.12.2019, 23:38, всего редактировалось 1 раз.

Artem-K
Artem-K
Репутация: 1
Сообщения: 17
Зарегистрирован: 03.08.2017
С нами: 2 года 9 месяцев

Сообщение #4 Artem-K » 08.12.2019, 22:40

Elanlar писал(а):меняем всего два файла: cart.tpl
Спойлер
{* The cart page template *}

{* The page title *}
{$meta_title = $lang->cart_title scope=global}

{if $cart->purchases}
<div class="block">
<div class="block__header block__header--boxed block__header--border">
<h1 class="block__heading">
<span data-language="cart_header">{$lang->cart_header}</span>
</h1>
</div>

<div class="block__body">
<form id="captcha_id" method="post" name="cart" class="fn_validate_cart">
<div class="f_row flex-column flex-lg-row" data-sticky-container>
<div class="sticky f_col f_col-lg-6 f_col-xl-5">

{* The list of products in the cart *}
<div id="fn_purchases">
{include file='cart_purchases.tpl'}
</div>

</div>
<div class="sticky f_col f_col-lg-6 f_col-xl-7 flex-lg-first">
<div class="fn_cart_sticky block--boxed block--border d-flex justify-content-center" data-margin-top="75" data-sticky-for="1024" data-sticky-class="is-sticky">
<div class="">
<div class="h6" data-language="cart_title">{$lang->cart_title}</div>

<div class="block form form_cart form--boxed">
<div class="form__header">
{* The form heading *}
<div class="form__title">
{include file="svg.tpl" svgId="comment_icon"}
<span data-language="cart_form_header">{$lang->cart_form_header}</span>
</div>
</div>

<div class="form__body">
{* Form error messages *}
{if $error}
<div class="message_error">
{if $error == 'empty_name'}
<span data-language="form_enter_name">{$lang->form_enter_name}</span>
{/if}
{if $error == 'empty_phone'}
<span data-language="form_enter_phone">{$lang->form_enter_phone}</span>
{/if}
{if $error == 'captcha'}
<span data-language="form_error_captcha">{$lang->form_error_captcha}</span>
{/if}
{if $error == 'empty_phone'}
<span data-language="form_error_phone">{$lang->form_error_phone}</span>
{/if}
</div>
{/if}
<div class="f_row">
{* User's name *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group ">
<input class="form__input form__placeholder--focus" name="name" type="text" value="{$name|escape}" data-language="form_name" >
<span class="form__placeholder">{$lang->form_name}*</span>
</div>
</div>

{* User's phone *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="phone" type="text" value="{$phone|escape}" data-language="form_phone" >
<span class="form__placeholder">{$lang->form_phone}*</span>
</div>
</div>

{* User's email *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="email" type="text" value="{$email|escape}" data-language="form_email" >
<span class="form__placeholder">{$lang->form_email}</span>
</div>
</div>

{* User's address *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="address" type="text" value="{$address|escape}" data-language="form_address" >
<span class="form__placeholder">{$lang->form_address}</span>
</div>
</div>

{* User's message *}
<div class="f_col-xl-12">
<div class="form__group form__group--last">
<textarea class="form__textarea form__placeholder--focus" rows="3" name="comment" data-language="cart_order_comment">{$comment|escape}</textarea>
<span class="form__placeholder">{$lang->cart_order_comment}</span>
</div>
</div>
</div>
</div>
</div>

{* Delivery and Payment *}
<div id="fn_ajax_deliveries">
{include file='cart_deliveries.tpl'}
</div>

<div class="block form form_cart form--boxed">
<div class="form__footer">
{* Captcha *}
{if $settings->captcha_cart}
{if $settings->captcha_type == "v2"}
<div class="captcha">
<div id="recaptcha1"></div>
</div>
{elseif $settings->captcha_type == "default"}
{get_captcha var="captcha_cart"}
<div class="captcha">
<div class="secret_number">{$captcha_cart[0]|escape} + ? = {$captcha_cart[1]|escape}</div>
<div class="form__captcha">
<input class="form__input form__input_captcha form__placeholder--focus" type="text" name="captcha_code" value="" />
<span class="form__placeholder">{$lang->form_enter_captcha}*</span>
</div>
</div>
{/if}
{/if}

<input type="hidden" name="checkout" value="1">
{* Submit button *}
<button class="form__button button--blick g-recaptcha" type="submit" name="checkout" {if $settings->captcha_type == "invisible"}data-sitekey="{$settings->public_recaptcha_invisible}" data-badge='bottomleft' data-callback="onSubmit"{/if} value="{$lang->cart_checkout}">
<span data-language="cart_checkout">{$lang->cart_checkout}</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
{else}
<div class="block">
{* The page heading *}
<h1 class="h1"><span data-language="cart_header">{$lang->cart_header}</span></h1>

<p class="block padding" data-language="cart_empty">{$lang->cart_empty}</p>
</div>
{/if}

и scripts.tpl
Спойлер
<script>

okay.max_order_amount = {$settings->max_order_amount};

/*Сброс фильтра*/
{if $controller == 'ProductsController' || $controller == 'BrandController' || $controller == 'CategoryController'}
$(document).on('click', '.fn_filter_reset', function () {
var date = new Date(0);
document.cookie = "price_filter=; path=/; expires=" + date.toUTCString();
});
{/if}



/* Mobile menu */
$(function(){
var $main_nav = $('.fn_mobile_menu');
var $toggle = $('.fn_menu_switch');
var defaultData = {
maxWidth: false,
navClass: 'mobile_nav',
customToggle: $toggle,
levelTitles: true,
insertClose: -1,
labelBack: '{$lang->mobile_menu_prev|escape}',
labelClose: '{$lang->mobile_menu_close|escape}',
closeLevels: false
};
$main_nav.hcOffcanvasNav(defaultData);
});

/* Показать все в фильтрах по свойствам и в футере категории */
$( document ).on( 'click', '.fn_view_all', function(e) {
$(this).closest('.fn_view_content').toggleClass('opened');
$('.fn_view_all').not($(this)).html('{$lang->filter_view_show|escape}');
$('.fn_view_all').not($(this)).closest('.fn_view_content').removeClass('opened');
if ($(this).closest('.fn_view_content').hasClass('opened')) {
$(this).html('{$lang->filter_view_hide|escape}');
} else {
$(this).html('{$lang->filter_view_show|escape}');
}
return false;
});

/* Предзаказ */
okay.is_preorder = {$settings->is_preorder};

/* Ошибка при отправке комментария в посте */
{if $controller == 'BlogController' && $error}
/* Переход по якорю к форме */
$( window ).on( 'load', function() {
location.href = location.href + '#fn_blog_comment';
$( '#fn_blog_comment' ).trigger( 'submit' );
} );
{/if}

{* Обратный звонок, отправка формы *}
{if $call_sent}
$( function() {
$.fancybox.open( {
src: '#fn_callback_sent',
type : 'inline',
} );
} );
{elseif $call_error}
$(function() {
$.fancybox.open({
src: '#fn_callback',
type : 'inline'
});
});
{/if}

{* Карточка товара, ошибка в форме *}
{if $controller == 'ProductController' && $error}
$( window ).on( 'load', function() {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
} );
{* Карточка товара, отправка комментария *}
{elseif $controller == 'ProductController'}
$( window ).on( 'load', function() {
if( location.hash.search('comment') !=-1 ) {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
}
} );
{/if}

{if $subscribe_success}
$( function() {
$.fancybox.open( {
src: '#fn_subscribe_sent',
type : 'inline',
} );
} );
{elseif $subscribe_error}
$( window ).on( 'load', function() {
location.href = location.href + '#subscribe_error';
$.fancybox.open( {
src: '#subscribe_error',
type : 'inline',
} );
} );
{/if}

var form_enter_name = "{$lang->form_enter_name|escape}";
var form_enter_phone = "{$lang->form_enter_phone|escape}";
var form_error_captcha = "{$lang->form_error_captcha|escape}";
var form_enter_email = "{$lang->form_enter_email|escape}";
var form_enter_password = "{$lang->form_enter_password|escape}";
var form_enter_message = "{$lang->form_enter_message|escape}";

if($(".fn_validate_product").length>0) {
$(".fn_validate_product").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if($(".fn_validate_callback").length>0) {
$(".fn_validate_callback").validate({
rules: {
name: "required",
phone: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
captcha_code: form_error_captcha
}

});
}
if($(".fn_validate_subscribe").length>0) {
$(".fn_validate_subscribe").validate({
rules: {
subscribe_email: "required",
},
messages: {
subscribe_email: form_enter_email
}
});
}
if($(".fn_validate_post").length>0) {
$(".fn_validate_post").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_feedback").length>0) {
$(".fn_validate_feedback").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
message: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
message: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_cart").length>0) {
$(".fn_validate_cart").validate({
rules: {
name: "required",
phone: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
captcha_code: form_error_captcha
}
});

var submitted_cart = false;
$('.fn_validate_cart').on('submit', function () {
if ($('.fn_validate_cart').valid() === true) {
if (submitted_cart === true) {
return false;
} else {
submitted_cart = true;
}
}
});
}

if($(".fn_validate_login").length>0) {
$(".fn_validate_login").validate({
rules: {
email: "required",
password: "required",
},
messages: {
email: form_enter_email,
password: form_enter_password
}
});
}

if($(".fn_validate_register").length>0) {
$(".fn_validate_register").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
password: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
captcha_code: form_error_captcha,
password: form_enter_password
}
});
}

{if $settings->sj_shares}
if($(".fn_share").length>0) {
{if $js_custom_socials}
{*Расширяем функционал кастомными соц. сетями*}
{foreach $js_custom_socials as $social=>$params}
jsSocials.shares.{$social|escape} = {$params|json_encode};
{/foreach}
{/if}
$(".fn_share").jsSocials({
showLabel: false,
showCount: false,
shares: {$settings->sj_shares|json_encode}
});
}
{/if}

</script>
Огромное спасибо! Всё работает!

Добавлено спустя 4 минуты 32 секунды:
Artem-K писал(а):
Elanlar писал(а):меняем всего два файла: cart.tpl
Спойлер
{* The cart page template *}

{* The page title *}
{$meta_title = $lang->cart_title scope=global}

{if $cart->purchases}
<div class="block">
<div class="block__header block__header--boxed block__header--border">
<h1 class="block__heading">
<span data-language="cart_header">{$lang->cart_header}</span>
</h1>
</div>

<div class="block__body">
<form id="captcha_id" method="post" name="cart" class="fn_validate_cart">
<div class="f_row flex-column flex-lg-row" data-sticky-container>
<div class="sticky f_col f_col-lg-6 f_col-xl-5">

{* The list of products in the cart *}
<div id="fn_purchases">
{include file='cart_purchases.tpl'}
</div>

</div>
<div class="sticky f_col f_col-lg-6 f_col-xl-7 flex-lg-first">
<div class="fn_cart_sticky block--boxed block--border d-flex justify-content-center" data-margin-top="75" data-sticky-for="1024" data-sticky-class="is-sticky">
<div class="">
<div class="h6" data-language="cart_title">{$lang->cart_title}</div>

<div class="block form form_cart form--boxed">
<div class="form__header">
{* The form heading *}
<div class="form__title">
{include file="svg.tpl" svgId="comment_icon"}
<span data-language="cart_form_header">{$lang->cart_form_header}</span>
</div>
</div>

<div class="form__body">
{* Form error messages *}
{if $error}
<div class="message_error">
{if $error == 'empty_name'}
<span data-language="form_enter_name">{$lang->form_enter_name}</span>
{/if}
{if $error == 'empty_phone'}
<span data-language="form_enter_phone">{$lang->form_enter_phone}</span>
{/if}
{if $error == 'captcha'}
<span data-language="form_error_captcha">{$lang->form_error_captcha}</span>
{/if}
{if $error == 'empty_phone'}
<span data-language="form_error_phone">{$lang->form_error_phone}</span>
{/if}
</div>
{/if}
<div class="f_row">
{* User's name *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group ">
<input class="form__input form__placeholder--focus" name="name" type="text" value="{$name|escape}" data-language="form_name" >
<span class="form__placeholder">{$lang->form_name}*</span>
</div>
</div>

{* User's phone *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="phone" type="text" value="{$phone|escape}" data-language="form_phone" >
<span class="form__placeholder">{$lang->form_phone}*</span>
</div>
</div>

{* User's email *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="email" type="text" value="{$email|escape}" data-language="form_email" >
<span class="form__placeholder">{$lang->form_email}</span>
</div>
</div>

{* User's address *}
<div class="f_col-md-6 f_col-lg-12 f_col-xl-6">
<div class="form__group">
<input class="form__input form__placeholder--focus" name="address" type="text" value="{$address|escape}" data-language="form_address" >
<span class="form__placeholder">{$lang->form_address}</span>
</div>
</div>

{* User's message *}
<div class="f_col-xl-12">
<div class="form__group form__group--last">
<textarea class="form__textarea form__placeholder--focus" rows="3" name="comment" data-language="cart_order_comment">{$comment|escape}</textarea>
<span class="form__placeholder">{$lang->cart_order_comment}</span>
</div>
</div>
</div>
</div>
</div>

{* Delivery and Payment *}
<div id="fn_ajax_deliveries">
{include file='cart_deliveries.tpl'}
</div>

<div class="block form form_cart form--boxed">
<div class="form__footer">
{* Captcha *}
{if $settings->captcha_cart}
{if $settings->captcha_type == "v2"}
<div class="captcha">
<div id="recaptcha1"></div>
</div>
{elseif $settings->captcha_type == "default"}
{get_captcha var="captcha_cart"}
<div class="captcha">
<div class="secret_number">{$captcha_cart[0]|escape} + ? = {$captcha_cart[1]|escape}</div>
<div class="form__captcha">
<input class="form__input form__input_captcha form__placeholder--focus" type="text" name="captcha_code" value="" />
<span class="form__placeholder">{$lang->form_enter_captcha}*</span>
</div>
</div>
{/if}
{/if}

<input type="hidden" name="checkout" value="1">
{* Submit button *}
<button class="form__button button--blick g-recaptcha" type="submit" name="checkout" {if $settings->captcha_type == "invisible"}data-sitekey="{$settings->public_recaptcha_invisible}" data-badge='bottomleft' data-callback="onSubmit"{/if} value="{$lang->cart_checkout}">
<span data-language="cart_checkout">{$lang->cart_checkout}</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
{else}
<div class="block">
{* The page heading *}
<h1 class="h1"><span data-language="cart_header">{$lang->cart_header}</span></h1>

<p class="block padding" data-language="cart_empty">{$lang->cart_empty}</p>
</div>
{/if}

и scripts.tpl
Спойлер
<script>

okay.max_order_amount = {$settings->max_order_amount};

/*Сброс фильтра*/
{if $controller == 'ProductsController' || $controller == 'BrandController' || $controller == 'CategoryController'}
$(document).on('click', '.fn_filter_reset', function () {
var date = new Date(0);
document.cookie = "price_filter=; path=/; expires=" + date.toUTCString();
});
{/if}



/* Mobile menu */
$(function(){
var $main_nav = $('.fn_mobile_menu');
var $toggle = $('.fn_menu_switch');
var defaultData = {
maxWidth: false,
navClass: 'mobile_nav',
customToggle: $toggle,
levelTitles: true,
insertClose: -1,
labelBack: '{$lang->mobile_menu_prev|escape}',
labelClose: '{$lang->mobile_menu_close|escape}',
closeLevels: false
};
$main_nav.hcOffcanvasNav(defaultData);
});

/* Показать все в фильтрах по свойствам и в футере категории */
$( document ).on( 'click', '.fn_view_all', function(e) {
$(this).closest('.fn_view_content').toggleClass('opened');
$('.fn_view_all').not($(this)).html('{$lang->filter_view_show|escape}');
$('.fn_view_all').not($(this)).closest('.fn_view_content').removeClass('opened');
if ($(this).closest('.fn_view_content').hasClass('opened')) {
$(this).html('{$lang->filter_view_hide|escape}');
} else {
$(this).html('{$lang->filter_view_show|escape}');
}
return false;
});

/* Предзаказ */
okay.is_preorder = {$settings->is_preorder};

/* Ошибка при отправке комментария в посте */
{if $controller == 'BlogController' && $error}
/* Переход по якорю к форме */
$( window ).on( 'load', function() {
location.href = location.href + '#fn_blog_comment';
$( '#fn_blog_comment' ).trigger( 'submit' );
} );
{/if}

{* Обратный звонок, отправка формы *}
{if $call_sent}
$( function() {
$.fancybox.open( {
src: '#fn_callback_sent',
type : 'inline',
} );
} );
{elseif $call_error}
$(function() {
$.fancybox.open({
src: '#fn_callback',
type : 'inline'
});
});
{/if}

{* Карточка товара, ошибка в форме *}
{if $controller == 'ProductController' && $error}
$( window ).on( 'load', function() {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
} );
{* Карточка товара, отправка комментария *}
{elseif $controller == 'ProductController'}
$( window ).on( 'load', function() {
if( location.hash.search('comment') !=-1 ) {
$( '.tab_navigation a' ).removeClass( 'selected' );
$( '.tab' ).hide();
$( 'a[href="#comments"]' ).addClass( 'selected' );
$( '#comments').show();
}
} );
{/if}

{if $subscribe_success}
$( function() {
$.fancybox.open( {
src: '#fn_subscribe_sent',
type : 'inline',
} );
} );
{elseif $subscribe_error}
$( window ).on( 'load', function() {
location.href = location.href + '#subscribe_error';
$.fancybox.open( {
src: '#subscribe_error',
type : 'inline',
} );
} );
{/if}

var form_enter_name = "{$lang->form_enter_name|escape}";
var form_enter_phone = "{$lang->form_enter_phone|escape}";
var form_error_captcha = "{$lang->form_error_captcha|escape}";
var form_enter_email = "{$lang->form_enter_email|escape}";
var form_enter_password = "{$lang->form_enter_password|escape}";
var form_enter_message = "{$lang->form_enter_message|escape}";

if($(".fn_validate_product").length>0) {
$(".fn_validate_product").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if($(".fn_validate_callback").length>0) {
$(".fn_validate_callback").validate({
rules: {
name: "required",
phone: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
captcha_code: form_error_captcha
}

});
}
if($(".fn_validate_subscribe").length>0) {
$(".fn_validate_subscribe").validate({
rules: {
subscribe_email: "required",
},
messages: {
subscribe_email: form_enter_email
}
});
}
if($(".fn_validate_post").length>0) {
$(".fn_validate_post").validate({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_feedback").length>0) {
$(".fn_validate_feedback").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
message: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
message: form_enter_message,
captcha_code: form_error_captcha
}
});
}

if($(".fn_validate_cart").length>0) {
$(".fn_validate_cart").validate({
rules: {
name: "required",
phone: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
captcha_code: form_error_captcha
}
});

var submitted_cart = false;
$('.fn_validate_cart').on('submit', function () {
if ($('.fn_validate_cart').valid() === true) {
if (submitted_cart === true) {
return false;
} else {
submitted_cart = true;
}
}
});
}

if($(".fn_validate_login").length>0) {
$(".fn_validate_login").validate({
rules: {
email: "required",
password: "required",
},
messages: {
email: form_enter_email,
password: form_enter_password
}
});
}

if($(".fn_validate_register").length>0) {
$(".fn_validate_register").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
password: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
captcha_code: form_error_captcha,
password: form_enter_password
}
});
}

{if $settings->sj_shares}
if($(".fn_share").length>0) {
{if $js_custom_socials}
{*Расширяем функционал кастомными соц. сетями*}
{foreach $js_custom_socials as $social=>$params}
jsSocials.shares.{$social|escape} = {$params|json_encode};
{/foreach}
{/if}
$(".fn_share").jsSocials({
showLabel: false,
showCount: false,
shares: {$settings->sj_shares|json_encode}
});
}
{/if}

</script>
Огромное спасибо! Всё работает!
А нет, не работает, выдаёт ошибку(( Какую ошибку не знаю, просто красный прямоугольник.

Elanlar
Elanlar
Репутация: 8
Сообщения: 44
Зарегистрирован: 16.04.2018
С нами: 2 года 1 месяц

Сообщение #5 Elanlar » 08.12.2019, 22:46

красный прямоугольник из-за того что поле e-mail пустое. По этому Я поменял и сделал e-mail тоже обязательным. Сейчас проверяйте, должен работать

Artem-K
Artem-K
Репутация: 1
Сообщения: 17
Зарегистрирован: 03.08.2017
С нами: 2 года 9 месяцев

Сообщение #6 Artem-K » 09.12.2019, 20:32

Elanlar писал(а):красный прямоугольник из-за того что поле e-mail пустое. По этому Я поменял и сделал e-mail тоже обязательным. Сейчас проверяйте, должен работать
Всё работает! Подскажите, пожалуйста, как сделать чтобы обязательным полем было "номер телефона" и "Имя"? Если конечно Вас не затруднит.

Elanlar
Elanlar
Репутация: 8
Сообщения: 44
Зарегистрирован: 16.04.2018
С нами: 2 года 1 месяц

Сообщение #7 Elanlar » 09.12.2019, 21:05

можно это сделать. но при этом е-маил уведомления не отправится заказчику.

Artem-K
Artem-K
Репутация: 1
Сообщения: 17
Зарегистрирован: 03.08.2017
С нами: 2 года 9 месяцев

Сообщение #8 Artem-K » 10.12.2019, 11:44

Elanlar писал(а):можно это сделать. но при этом е-маил уведомления не отправится заказчику.
ничего страшного)

Elanlar
Elanlar
Репутация: 8
Сообщения: 44
Зарегистрирован: 16.04.2018
С нами: 2 года 1 месяц

Сообщение #9 Elanlar » 10.12.2019, 19:52

отправил в личку

impulze101
impulze101
Репутация: 0
Сообщения: 10
Зарегистрирован: 15.05.2018
С нами: 2 года

Сообщение #10 impulze101 » 16.12.2019, 20:49

Elanlar писал(а):отправил в личку
И мне пришлите, пожалуйста! :-)

dimtry0487
dimtry0487
Репутация: 0
Сообщения: 5
Зарегистрирован: 20.02.2020
С нами: 3 месяца 9 дней

Сообщение #11 dimtry0487 » 30.03.2020, 12:38

Elanlar, можете и мне отправить пожалуйста?


Название раздела: Вопросы по работе с OkayCMS
Правила раздела: faq.php?mode=okay

Быстрый ответ


Введите код в точности так, как вы его видите. Регистр символов не имеет значения.
Код подтверждения

   

Вернуться в «Вопросы по работе с OkayCMS»

Кто сейчас на форуме (по активности за 5 минут)

Сейчас этот раздел просматривают: 1 гость