|
|
@@ -562,16 +562,17 @@ class Order extends ActiveRecordCommon |
|
|
|
* |
|
|
|
* @param integer $idProduct |
|
|
|
* @param array $orders |
|
|
|
* @param boolean $ignoreCancel |
|
|
|
* |
|
|
|
* @return integer |
|
|
|
*/ |
|
|
|
public static function getProductQuantity($idProduct, $orders) |
|
|
|
public static function getProductQuantity($idProduct, $orders, $ignoreCancel = false) |
|
|
|
{ |
|
|
|
$quantity = 0; |
|
|
|
|
|
|
|
if (isset($orders) && is_array($orders) && count($orders)) { |
|
|
|
foreach ($orders as $c) { |
|
|
|
if(is_null($c->date_delete)) { |
|
|
|
if(is_null($c->date_delete) || $ignoreCancel) { |
|
|
|
foreach ($c->productOrder as $po) { |
|
|
|
if ($po->id_product == $idProduct) { |
|
|
|
$quantity += $po->quantity ; |