diff --git a/_build/data/transport.settings.php b/_build/data/transport.settings.php index 00c2789fd..a078d28db 100644 --- a/_build/data/transport.settings.php +++ b/_build/data/transport.settings.php @@ -193,6 +193,11 @@ 'area' => 'ms2_cart', ], + 'ms2_order_format_phone' => [ + 'value' => '/[^-+()0-9]/u', + 'xtype' => 'textfield', + 'area' => 'ms2_order', + ], 'ms2_order_format_num' => [ 'value' => '%y%m', 'xtype' => 'textfield', diff --git a/core/components/minishop2/handlers/msorderhandler.class.php b/core/components/minishop2/handlers/msorderhandler.class.php index f53b68a97..b5b0efa83 100644 --- a/core/components/minishop2/handlers/msorderhandler.class.php +++ b/core/components/minishop2/handlers/msorderhandler.class.php @@ -142,7 +142,7 @@ public function validate($key, $value) } break; case 'phone': - $value = preg_replace('/[^-+()0-9]/u', '', $value); + $value = $this->modx->getOption('ms2_order_format_phone', null, '/[^-+()0-9]/u'); break; case 'delivery': /** @var msDelivery $delivery */ diff --git a/core/components/minishop2/lexicon/ru/setting.inc.php b/core/components/minishop2/lexicon/ru/setting.inc.php index df8ef905c..5e0376456 100644 --- a/core/components/minishop2/lexicon/ru/setting.inc.php +++ b/core/components/minishop2/lexicon/ru/setting.inc.php @@ -78,6 +78,8 @@ $_lang['setting_ms2_notify_js_class_path_desc'] = 'Путь указывается относительно папки assets/components/minishop2/js/web/modules'; $_lang['setting_ms2_order_address_fields'] = 'Поля адреса доставки'; $_lang['setting_ms2_order_address_fields_desc'] = 'Список полей доставки, которые будут показаны на третьей вкладке карточки заказа. Доступны: "receiver,phone,email,index,country,region,city,metro,street,building,entrance,floor,room,comment,text_address". Если параметр пуст, вкладка будет скрыта.'; +$_lang['setting_ms2_order_format_phone'] = 'Формат валидации телефона'; +$_lang['setting_ms2_order_format_phone_desc'] = 'Формат валидации телефона. Используется в функции preg_replace'; $_lang['setting_ms2_order_format_num'] = 'Формат нумерации заказа'; $_lang['setting_ms2_order_format_num_desc'] = 'Формат нумерации заказа. Доступные значения в формате PHP strftime()'; $_lang['setting_ms2_order_format_num_separator'] = 'Разделитель для нумерации заказа';