Переглянути джерело

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

feature/souke
Guillaume Bourgeois 1 рік тому
джерело
коміт
c1bbdbd7a6
1 змінених файлів з 21 додано та 19 видалено
  1. +21
    -19
      backend/controllers/OrderController.php

+ 21
- 19
backend/controllers/OrderController.php Переглянути файл

@@ -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();
}
}


Завантаження…
Відмінити
Зберегти