I have a shoppingcart table, a products table and a productcategory table. A shoppingcart can have products and all products have a category. When I go to the edit view of the shoppingcart, I can see all available products in my selectbox and the products that are allready in the shoppingcart are selected.
This is the code for the selectbox I have:
‘type’ => ‘select’,
‘multiple’ => ‘checkbox’,
‘options’ => $products,
‘default’ => array_keys($products)
But I would like to split the selectbox by the product category.
See the following picture for better explanation:
How can I do this and how would I recombine them again in the controller?
They need to be 2 seperate selectboxes, not only a single one that is sorted by the category.