I need help grouping my output of my array
PHP Code:
$this->products[$index] = array('qty' => $products[$i]['quantity'],
                                      
'name' => $products[$i]['name'],
                                      
'model' => $products[$i]['model'],
                                      
'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                      
'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                      
'price' => $products[$i]['price'],
                                      
'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
                                      
'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                      
'weight' => $products[$i]['weight'],
                                      
'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
                                      
'product_is_free' => $products[$i]['product_is_free'],
                                      
'products_discount_type' => $products[$i]['products_discount_type'],
                                      
'products_discount_type_from' => $products[$i]['products_discount_type_from'],
                                      
'id' => $products[$i]['id'],
                      
'product_manufacturer' => $products[$i]['manufacturers_id'],
                                      
'rowClass' => $rowClass); 
I know I can user something like a foreach but that will output for each manufacturer_id. I need to group products by manfucturers so manufacturer A has 4 product and manufracturer B has 2 for total output is 6 products. I have to make so I can email all of manufacturers A products to that manufacturer and B's products to manufacturer B and so on. I was thinking of some array that index off the manufacturers_id. Ideas suggestions?