Get all usa state in state drop down listin in magento registration -


i hope doing well,

i working in magento 1.6.0.1. current site usa, in registration page don't need country drop down list,and must display usa state in state drop down list.

for set country value "us" in hidden field.

so how can usa state in state drop down list

add in register.phtml display states of us:

                <div class="field">                     <label for="region_id" class="required"><em>*</em><?php echo $this->__('state/province') ?></label>                     <div class="input-box">                         <select id="region_id" name="region_id" title="<?php echo $this->__('state/province') ?>" class="validate-select">                             <option value=""><?php echo $this->__('please select region, state or province') ?></option>                     <?php                     $this->setdata('country_id','us'); // or 'fr'..., default 'us'                     $regions     =   $this->getregioncollection();                     foreach($regions $region)                     {                         echo "<option value=$region[name]>".$region['name'] . "</option>";                     }                     ?>                          </select>                         <script type="text/javascript">                         //<![cdata[                             $('region_id').setattribute('defaultvalue', "<?php echo $this->getformdata()->getregionid() ?>");                         //]]>                         </script>                          <input type="text" id="region" name="region" value="<?php echo $this->escapehtml($this->getregion()) ?>" title="<?php echo $this->__('state/province') ?>" class="input-text <?php echo $this->helper('customer/address')->getattributevalidationclass('region') ?>" style="display:none;"   />                     </div>                 </div>             </li>             <li class="fields">                   <div class="field">                     <label for="country" class="required"><em>*</em><?php echo $this->__('country') ?></label>                     <div class="input-box">                         <?php echo $this->getcountryhtmlselect() ?>                     </div>                 </div> 

and replace bottom javascript with:

  <script type="text/javascript">         var dataform = new varienform('form-validate', true);         new regionupdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getregionjson() ?>);     </script> 

hope


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -