Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- <?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;
- }
-
- }
-
|