|
|
@@ -204,18 +204,12 @@ class OrderUtils |
|
|
|
|
|
|
|
public function compareOrderProductReductionCatalog($orderProductReductionCatalog1, $orderProductReductionCatalog2) |
|
|
|
{ |
|
|
|
|
|
|
|
return $orderProductReductionCatalog1 && $orderProductReductionCatalog2 |
|
|
|
&& $orderProductReductionCatalog1->getUnit() == $orderProductReductionCatalog2->getUnit() |
|
|
|
&& $orderProductReductionCatalog1->getValue() == $orderProductReductionCatalog2->getValue() |
|
|
|
&& $orderProductReductionCatalog1->getBehaviorTaxRate() == $orderProductReductionCatalog2->getBehaviorTaxRate(); |
|
|
|
|
|
|
|
/*return (!$orderProductReductionCatalog1 && !$orderProductReductionCatalog2) |
|
|
|
return (!$orderProductReductionCatalog1 && !$orderProductReductionCatalog2) |
|
|
|
|| ($orderProductReductionCatalog1 |
|
|
|
&& $orderProductReductionCatalog2 |
|
|
|
&& $orderProductReductionCatalog1->getUnit() == $orderProductReductionCatalog2->getUnit() |
|
|
|
&& (string) $orderProductReductionCatalog1->getValue() == (string) $orderProductReductionCatalog2->getValue() |
|
|
|
&& $orderProductReductionCatalog1->getBehaviorTaxRate() == $orderProductReductionCatalog2->getBehaviorTaxRate()) ;*/ |
|
|
|
&& $orderProductReductionCatalog1->getBehaviorTaxRate() == $orderProductReductionCatalog2->getBehaviorTaxRate()) ; |
|
|
|
} |
|
|
|
|
|
|
|
public function countQuantities($orderShop) |
|
|
@@ -414,4 +408,25 @@ class OrderUtils |
|
|
|
|
|
|
|
return $document ; |
|
|
|
} |
|
|
|
|
|
|
|
public function groupOrderProductsByProductFamily($orderProducts) |
|
|
|
{ |
|
|
|
$orderProductsByProductFamily = [] ; |
|
|
|
foreach($orderProducts as $orderProduct) { |
|
|
|
if($orderProduct->getProduct() && $orderProduct->getProduct()->getProductFamily()) { |
|
|
|
$productFamily = $orderProduct->getProduct()->getProductFamily() ; |
|
|
|
if(!isset($orderProductsByProductFamily[$productFamily->getId()])) { |
|
|
|
$orderProductsByProductFamily[$productFamily->getId()] = [ |
|
|
|
'order_products' => [], |
|
|
|
'total_quantity_weight' => 0, |
|
|
|
] ; |
|
|
|
} |
|
|
|
$orderProductsByProductFamily[$productFamily->getId()]['order_products'][] = $orderProduct ; |
|
|
|
$orderProductsByProductFamily[$productFamily->getId()]['total_quantity_weight'] += ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient()) * $orderProduct->getQuantityOrder() ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $orderProductsByProductFamily ; |
|
|
|
} |
|
|
|
|
|
|
|
} |