getProductFamily()->getSaleStatus() != 1) { return false; } $allCategoriesSalesOff = true; $unavailableSpecificDay = false; foreach ($product->getProductFamily()->getProductCategories() as $category) { if ($category->getParent()) { if ($category->getSaleStatus() && $category->getParent()->getSaleStatus()) { $allCategoriesSalesOff = false; } } else { if ($category->getSaleStatus()) { $allCategoriesSalesOff = false; } } // specific day // @TODO : spécifique pdl ? $displaySpecificDay = $category->getDisplaySpecificDay(); if ($displaySpecificDay && $displaySpecificDay != date('N')) { $unavailableSpecificDay = true; } } if ($allCategoriesSalesOff) { return false; } if ($unavailableSpecificDay) { return false; } return true; } // getProductQuantity public function getProductQuantity(ProductInterface $product) { $productFamily = $product->getProductFamily(); if ($productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE) { return $this->getQuantityInherited($product) / $this->getUnitInherited($product)->getCoefficient(); } else { return 1; } } public function getBuyingPriceInherited(ProductInterface $product) { if ($product->getBuyingPrice()) { return $product->getBuyingPrice(); } else { return $product->getProductFamily()->getBuyingPrice(); } } public function getBuyingPriceByRefUnitInherited(ProductInterface $product) { if ($product->getBuyingPriceByRefUnit()) { return $product->getBuyingPriceByRefUnit(); } else { return $product->getProductFamily()->getBuyingPriceByRefUnit(); } } public function getPriceInherited(ProductInterface $product) { if ($product->getPrice()) { return $product->getPrice(); } else { return $product->getProductFamily()->getPrice(); } } public function getPriceByRefUnitInherited(ProductInterface $product) { if ($product->getPriceByRefUnit()) { return $product->getPriceByRefUnit(); } else { return $product->getProductFamily()->getPriceByRefUnit(); } } public function getBehaviorPriceInherited(ProductInterface $product) { return $product->getProductFamily()->getBehaviorPrice(); } public function getReductionCatalogInherited(ProductInterface $product) { return $product->getProductFamily()->getReductionCatalog(); } public function getUnitInherited(ProductInterface $product) { if ($product->getUnit()) { return $product->getUnit(); } else { return $product->getProductFamily()->getUnit(); } } public function getTitleInherited(ProductInterface $product) { if ($product->getTitle()) { return $product->getTitle(); } else { return $product->getProductFamily()->getTitle(); } } public function getQuantityInherited(ProductInterface $product) { if ($product->getQuantity()) { return $product->getQuantity(); } else { return $product->getProductFamily()->getQuantity(); } } public function getQuantityLabelInherited(ProductInterface $product) { $quantity = $product->getQuantityInherited(); $unit = $product->getUnitInherited(); return $quantity . $unit->getWordingShort(); } // @TODO : si besoin, à remettre en place /*public function getQuantityTitle(ProductInterface $product, ProductFamilyInterface $productFamily) { $title = $product->getQuantityLabelInherited(); if ($this->productFamilySolver->hasProductsWithVariousWeight($productFamily)) { $title .= ', ' . $product->getTitleInherited(); } return $title; }*/ public function getAvailableQuantityInherited(ProductInterface $product) { switch ($product->getProductFamily()->getBehaviorCountStock()) { case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : return $product->getProductFamily()->getAvailableQuantity(); case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : return $product->getAvailableQuantity(); case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED : return false; } } /*public function getTaxRateInherited(ProductInterface $product) { return $product->getProductFamily()->getTaxRateInherited(); }*/ public function getExportTitleInherited(ProductInterface $product): ?string { $exportTitle = $product->getExportTitle(); if ($exportTitle && strlen($exportTitle)) { return $exportTitle; } else { $productFamily = $product->getProductFamily(); if ($productFamily) { return $productFamily->getExportTitle(); } } return null; } public function getExportNoteInherited(ProductInterface $product): ?string { $exportNote = $product->getExportNote(); if ($exportNote && strlen($exportNote)) { return $exportNote; } else { $productFamily = $product->getProductFamily(); if ($productFamily) { return $productFamily->getExportNote(); } } return null; } }