Browse Source

[backend] Documents : correction bug total produits

dev
Guillaume 4 years ago
parent
commit
6b33d27c1b
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      common/models/Document.php

+ 5
- 3
common/models/Document.php View File

public function getProductsOrders() public function getProductsOrders()
{ {
$productsOrdersArray = []; $productsOrdersArray = [];
if ($this->orders && count($this->orders)) {
foreach ($this->orders as $order) {
$ordersArray = $this->orders ;
if ($ordersArray && count($ordersArray)) {
foreach ($ordersArray as $order) {
foreach ($order->productOrder as $productOrder) { foreach ($order->productOrder as $productOrder) {
if (!isset($productsOrdersArray[$productOrder->id_product])) { if (!isset($productsOrdersArray[$productOrder->id_product])) {
$productsOrdersArray[$productOrder->id_product] = [$productOrder];
$newProductOrder = clone $productOrder ;
$productsOrdersArray[$productOrder->id_product] = [$newProductOrder];
} else { } else {
$productOrderMatch = false; $productOrderMatch = false;
foreach ($productsOrdersArray[$productOrder->id_product] as &$theProductOrder) { foreach ($productsOrdersArray[$productOrder->id_product] as &$theProductOrder) {

Loading…
Cancel
Save