Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makfruit/d8f469f7a12633e954dd949c65358f89 to your computer and use it in GitHub Desktop.
Save makfruit/d8f469f7a12633e954dd949c65358f89 to your computer and use it in GitHub Desktop.
// Выбор даты самовывоза, несколько пунктов самовывоза
ec.order.extra_fields.ecwid_pickup_time = {
'key': 'ecwid_pickup_time', // Ключ поля в базе.
'title': '_msg_schedule_pickup_time',
'required': true,
'type': 'date',
'checkout_display_section': 'pickup_customer_info',
'datepicker_options': {
'limit_maximum_date_interval_days': 14,
'show_time': true, // Показывать ли селектор времени
'increment_time_by': 30, // Интервалы времени в минутах, т.е. будет 12:30, 13:00, 13:30... . По умолчанию 30.
'use_24_hour_format': true // Использовать ли формат 24 или 12 am/pm. По умолчанию false (12).
}
'overrides': [
{
'conditions': [
'shipping_method': 'Самовывоз с ул.Ленина'
],
'fieldsToOverride': {
'datepicker_options': {
'limit_minimum_date_hours': 2, // Время готовки заказа минимум 2 часа, так что запрещаем 2 часа от текущего момента. По умолчанию 0.
// Business hours
'limit_available_dates_weekly': {
MON: [
['08:30', '13:30'],
['14:00', '17:30']
],
TUE: [
['14:00', '17:30']
]
},
// Запретить конкретные даты/часы
'disallow_dates': [
// Ограничить same-day pickup после 3PM
['2017-04-25 15:00:00', '2017-04-25 23:59:59'],
// Кастомные даты (какой-то интервал уже забукан другим покупателем)
['2017-04-26 08:30', '2017-04-26 10:00']
]
}
}
},
{
'conditions': [
'shipping_method': 'Самовывоз с ул.Гончарова'
],
'fieldsToOverride': {
'datepicker_options': {
'limit_minimum_date_hours': 2, // Время готовки заказа минимум 2 часа, так что запрещаем 2 часа от текущего момента. По умолчанию 0.
// Business hours
'limit_available_dates_weekly': {
SAT: [
['08:30', '13:30'],
['14:00', '17:30']
],
SUN: [
['14:00', '17:30']
]
}
}
}
},
{
'conditions': [
'shipping_method': 'Самовывоз с ул.Красноармейской'
],
'fieldsToOverride': {
'available': false
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment