4

I want to add images for each brand, for that i have created a module. in module's edit form i want a manufacturer dropdown list so i can assign image to the particular manufacturer/brand.

its my code for the edit form location:

app/code/local/Root/Brand/Block/Adminhtml/Brand/Edit/Tab/form.php

$fieldset->addField('title', 'select', array('name' => 'title', 'label' => 'Brand', 'values' => Mage::getUrl('catalogsearch/advanced/result', array('brand'=>$option['value'])), )); $fieldset->addField('filename', 'image', array( 'label' => Mage::helper('brand')->__('Brand Image'), 'required' => false, 'name' => 'filename', 'note' => '(*.jpg, *.png, *.gif)', ));
dh47
  • 1,726
  • 1
  • 18
  • 31
Piyush
  • 5,893
  • 9
  • 34
  • 64

1 Answers1

3
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'manufacturer');
             //here, "brandname" is the attribute_code
         $allOptions = $attribute->getSource()->getAllOptions(true, true);
         $fieldset->addField('title', 'select', array(
          'label'     => Mage::helper('brand')->__('Brand Name'),
          'name'    => 'title',
          'values'   => $allOptions
      ));
Piyush
  • 5,893
  • 9
  • 34
  • 64