Product id ye göre gruplayabilirsiniz diye düşünüyorum, seçeneklerin id sine göre gruplayınca tek tek yerine id si aynı olan seçeneklerin miktarını toplatıp tek satırda yazdırabilirsiniz, denemedim ama ilk aklıma gelen bu şekilde
Var olan mevcut gruplamayı bulabilsem üzerine gideceğim ama bulamıyorum. order.php de bu kısımda yapıyor sanırım seçeneğe göre guruplamayı ama işte çıkamadım işin içinden.
foreach ($products as $product) {
$option_data = array();
$options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);
foreach ($options as $option) {
if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);
if ($upload_info) {
$value = $upload_info['name'];
} else {
$value = '';
}
}
$option_data[] = array(
'name' => $option['name'],
'value' => $value
);
}
$product_data[] = array(
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value'])
);
}