Pārlūkot izejas kodu

Correctif

packProduct
Fabien Normand pirms 2 gadiem
vecāks
revīzija
242f1e4522
1 mainītis faili ar 18 papildinājumiem un 11 dzēšanām
  1. +18
    -11
      Builder/Product/ProductCategoryBuilder.php

+ 18
- 11
Builder/Product/ProductCategoryBuilder.php Parādīt failu

@@ -23,16 +23,19 @@ class ProductCategoryBuilder
public function setOnlineIfOnlineProductfamily(ProductCategoryInterface $productCategory)
{
if ($this->productCategorySolver->hasOnlineProductFamily($productCategory)) {
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);
if(!$productCategory->getStatus()) {
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);

$this->flashBagTranslator->add('success', 'setOnline','ProductCategory', array('%category%'=> $productCategory, '%section%'=> $productCategory->getSection()));
$this->flashBagTranslator->add('success', 'setOnline', 'ProductCategory', array('%category%' => $productCategory, '%section%' => $productCategory->getSection()));
}
// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if ($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);

if(!$productCategory->getStatus()) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
}
}
}
@@ -41,15 +44,19 @@ class ProductCategoryBuilder
public function setOfflineIfOfflineProductfamily(ProductCategoryInterface $productCategory)
{
if (!$this->productCategorySolver->hasOnlineProductFamily($productCategory)) {
$productCategory->setStatus(0);
$this->entityManager->update($productCategory);
$this->flashBagTranslator->add('info', 'setOffline','ProductCategory', array('%category%'=> $productCategory, '%section%'=> $productCategory->getSection()));
if($productCategory->getStatus()) {

$productCategory->setStatus(0);
$this->entityManager->update($productCategory);
$this->flashBagTranslator->add('info', 'setOffline', 'ProductCategory', array('%category%' => $productCategory, '%section%' => $productCategory->getSection()));
}
// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if ($productCategoryParent && !$this->productCategorySolver->hasOnlineProductFamily($productCategoryParent)) {
$productCategoryParent->setStatus(0);
$this->entityManager->update($productCategoryParent);
if($productCategory->getStatus()) {
$productCategoryParent->setStatus(0);
$this->entityManager->update($productCategoryParent);
}
}
}
}

Notiek ielāde…
Atcelt
Saglabāt