Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
|
- <?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;
- }
-
- }
-
|