You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace Lc\CaracoleBundle\Solver\Product;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
- use Lc\CaracoleBundle\Model\Product\ProductInterface;
-
- class ProductSolver
- {
-
- public function isProductSaleStatusOn(ProductInterface $product)
- {
- if ($product->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;
- }
-
-
-
- }
|