Skip to content

Instantly share code, notes, and snippets.

@qolbu
qolbu / custom.tpl
Last active February 15, 2017 10:17
populate city from rajaongkir.com API - Opencart
<select name="custom_city_id" id="input-city" class="form-control">
<option value="0"><?php echo $text_none; ?></option>
<?php foreach ($cities as $value) { ?>
<?php if ($value->city_id == $custom_city_id) { ?>
<option value="<?php echo $value->city_id; ?>" selected="selected"><?php echo $value->city_name; ?></option>
<?php } else { ?>
<option value="<?php echo $value->city_id; ?>"><?php echo $value->city_name; ?></option>
<?php } ?>
<?php } ?>
</select>