@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\EventSubscriber; | |||
use Lc\ShopBundle\Context\FilterMerchantInterface; | |||
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface; | |||
use Lc\ShopBundle\Context\ProductFamilyInterface; | |||
use Lc\ShopBundle\Context\StatusInterface; | |||
use Symfony\Component\DependencyInjection\Container; | |||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |||
@@ -49,6 +50,10 @@ class ListEventSubscriber implements EventSubscriberInterface | |||
}else {*/ | |||
if ($entityObject instanceof ProductFamilyInterface) { | |||
$paginator->nbResultsOnSale = $entityRepo->count(array('saleStatus' =>1, 'status'=> 1, 'merchant'=> $criteria['merchant'])); | |||
} | |||
if ($entityObject instanceof StatusInterface) { | |||
for ($status = -1; $status <= 1; $status++) { |
@@ -38,6 +38,11 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
*/ | |||
protected $productFamilies; | |||
/** | |||
* @ORM\Column(type="boolean") | |||
*/ | |||
protected $saleStatus; | |||
public function __construct() | |||
{ | |||
$this->childrens = new ArrayCollection(); | |||
@@ -154,4 +159,16 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt | |||
return $this; | |||
} | |||
public function getSaleStatus(): ?bool | |||
{ | |||
return $this->saleStatus; | |||
} | |||
public function setSaleStatus(bool $saleStatus): self | |||
{ | |||
$this->saleStatus = $saleStatus; | |||
return $this; | |||
} | |||
} |
@@ -223,6 +223,11 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
protected $behaviorPrice; | |||
/** | |||
* @ORM\Column(type="boolean") | |||
*/ | |||
protected $saleStatus; | |||
public function __construct() | |||
{ | |||
$this->productCategories = new ArrayCollection(); | |||
@@ -840,4 +845,16 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr | |||
return false ; | |||
} | |||
public function getSaleStatus(): ?bool | |||
{ | |||
return $this->saleStatus; | |||
} | |||
public function setSaleStatus(bool $saleStatus): self | |||
{ | |||
$this->saleStatus = $saleStatus; | |||
return $this; | |||
} | |||
} |
@@ -6,7 +6,9 @@ list: | |||
nbResultsFiltered: Total d'élements filtrés | |||
nbResultsOnline: Total d'élements en ligne | |||
nbResultsOffline: Total d'élements hors ligne | |||
nbResultsDeleted: Total d'élements supprimé | |||
nbResultsDeleted: Total d'élements supprimés | |||
nbResultsOnSale: Total de produits en vente | |||
nbProductFamilyOnline: Total de produits visibles | |||
listChildren: Afficher les enfants | |||
edit: Éditer | |||
delete: Supprimer | |||
@@ -163,6 +165,7 @@ field: | |||
deliveryAvailabilty: Créneau de livraison | |||
id: Id | |||
status: Statut | |||
saleStatus: En vente sur le site | |||
statusOptions: | |||
offline: <span class="badge badge-danger">Hors ligne</span> | |||
online: <span class="badge badge-success">En ligne</span> |
@@ -110,11 +110,11 @@ | |||
<i class="fa fa-check"></i> </span>{% endif %} | |||
{% if paginator.nbResultsOffline is defined %}<span data-toggle="tooltip" | |||
title="{{ "list.nbResultsOffline"|trans }}" | |||
class="badge badge-warning">{{ paginator.nbResultsOffline }} | |||
class="badge badge-danger">{{ paginator.nbResultsOffline }} | |||
<i class="fa fa-pen"></i></span>{% endif %} | |||
{% if is_granted('ROLE_SUPER_ADMIN') and paginator.nbResultsDeleted is defined %}<span | |||
data-toggle="tooltip" title="{{ "list.nbResultsDeleted"|trans }}" | |||
class="badge badge-danger">{{ paginator.nbResultsDeleted }} <i | |||
class="badge badge-secondary">{{ paginator.nbResultsDeleted }} <i | |||
class="fa fa-trash"></i> | |||
</span>{% endif %} | |||
{% endblock %} |
@@ -7,6 +7,9 @@ | |||
<div class="col-12"> | |||
{{ form_row(form.status) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.saleStatus) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.supplier) }} | |||
</div> |
@@ -61,10 +61,16 @@ trait OrderUtilsStockTrait | |||
public function isProductAvailable(Product $product, $quantityOrder = 0, $checkCart = false, $orderShop = null) | |||
{ | |||
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1) { | |||
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || $product->getProductFamily()->getSaleStatus()!=1) { | |||
return false; | |||
} | |||
$allCategoriesSalesOff = true; | |||
foreach ($product->getProductFamily()->getProductCategories() as $category){ | |||
if($category->getSaleStatus())$allCategoriesSalesOff = false; | |||
} | |||
if($allCategoriesSalesOff)return false; | |||
if (!$orderShop) { | |||
$orderShop = $this->getCartCurrent(); | |||
} |