Magento Saving Multiselect Array on Custom Model

I have created a custom model in Magento that can be retrieved and modified in admin. However, I am having problems with the array. When I go to save the model, the textbox saves fine, but the multiselect field just saves as an "array" and then I cannot edit and edit it.

I need to know how to store and retrieve array data in a model. The dataset that appears in the multi selector field in the simply filtered product data.

Can anyone help with this? Any help is greatly appreciated !!!

enter image description here

+1


source to share


1 answer


Lay it out - on the saveAction () of your controller, under this:

$data = $this->getRequest()->getPost()

      



I just added the following code:

foreach ($data as $key => $value)
        {
            if (is_array($value))
            {
                $data[$key] = implode(',',$this->getRequest()->getParam($key)); 
            }
        }   

      

+5


source







All Articles