Преглед на файлове

[Backend] Produits : prix modifiés lors de l'édition #573

refactoring
Guillaume Bourgeois преди 2 години
родител
ревизия
8c9a58fd57
променени са 1 файла, в които са добавени 18 реда и са изтрити 0 реда
  1. +18
    -0
      common/models/Distribution.php

+ 18
- 0
common/models/Distribution.php Целия файл

@@ -336,6 +336,24 @@ class Distribution extends ActiveRecordCommon
foreach($order->productOrder as $productOrder) {
if($productOrder->id_product == $product->id) {
$productOrder->price = $product->price ;

$user = false;
$userProducer = false;
if(isset($order->user) && $order->user) {
$user = $order->user;
$userProducer = UserProducer::searchOne([
'id_user' => $user->id,
'id_producer' => $order->distribution->id_producer
]) ;
}

$productOrder->price = $productOrder->product->getPrice([
'user' => $user,
'user_producer' => $userProducer,
'point_sale' => $order->pointSale,
'quantity' => $productOrder->quantity
]);

$productOrder->save() ;
}
}

Loading…
Отказ
Запис