Sfoglia il codice sorgente

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

refactoring
Guillaume Bourgeois 2 anni fa
parent
commit
8c9a58fd57
1 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. +18
    -0
      common/models/Distribution.php

+ 18
- 0
common/models/Distribution.php Vedi File

@@ -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…
Annulla
Salva