|
|
@@ -321,6 +321,20 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr |
|
|
|
return $this->products; |
|
|
|
} |
|
|
|
|
|
|
|
public function getProductsOnline(): Collection |
|
|
|
{ |
|
|
|
$products = $this->getProducts() ; |
|
|
|
$productsOnlineArray = new ArrayCollection() ; |
|
|
|
|
|
|
|
foreach($products as $product) { |
|
|
|
if($product->getStatus() == 1) { |
|
|
|
$productsOnlineArray[] = $product ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $productsOnlineArray ; |
|
|
|
} |
|
|
|
|
|
|
|
public function addProduct(ProductInterface $product): self |
|
|
|
{ |
|
|
|
if (!$this->products->contains($product)) { |
|
|
@@ -759,11 +773,13 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr |
|
|
|
$products = $this->getProducts(); |
|
|
|
|
|
|
|
foreach ($products as $product) { |
|
|
|
$titleProduct = $product->getTitleInherited(); |
|
|
|
if (!isset($arrayProductsGroupByTitle[$titleProduct])) { |
|
|
|
$arrayProductsGroupByTitle[$titleProduct] = []; |
|
|
|
if($product->getStatus() == 1) { |
|
|
|
$titleProduct = $product->getTitleInherited(); |
|
|
|
if (!isset($arrayProductsGroupByTitle[$titleProduct])) { |
|
|
|
$arrayProductsGroupByTitle[$titleProduct] = []; |
|
|
|
} |
|
|
|
$arrayProductsGroupByTitle[$titleProduct][] = $product; |
|
|
|
} |
|
|
|
$arrayProductsGroupByTitle[$titleProduct][] = $product; |
|
|
|
} |
|
|
|
|
|
|
|
return $arrayProductsGroupByTitle; |