Убираем выбор Страны и Области и оставляем только Город.
Скрипт скрывает или показывает поле ввода адрес в зависимости от способа доставки и передает в заказ id Страны и Области
<script type="text/javascript">
jQuery(function($) {
// Функция создания label
$('.row:has("*[required]") .caption').append( $('<span></span>', {class: 'label-required', text: 'Обязательное поле'}) );
// Функция включения/отключения submit
$('#shop_country_location_city_id').on('change', function() {
if($(this).val().indexOf('...') != 1) $('input:submit', this.form).attr('disabled', false);
else $('input:submit', this.form).attr('disabled', true);
}).customAutocomplete({
STRinput: '<input class="autocomplete-input" required="required" type="text" />'
}).hide();
$(document).ajaxSuccess(function() { $('#shop_country_location_city_id').customAutocomplete(); });
$.loadLocations('/shop/cart/', 256);
$.loadCities('/shop/cart/', 932);
$('#_cart input[name*="quantity_"]').on('input',function(){
if( $(this).val() != '' && $(this).val() > 0)
{
setTimeout($.proxy(function() {
$.recount_cart('/shop/cart/', $(this).attr('id'), $(this).val())
}, this), 500);
}
});
});
(function($){
// Функции без создания коллекции
$.extend({
loadCityAreas: function(path, shop_country_location_city_id)
{
if(shop_country_location_city_id=='') shop_country_location_city_id = 0;
$.clientRequest({path: path + '?load_delivery=' + shop_country_location_city_id , 'callBack': $.addIntoCartCallback, context: $('#Shop_Deliveries')});
},
recount_cart: function(path, shop_item, count)
{
$.clientRequest({path: path + '?ajax_recount=' + shop_item + '&count=' + count, 'callBack': $.addIntoCartCallback, context: $('#_cart')});
},
ajax_delete: function(path, shop_item)
{
$.clientRequest({path: path + '?ajax_delete=' + shop_item, 'callBack': $.addIntoCartCallback, context: $('#_cart')});
return false;
},
});
})(jQuery);
</script>
Блок ввода адреса и скрытые поля с id Страны и Области
<div class="comment shop_address">
<input type="hidden" name="shop_country_id" value="256">
<input type="hidden" name="shop_country_location_id" value="932">
<div class="row">
<div class="caption">Имя:<span class="label-required">Обязательное поле</span></div>
<div class="field">
<input required="required" type="text" size="15" class="width1" name="name" value="">
</div>
</div>
<div class="row">
<div class="caption">Телефон:<span class="label-required">Обязательное поле</span></div>
<div class="field">
<input required="required" type="text" size="30" name="phone" value="" class="width2">
</div>
</div>
<div class="row address" style="display: none;">
<div class="caption">Адрес:<span class="label-required">Обязательное поле</span></div>
<div class="field">
<input type="text" size="30" name="address" value="" class="width2">
</div>
</div>
<div class="row">
<div class="caption">Эл. почта:</div>
<div class="field">
<input type="text" size="30" name="email" value="" class="width2">
</div>
</div>
</div>
