Explorar el Código

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Fabien Normand hace 2 años
padre
commit
f5eb66a927
Se han modificado 2 ficheros con 28 adiciones y 2 borrados
  1. +15
    -0
      Controller/ControllerTrait.php
  2. +13
    -2
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php

+ 15
- 0
Controller/ControllerTrait.php Ver fichero

@@ -159,6 +159,11 @@ trait ControllerTrait
return $this->get(SectionResolver::class)->getCurrent(true);
}

public function getSectionCurrentVisited(): ?SectionInterface
{
return $this->get(SectionResolver::class)->getCurrent(false, true);
}

public function isOutOfSection()
{
return $this->get(SectionResolver::class)->isOutOfSection();
@@ -179,6 +184,16 @@ trait ControllerTrait
);
}

public function getCartCurrentVisited(): OrderShopInterface
{
return $this->getOrderShopContainer()->getBuilder()->createIfNotExist(
$this->getSectionCurrentVisited(),
$this->getUserCurrent(),
$this->getVisitorCurrent(),
true
);
}

public function getPriceSolver(): PriceSolver
{
return $this->get(PriceSolver::class);

+ 13
- 2
EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php Ver fichero

@@ -30,11 +30,22 @@ class UpdateProductFamilySectionPropertyEventSubscriber implements EventSubscrib
$productFamilySectionProperty = $event->getEntity();

if($productFamilySectionProperty instanceof ProductFamilySectionPropertyInterface) {
$section = $productFamilySectionProperty->getSection();
if($productFamilySectionProperty->getStatus() == 1) {
$productCategoryArray = $productFamilySectionProperty->getProductFamily()->getProductCategories();
foreach($productCategoryArray as $productCategory) {
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);
if($productCategory->getSection() == $section) {
// mise à jour du statut
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);

// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
}
}
}
}

Cargando…
Cancelar
Guardar