소스 검색

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;
}


Loading…
취소
저장