00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class Mage_Tax_Block_Adminhtml_Frontend_Region_Updater
00028 extends Mage_Adminhtml_Block_System_Config_Form_Field
00029 {
00030 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
00031 {
00032 $html = parent::_getElementHtml($element);
00033
00034 $js = '<script type="text/javascript">
00035 var updater = new RegionUpdater("tax_defaults_country", "none", "tax_defaults_region", %s, "nullify");
00036 if(updater.lastCountryId) {
00037 var tmpRegionId = $("tax_defaults_region").value;
00038 var tmpCountryId = updater.lastCountryId;
00039 updater.lastCountryId=false;
00040 updater.update();
00041 updater.lastCountryId = tmpCountryId;
00042 $("tax_defaults_region").value = tmpRegionId;
00043 } else {
00044 updater.update();
00045 }
00046 </script>';
00047
00048 $html .= sprintf($js, $this->helper('directory')->getRegionJson());
00049 return $html;
00050 }
00051 }
00052
00053
00054