Commit 86301a927906a2d7829be20693eb956def65f901
1 parent
19a7a33f
14.06.16
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
common/modules/product/models/Import.php
... | ... | @@ -125,6 +125,7 @@ class Import extends Model { |
125 | 125 | // ===== Set stock ==== |
126 | 126 | if ( $city_name ) { |
127 | 127 | if ( ($stock = Stock::find()->filterWhere(['name' => trim($city_name)])->one()) === null ) { |
128 | + | |
128 | 129 | // Create stock |
129 | 130 | $stock = new Stock(); |
130 | 131 | $stock->name = trim($city_name); |
... | ... | @@ -139,8 +140,8 @@ class Import extends Model { |
139 | 140 | $productStock->product_id = $productVariant->product_id; |
140 | 141 | } |
141 | 142 | $productStock->quantity = $count; |
142 | - $productStock->save(); | |
143 | 143 | |
144 | + $productStock->save(); | |
144 | 145 | $productStocks = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id])->andWhere(['<>', 'stock_id', $stock->stock_id])->all(); |
145 | 146 | |
146 | 147 | $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; | ... | ... |
common/modules/product/models/ProductStock.php