Commit 10b20e5a5cc07f398084eb58fa4385a6fc6cd226
1 parent
549eab3d
-Import prices fixed
Showing
2 changed files
with
7 additions
and
13 deletions
Show diff stats
backend/views/site/index.php
common/modules/product/models/Import.php
| ... | ... | @@ -170,21 +170,13 @@ class Import extends Model { |
| 170 | 170 | |
| 171 | 171 | $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; |
| 172 | 172 | } else { |
| 173 | - | |
| 174 | - $productStocks = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id])->all(); | |
| 175 | - | |
| 176 | - if($productStocks instanceof ProductStock){ | |
| 177 | - $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; | |
| 173 | + if ($count == 0) { | |
| 174 | + continue; | |
| 178 | 175 | } else { |
| 179 | - $quantity = 0; | |
| 180 | - $productStocks = new ProductStock(); | |
| 181 | - $productStocks->product_id = $productVariant->product_id; | |
| 182 | - $productStocks->quantity = $quantity; | |
| 183 | - $productStocks->product_variant_id = $productVariant->product_variant_id; | |
| 184 | - $productStocks->save(); | |
| 185 | - | |
| 176 | + $productStocks = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id])->all(); | |
| 177 | + | |
| 178 | + $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; | |
| 186 | 179 | } |
| 187 | - | |
| 188 | 180 | } |
| 189 | 181 | |
| 190 | 182 | if ($price_promo) { | ... | ... |