i am adding a locale for region from admin panel add is working perfectly but i want to show the value in edit how can i achieve this?

here is my code:


foreach (Mage::app()->getWebsites() as $webs) {
                $fieldset->addField(str_replace(' ','_',$webs->getName()), 'note', array(

                'label'     => $webs->getName(),
                'fieldset_html_class' => 'website',
        foreach ($webs->getGroups() as $groups) {

            $fieldset->addField(str_replace(' ','_',$groups->getName()), 'note', array(

                'label'     => $groups->getName(),
                'fieldset_html_class' => 'store-group',
            $stores = $groups->getStores();
            foreach ($stores as $store) {

                $fieldset->addField('region_'.Mage::getStoreConfig('general/locale/code', $store->getId()), 'text',  array(
                'name'      => 'region_'.Mage::getStoreConfig('general/locale/code', $store->getId()),
                'fieldset_html_class' => 'store',
                'label'     => $store->getName(),
                'title'     => $store->getName(),       
  • I have no idea what you are talking about. adding a region for what? Customer? shop? Product? and where do you want to show it? Where did you put the code? Please EDIT your question and add the informations Commented May 29, 2015 at 11:17
  • @FabianBlechschmidt i am creating the region manager extension, and i am facing issue. i have put my code that i have tried so far. Commented May 29, 2015 at 11:20

1 Answer 1


you have to add the data in form->addValues

get the param

$region_id = $this->getRequest()->getParam('id');

    $connectionresource = Mage::getSingleton('core/resource');
    $readconnection = $connectionresource->getConnection('core_read');
    $table = $connectionresource->getTableName('directory/country_region_name');
    $allrecord = $readconnection->select()->from(array('regions'=>$table))->where('regions.region_id=?', $region_id);
    $alldata =$readconnection->fetchAll($allrecord);
    foreach($alldata as $rows)
    //'region_'.$rows['locale'] for you froms name
    $form->addValues(array('region_'.$rows['locale']=> $rows['name']));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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