Przeglądaj źródła

ProductFamilySolver

packProduct
Guillaume 3 lat temu
rodzic
commit
4416a636eb
1 zmienionych plików z 42 dodań i 27 usunięć
  1. +42
    -27
      Solver/Product/ProductFamilySolver.php

+ 42
- 27
Solver/Product/ProductFamilySolver.php Wyświetl plik

@@ -25,44 +25,44 @@ class ProductFamilySolver
public function getBehaviorCountStockChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT,
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY,
];
}

public function getWaringMessageTypeChoices(): array
{
return [
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR,
ProductFamilyModel::WARNING_MESSAGE_TYPE_INFO,
ProductFamilyModel::WARNING_MESSAGE_TYPE_SUCCESS,
ProductFamilyModel::WARNING_MESSAGE_TYPE_WARNING,
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR,
ProductFamilyModel::WARNING_MESSAGE_TYPE_INFO,
ProductFamilyModel::WARNING_MESSAGE_TYPE_SUCCESS,
ProductFamilyModel::WARNING_MESSAGE_TYPE_WARNING,
];
}

public function getBehaviorAddToCartChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE,
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE,
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE,
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE,
];
}

public function getBehaviorPriceChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE,
ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT,
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE,
ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT,
];
}

public function getTypeExpirationDateChoices(): array
{
return [
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DDM,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLUO,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DDM,
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLUO,
];
}

@@ -70,8 +70,8 @@ class ProductFamilySolver
public function getBehaviorExpirationDateChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT,
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY,
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT,
];
}

@@ -79,8 +79,8 @@ class ProductFamilySolver
public function getBehaviorDisplaySaleChoices(): array
{
return [
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE,
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY,
];
}

@@ -140,7 +140,7 @@ class ProductFamilySolver

public function getTaxRateInherited(ProductPropertyInterface $productFamily)
{
if($productFamily instanceof ProductInterface) {
if ($productFamily instanceof ProductInterface) {
$productFamily = $productFamily->getProductFamily();
}

@@ -244,7 +244,10 @@ class ProductFamilySolver
$arrayCountProducts[$titleProduct] = [];
}

if (!in_array($this->productSolver->getQuantityLabelInherited($product), $arrayCountProducts[$titleProduct])) {
if (!in_array(
$this->productSolver->getQuantityLabelInherited($product),
$arrayCountProducts[$titleProduct]
)) {
$arrayCountProducts[$titleProduct][] = $this->productSolver->getQuantityLabelInherited($product);
}

@@ -339,7 +342,7 @@ class ProductFamilySolver
}
}

public function getBehaviorPriceInherited(ProductFamilyInterface $productFamily) :string
public function getBehaviorPriceInherited(ProductFamilyInterface $productFamily): string
{
return $productFamily->getBehaviorPrice();
}
@@ -388,8 +391,8 @@ class ProductFamilySolver
{
$qualityLabelArray = $productFamily->getQualityLabels();

foreach($qualityLabelArray as $qualityLabel) {
if(in_array($qualityLabel->getDevAlias(), $labelArray)) {
foreach ($qualityLabelArray as $qualityLabel) {
if (in_array($qualityLabel->getDevAlias(), $labelArray)) {
return $qualityLabel;
}
}
@@ -411,8 +414,8 @@ class ProductFamilySolver
{
$qualityLabelArray = $productFamily->getQualityLabels();

foreach($qualityLabelArray as $qualityLabel) {
if(in_array($qualityLabel->getDevAlias(), $labelArray)) {
foreach ($qualityLabelArray as $qualityLabel) {
if (in_array($qualityLabel->getDevAlias(), $labelArray)) {
return true;
}
}
@@ -422,13 +425,25 @@ class ProductFamilySolver

public function getSection(ProductFamilyInterface $productFamily): ?SectionInterface
{
foreach($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) {
if($productFamilySectionProperty->getStatus()) {
foreach ($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) {
if ($productFamilySectionProperty->getStatus()) {
return $productFamilySectionProperty->getSection();
}
}

return null;
}

public function isInSection(ProductFamilyInterface $productFamily, SectionInterface $section): bool
{
foreach ($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) {
if ($productFamilySectionProperty->getSection()->getId() == $section->getId(
) && $productFamilySectionProperty->getStatus()) {
return true;
}
}

return false;
}
}


Ładowanie…
Anuluj
Zapisz