Ver código fonte

ErrorException: A non-numeric value encountered in OrderController.php l. 829 #1174

feature/souke
Guillaume Bourgeois 1 ano atrás
pai
commit
c1bbdbd7a6
1 arquivos alterados com 21 adições e 19 exclusões
  1. +21
    -19
      backend/controllers/OrderController.php

+ 21
- 19
backend/controllers/OrderController.php Ver arquivo

@@ -826,26 +826,28 @@ class OrderController extends BackendController

foreach ($products as $key => $dataProductOrder) {
$product = $productManager->findOneProductById($key);
$quantity = $dataProductOrder->quantity / Product::$unitsArray[$dataProductOrder->unit]['coefficient'];
if ($product && $quantity) {
$productOrder = new ProductOrder;
$productOrder->id_order = $order->id;
$productOrder->id_product = $key;
$productOrder->quantity = $quantity;
$productOrder->unit = $product->unit;
$productOrder->step = $product->step;
if ($dataProductOrder->price) {
$productOrder->price = $dataProductOrder->price;
} else {
$productOrder->price = $productManager->getPrice($product, [
'user' => $user,
'user_producer' => $userProducer,
'point_sale' => $order->pointSale,
'quantity' => $productOrder->quantity
]);
if(isset(Product::$unitsArray[$dataProductOrder->unit]) && Product::$unitsArray[$dataProductOrder->unit]['coefficient']) {
$quantity = $dataProductOrder->quantity / Product::$unitsArray[$dataProductOrder->unit]['coefficient'];
if ($product && $quantity) {
$productOrder = new ProductOrder;
$productOrder->id_order = $order->id;
$productOrder->id_product = $key;
$productOrder->quantity = $quantity;
$productOrder->unit = $product->unit;
$productOrder->step = $product->step;
if ($dataProductOrder->price) {
$productOrder->price = $dataProductOrder->price;
} else {
$productOrder->price = $productManager->getPrice($product, [
'user' => $user,
'user_producer' => $userProducer,
'point_sale' => $order->pointSale,
'quantity' => $productOrder->quantity
]);
}
$productOrder->id_tax_rate = $product->taxRate->id;
$productOrder->save();
}
$productOrder->id_tax_rate = $product->taxRate->id;
$productOrder->save();
}
}


Carregando…
Cancelar
Salvar