ecshop 调用收货地址

时间:2021-12-03 16:40:50

html

{insert_scripts files='region.js,utils.js'}
<script type="text/javascript">
region.isAdmin = false;
{foreach from=$lang.flow_js item=item key=key}
var {$key} = "{$item}";
{/foreach} {literal}
onload = function() {
if (!document.all)
{
document.forms['theForm'].reset();
}
}
{/literal}
</script>
<select name="country" id="selCountries_{$sn}" onchange="region.changed(this, 1, 'selProvinces_{$sn}')" style="border:1px solid #ccc;">
<option value="">{$lang.please_select}{$name_of_region[]}</option>
<!-- {foreach from=$country_list item=country} -->
<option value="{$country.region_id}" {if $consignee.country eq $country.region_id}selected{/if}>{$country.region_name}</option>
<!-- {/foreach} -->
</select>
<select name="province" id="selProvinces_{$sn}" onchange="region.changed(this, 2, 'selCities_{$sn}')" style="border:1px solid #ccc;">
<option value="">{$lang.please_select}{$name_of_region[]}</option>
<!-- {foreach from=$province_list.$sn item=province} -->
<option value="{$province.region_id}" {if $consignee.province eq $province.region_id}selected{/if}>{$province.region_name}</option>
<!-- {/foreach} -->
</select>
<select name="city" id="selCities_{$sn}" onchange="region.changed(this, 3, 'selDistricts_{$sn}')" style="border:1px solid #ccc;">
<option value="">{$lang.please_select}{$name_of_region[]}</option>
<!-- {foreach from=$city_list.$sn item=city} -->
<option value="{$city.region_id}" {if $consignee.city eq $city.region_id}selected{/if}>{$city.region_name}</option>
<!-- {/foreach} -->
</select>
<select name="district" id="selDistricts_{$sn}" {if !$district_list.$sn}style="display:none"{/if} style="border:1px solid #ccc;">
<option value="">{$lang.please_select}{$name_of_region[]}</option>
<!-- {foreach from=$district_list.$sn item=district} -->
<option value="{$district.region_id}" {if $consignee.district eq $district.region_id}selected{/if}>{$district.region_name}</option>
<!-- {/foreach} -->
</select>

php代码

/* 取得国家列表、商店所在国家、商店所在国家的省列表 */
$smarty->assign('country_list', get_regions());
$smarty->assign('shop_country', $_CFG['shop_country']);
$smarty->assign('shop_province_list', get_regions(, $_CFG['shop_country']));