Php magento中的自定义城市下拉列表
由于magento没有提供城市下拉列表,我尝试在我的Php magento中的自定义城市下拉列表,php,magento,Php,Magento,由于magento没有提供城市下拉列表,我尝试在我的persistent/checkout/onepage/billing.phtml页面上添加自定义代码。我添加了这个,但是city没有填充下拉列表,但是当我在一个html页面上尝试它时,它实际上是下拉的 这是我的代码: <div class="input-box"> <select class="validate-select" id="billing:region_id" name= "billing[reg
persistent/checkout/onepage/billing.phtml
页面上添加自定义代码。我添加了这个,但是city没有填充下拉列表,但是当我在一个html页面上尝试它时,它实际上是下拉的
这是我的代码:
<div class="input-box">
<select class="validate-select" id="billing:region_id" name=
"billing[region_id]" style="display:none;" title=
"<?php echo $this->__('State/Province') ?>">
<option value="">
<?php echo $this->__('Please select region, state or province') ?>
</option>
</select>
<script type="text/javascript">
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
</script> <input class=
"input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>"
id="billing:region" name="billing[region]" style="display:none;" title=
"<?php echo $this->__('State/Province') ?>" type="text" value=
"<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>">
</div>
<div class="field">
<label class="required" for=
"billing:city"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input class="input-box" name="name" type="text">
<script type="text/javascript">
$('select').change(function(){
if(('billing:region_id').val()!="1")
$('.input-box').replaceWith("<input class="input-box" type='text' name='name'>");
else
$('.input-box').replaceWith('<select class="input-box"><option>a<\/option><\/select>');
}).change();
</script>
</div>
</div>
你的变革活动有效吗?还有什么是“.change()”,在我认为这不应该存在之前。一切都是独立工作的,没有添加Magento。您是否包括了jquery库。或者console中是否存在任何错误。也请使用noConflict(),这可能会导致问题。