Автоподбор города и склада в зависимости от выбранного города для транспортной копании Новая Почта(Украина). Использование с модулем SImpleCheckout.
Бета версия :) решение, которое использую у себя, возможно кому-то будет полезным.
В базе создаем таблицы city_sklads и city с помощью файлов city_sklads.sql и city.sql
=====================================================================
В "настройки полей покупателя" Simple добавляем поле с идентом custom_otdelenie с типом select.
=====================================================================
в simplecheckout_customer.tpl
в самом верху вставить:
<script>jQuery('#checkout_customer_main_city').live('change',function(){ $("#checkout_customer_custom_otdelenie").load('index.php?route=account/np/sklads&term='+encodeURIComponent($('#checkout_customer_main_city').val()));});$(function auto(){$('#checkout_customer_main_city').autocomplete({ source: function(request, response) {$.ajax({url: 'index.php?route=account/np/geo&term=' + encodeURIComponent(request.term),dataType: 'json',success: function(json) { response($.map(json, function(item) {return { label: item.name, value: item.name }}));}});},delay:3,minChars:1,matchSubset:1,autoFill:true,maxItemsToShow:10,minLength: 1,select: function( event, ui ) {$('#checkout_customer_main_city').val(ui.item.label); }, select: function( event, ui ) {$("#checkout_customer_custom_otdelenie").load('index.php?route=account/np/sklads&term='+encodeURIComponent(ui.item.label));} }) }); </script> <style>.ui-autocomplete {max-height: 150px;overflow-y: auto;/* без горизонтальной полосы прокрутки */overflow-x: hidden;/* добавляем отступ, учитывая, что будет вертикальная полоса прокрутки */padding-right: 20px;}/* IE 6 не поддерживает max-height* мы используем вместо этого height, но теперь меню всегда будет такой высоты*/* html .ui-autocomplete {height: 150px;}</style>
np_sklads.zip
np_sklads.zip