ソースを参照

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

packProduct
Fabien Normand 3年前
コミット
f5eb66a927
2個のファイルの変更28行の追加2行の削除
  1. +15
    -0
      Controller/ControllerTrait.php
  2. +13
    -2
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php

+ 15
- 0
Controller/ControllerTrait.php ファイルの表示

@@ -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 ファイルの表示

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

読み込み中…
キャンセル
保存