Você não pode selecionar mais de 25 tópicos
Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
|
- <?php
-
- namespace Lc\CaracoleBundle\Solver\Product;
-
- use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
-
- class ProductCategorySolver
- {
-
- protected ProductFamilySectionPropertySolver $productFamilySectionPropertySolver;
- public function __construct(ProductFamilySectionPropertySolver $productFamilySectionPropertySolver){
- $this->productFamilySectionPropertySolver = $productFamilySectionPropertySolver;
- }
-
- public function isOnline(ProductCategoryInterface $productCategory)
- {
- if ($productCategory->getParent()) {
- if ($productCategory->getStatus() && $productCategory->getParent()->getStatus()) {
- return true;
- }
- } elseif ($productCategory->getStatus()) {
- return true;
- }
- return false;
- }
-
- public function hasOnlineProductFamily(ProductCategoryInterface $productCategory){
- if($productCategory->getProductFamilies()) {
- foreach ($productCategory->getProductFamilies() as $productFamily) {
- $productFamilySectionProperty = $this->productFamilySectionPropertySolver->getProductFamilySectionProperty($productFamily, $productCategory->getSection());
- //vérifie que le produit est en ligne et qu'il est actif sur cette section
- if ($productFamily->getStatus() == 1 && $productFamilySectionProperty && $productFamilySectionProperty->getStatus() == 1) {
- return true;
- }
- }
- }
-
- foreach($productCategory->getChildrens() as $productCategoryChildren){
- if($this->hasOnlineProductFamily($productCategoryChildren) && $productCategoryChildren->getStatus()==1){
- return true;
- }
- }
-
- return false;
- }
-
- }
-
|