$quantity = $value['quantity'];
$value['title'] = [];
- foreach (['offline', 'marketplace', 'online'] as $channel) {
- if (
- isset($forecast[$storeId][$channel][$group]) &&
- is_numeric($forecast[$storeId][$channel][$group])
- ) {
- $coef = $forecast[$storeId][$channel][$group];
- $value['title'][$channel] = round($quantity * $coef, 2);
+ if (!isset($forecast[$storeId])) {
+ 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);
+ }
}
}
}