We created some "Brands" [values] in backend.

enter image description here

We have around 10 products in one category with category id = "40".

if we open any brand, we are displaying all those category products as multi-select option as below image.

enter image description here

but when we select options and click on "save", its not working.

why we want to save is , if we select particular Brand we want to display selected Products in dropdown in frontend as below image

enter image description here

Below code for displaying list of products in multi-select box.

$products = Mage::getModel('catalog/category')->load(40)

$categorylist = array();
$categorylist[] = array(
    'value' => '', 'label' => Mage::helper('sales')->__('Category')
foreach ($products as $product) {
    $categorylist[] = array(
        'value' => $product->getEntityId(), 'label' => $product->getName()
$fieldset->addField('category', 'multiselect',
        'label' => Mage::helper('sales')->__('Category'),
        'class' => 'required-entry',
        'required' => true,
        'values' => $categorylist,
        'name' => 'category',


enter image description here

  • where is product column?? Commented Jul 21, 2016 at 10:53
  • can you tell me in which table i need to check for the products of category id : 40 in db Commented Jul 21, 2016 at 10:55
  • you don't need to check just edit category there will be product show that are related to that category. Commented Jul 21, 2016 at 10:56
  • please check here : prnt.sc/bvmw5u , let me know if this is not you are looking for Commented Jul 21, 2016 at 10:59
  • 1
    put the name of the category multiselect 'name' => 'category[]', instead of 'name' => 'category',
    – Marius
    Commented Jul 21, 2016 at 12:57

1 Answer 1


$postData['category'] this will be your database table column name and $this->getRequest()->getPost('category') your form field name. implode function will be add , between the values.

$postData['category'] = implode(',',$this->getRequest()->getPost('category')); 

add in controller.php in saveAction

 $model = Mage::getModel('brand/brand');
 $data['products'] = implode(',',$this->getRequest()->getPost('category')); 
  • i added the code after array like here : pasted.co/765c4f53 , correct me if i am wrong. Commented Jul 21, 2016 at 11:10
  • this code is for saving the value in database kindly add this code where you saving your values Commented Jul 21, 2016 at 11:12
  • can you please help me to find that, i have no idea about where values are saving. are you telling in db? Commented Jul 21, 2016 at 11:14
  • Spacename/Mdoulename/controllers/Adminhtml/youcontroller.php and save method Commented Jul 21, 2016 at 11:17
  • this is controller.php file : pasted.co/9961df8c , please tell me where i need to add the code in your answer Commented Jul 21, 2016 at 11:21

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.