瀏覽代碼

[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…
取消
儲存