I have a three table in my database, article
category
and art_cat
article
has the id
,name
,status
of the article
category
has id
,name
,status
of the category
art_cat
has id
,art_id
and cat_id
in the tables.
I have the values inserted respectively, but in my "article form" my category values are not coming selected. I have a multi select dropdown for the category.
I have a distinct form for "category". that means my "article form" data goes in article
table and "category form" data goes in art_cat
table.
$fieldset->addField('category_id', 'multiselect', array(
'label' => 'Category',
'name' => 'category_id[]',
'values' => Mage::helper('blog')->getCategoryOptionValues(true),
'disabled' => false,
'index' => 'category_id',
));
and here is my helper file Data.php
static function getCategoryOptionValues($inlcudeNone = false) {
$collection = Mage::getModel('blog/blog')->getCollection();
$values = array();
if ($inlcudeNone){
$values[] = array('label' => "--None--", 'value' => 0);
}
foreach ($collection as $category) {
$values[] = array('label' => $category->getName(), 'value' => $category->getId());
}
return $values;
}
How can I get the selected value for the category multi select dropdown. Please somebody help me with this.