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

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.