// 1. Получение гуидов букетов
$productsGroup = ProductsClass::find()
- ->orWhere(['ilike', 'tip', ProductsClass::MARKETPLACE])
- ->orWhere(['ilike', 'tip', ProductsClass::MARKETPLACE_ADDITIONAL])
+ ->where(['tip' => [ProductsClass::MARKETPLACE, ProductsClass::MARKETPLACE_ADDITIONAL]])
->select('category_id')
- ->asArray();
+ ->asArray()
+ ->column();
$productsGuids = Products1c::find()
- ->andWhere(['in', 'parent_id', $productsGroup])
+ ->where(['in', 'parent_id', $productsGroup])
->andWhere(['<>', 'components', ''])
->select('id')
->column();
}
}
+
$bouquetCount = PHP_INT_MAX;
foreach ($stockRecords as $productGuid => $values) {
$temp = intval($values['count'] / $products->$productGuid);
$store = $values['marketplace_guid'];
}
- if (isset($bouquetCount) && $bouquetCount > 0) {
+ if (!empty($stockRecords) && isset($store) && $bouquetCount > 0) {
$stocks[$guid] = ['count' => $bouquetCount, 'store' => $store];
}
}