Browse Source

GEstion des stcoks avancés

packProduct
Fab 2 years ago
parent
commit
bd77a2587b
2 changed files with 22 additions and 5 deletions
  1. +2
    -3
      Solver/Order/OrderShopSolver.php
  2. +20
    -2
      Solver/Product/ProductFamilySolver.php

+ 2
- 3
Solver/Order/OrderShopSolver.php View File

ProductInterface $product, ProductInterface $product,
$quantityOrder = 0, $quantityOrder = 0,
$checkCart = false, $checkCart = false,
$orderShop = null
$orderShop
) )
{ {
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) { if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) {
} }
} }


if ($this->productSolver->getAvailableQuantityInherited($product) >= $quantityAsked
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED) {
if ($this->productSolver->getAvailableQuantityInherited($product) >= $quantityAsked) {
return true; return true;
} else { } else {
return false; return false;

+ 20
- 2
Solver/Product/ProductFamilySolver.php View File

$availableQuantity += $this->productSolver->getAvailableQuantityInherited($product); $availableQuantity += $this->productSolver->getAvailableQuantityInherited($product);
} }
break; break;
}


case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED :
$availableQuantity = false;
return $availableQuantity;
}

public function getAvailableQuantitySupplierInherited(ProductFamilyInterface $productFamily)
{
$availableQuantity = 0;

switch ($productFamily->getBehaviorCountStock()) {
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$availableQuantity = $productFamily->getAvailableQuantitySupplier();
break;

case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :

foreach ($this->getProductsOnline($productFamily) as $product) {
$availableQuantity += $this->productSolver->getAvailableQuantitySupplierInherited($product);
}
break; break;
} }



Loading…
Cancel
Save