foreach ($result as $productId => &$productData) {
foreach ($productData['values'] as &$value) {
$storeId = $value['store_id'];
- $group = $value['group'];
$quantity = $value['quantity'];
$value['title'] = [];
continue;
}
- if (isset($forecast[$storeId][$productId])) {
- foreach (['offline', 'marketplace', 'online'] as $channel) {
- if (
- isset($forecast[$storeId][$productId][$channel][$group]) &&
- is_numeric($forecast[$storeId][$productId][$channel][$group])
- ) {
- $coef = $forecast[$storeId][$productId][$channel][$group];
- $value['title'][$channel] = round($quantity * $coef, 2);
- }
+ foreach (['offline', 'marketplace', 'online'] as $channel) {
+ if (isset($forecast[$storeId][$channel]['share']) && is_numeric($forecast[$storeId][$channel]['share'])) {
+ $coef = $forecast[$storeId][$channel]['share'];
+ $value['title'][$channel] = round($quantity * $coef, 2);
}
}
}
}
-
return array_values($result);
}