1

enter image description here

I want to change the city to dropdown in Edit Order Billing Address admin.

  1. I try to update table eav_attribute in database. I changed frontend_input='select'; and copy the source model of country customer/entity_address_attribute_source_country. It change my textbox to dropdown but when I tried to duplicate the code of country in below path.

app\code\core\Mage\Customer\Model\Resource\Address\Attribute\Source\Country.php app\code\core\Mage\Customer\Model\Entity\Address\Attribute\Source\Country.php

and create a file app\code\core\Mage\Customer\Model\Resource\Address\Attribute\Source\City.php app\code\core\Mage\Customer\Model\Entity\Address\Attribute\Source\City.php

just replace the Country to City in the code and update again the table and change the value customer/entity_address_attribute_source_city. I already encountered error.

  1. I already found the form in app\design\adminhtml\default\default\template\sales\order\address\form.phtml but the code is hard to change because it is just a single line.. see below.
getForm()->toHtml() ?>

Anyone can help me on this requirements.

  • I already find a way by replacing it with jquery. <script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.8.3/…> <script>jQuery.noConflict()</script> <script> jQuery(document).ready(function($) { var value = $("#city").val(); //alert(value); $('#city').replaceWith( $('<select id="cities" name="city"><option value="Abha">Abha</option><option value="Al Qunfudhah">Al Qunfudhah</option></select>') ); $('select option[value="'+value+'"]').attr("selected",true); e.preventDefault(); }); </script> – ron24 Nov 19 '15 at 16:44
1

I already find a way by replacing it with jquery.

<script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>jQuery.noConflict()</script>
<script>
  jQuery(document).ready(function($) {
        var value = $("#city").val();
        //alert(value);
        $('#city').replaceWith( $('<select id="cities" name="city"><option value="Abha">Abha</option><option value="Al Qunfudhah">Al Qunfudhah</option></select>') );
        $('select option[value="'+value+'"]').attr("selected",true);
        e.preventDefault();

  });
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.