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:


$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)', ));
  • please more details of your module
    – Amit Bera
    Commented Jan 7, 2015 at 12:13
  • put your code Otherwise we cannot help u
    – Amit Bera
    Commented Jan 7, 2015 at 12:18
  • @piyush Next time edit the question instead of putting the code in comments now I done that for you
    – dh47
    Commented Jan 7, 2015 at 12:26

1 Answer 1

$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

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.