ソースを参照

GEstion des stcoks avancés

packProduct
Fab 3年前
コミット
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;
}


読み込み中…
キャンセル
保存