Bladeren bron

Correctif import

packProduct
Fabien Normand 3 jaren geleden
bovenliggende
commit
c80a474b87
5 gewijzigde bestanden met toevoegingen van 20 en 26 verwijderingen
  1. +1
    -1
      Controller/User/UserAdminController.php
  2. +1
    -1
      Controller/User/UserMerchantAdminController.php
  3. +3
    -22
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php
  4. +1
    -1
      Repository/Product/ProductCategoryStore.php
  5. +14
    -1
      Repository/Product/ProductFamilyStore.php

+ 1
- 1
Controller/User/UserAdminController.php Bestand weergeven

@@ -25,7 +25,7 @@ abstract class UserAdminController extends SovUserAdminController
return $this->getUserContainer()->getFactory()->create();
}

public function overrideEntitiesActions(?EntityCollection $entities): void
public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void
{
foreach ($entities as $entity) {
foreach ($entity->getActions() as $action){

+ 1
- 1
Controller/User/UserMerchantAdminController.php Bestand weergeven

@@ -52,7 +52,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
return $repositoryQuery;
}

public function overrideEntitiesActions(?EntityCollection $entities): void
public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void
{
$context = $this->get(AdminContextProvider::class)->getContext();
$adminUrlGenerator = $this->get(AdminUrlGenerator::class);

+ 3
- 22
EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php Bestand weergeven

@@ -27,28 +27,9 @@ class UpdateProductFamilySectionPropertyEventSubscriber implements EventSubscrib

public function processBeforePersistProductFamilySectionInterface(EntityManagerEvent $event)
{
$productFamilySectionProperty = $event->getEntity();

if($productFamilySectionProperty instanceof ProductFamilySectionPropertyInterface) {
$section = $productFamilySectionProperty->getSection();
if($productFamilySectionProperty->getStatus() == 1) {
$productCategoryArray = $productFamilySectionProperty->getProductFamily()->getProductCategories();
foreach($productCategoryArray as $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);
}
}
}
}
}

//TODO à supprimer déplacer dans le script d'import, à remplacer par une alerte à l'édition d'un produit

}

}

+ 1
- 1
Repository/Product/ProductCategoryStore.php Bestand weergeven

@@ -46,7 +46,7 @@ class ProductCategoryStore extends AbstractStore
return $query->findOne();
}

public function getAllByDevAlias(string $devAlias): array
public function getByDevAlias(string $devAlias): array
{
$query = $this->createDefaultQuery();
$query->filterByDevAlias($devAlias);

+ 14
- 1
Repository/Product/ProductFamilyStore.php Bestand weergeven

@@ -34,7 +34,7 @@ class ProductFamilyStore extends AbstractStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterIsOnlineAndOffline();
$this->addFilterBySectionOptionnal($query);
$this->addFilterByMerchantViaSectionOptionnal($query);

@@ -81,6 +81,19 @@ class ProductFamilyStore extends AbstractStore
return $query->find();
}

//TODO ajouter status en donné de contexte pour éviter ce truc
public function getByCategoryOnlineAndOffline(
ProductCategoryInterface $productCategory,
$query = null
) {
$query = $this->createDefaultQuery($query);

$query
->filterByProductCategory($productCategory);

return $query->find();
}

// getProductFamiliesNovelties
public function getNovelty($user = null, $organizeByParentCategory = true, $query = null)
{

Laden…
Annuleren
Opslaan