Просмотр исходного кода

GEstion des stcoks avancés

packProduct
Fab 3 лет назад
Родитель
Сommit
bd77a2587b
2 измененных файлов: 22 добавлений и 5 удалений
  1. +2
    -3
      Solver/Order/OrderShopSolver.php
  2. +20
    -2
      Solver/Product/ProductFamilySolver.php

+ 2
- 3
Solver/Order/OrderShopSolver.php Просмотреть файл

@@ -114,7 +114,7 @@ class OrderShopSolver
ProductInterface $product,
$quantityOrder = 0,
$checkCart = false,
$orderShop = null
$orderShop
)
{
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) {
@@ -153,8 +153,7 @@ class OrderShopSolver
}
}

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

+ 20
- 2
Solver/Product/ProductFamilySolver.php Просмотреть файл

@@ -122,9 +122,27 @@ class ProductFamilySolver
$availableQuantity += $this->productSolver->getAvailableQuantityInherited($product);
}
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;
}


Загрузка…
Отмена
Сохранить