finally i got a solution
1) add form type to city field
classes/form/CustomerAddressFormatter.php
if ($field === 'city') {
$formField->setType('select');
$formField->setType('citySelect');
$formField->setRequired(true);
$loc=new Location(); //load data from db
$result=$loc->getLocations();
foreach ($result as $value) {
$formField->addAvailableValue(
$value['area'],
$value['area']
);
}
}
2) edit .tpl file
themes/yourtheme/templates/_partials/form-fields.tpl
{elseif $field.type === 'citySelect'}
<select
class="form-control form-control-select chosen-select"
name="{$field.name}"
{if $field.required}required{/if}
>
<option value disabled selected>{l s='-- please choose --' d='Shop.Forms.Labels'}</option>
{foreach from=$field.availableValues item="label" key="value"}
<option value="{$value}" {if $value eq $field.value} selected {/if}>{$label}</option>
{/foreach}
</select>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…