Bläddra i källkod

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

packProduct
Fabien Normand 3 år sedan
förälder
incheckning
f5eb66a927
2 ändrade filer med 28 tillägg och 2 borttagningar
  1. +15
    -0
      Controller/ControllerTrait.php
  2. +13
    -2
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php

+ 15
- 0
Controller/ControllerTrait.php Visa fil

@@ -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 Visa fil

@@ -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);
}
}
}
}
}

Laddar…
Avbryt
Spara