vendor/store.shopware.com/acrissuggestedproductscs/src/AcrisSuggestedProductsCS.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Acris\SuggestedProducts;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  7. class AcrisSuggestedProductsCS extends Plugin
  8. {
  9.     public function uninstall(UninstallContext $context): void
  10.     {
  11.         if ($context->keepUserData()) {
  12.             return;
  13.         }
  14.         $this->cleanupDatabase();
  15.     }
  16.     public function update(UpdateContext $updateContext): void
  17.     {
  18.         $this->resetEnableConfigs();
  19.     }
  20.     private function cleanupDatabase(): void
  21.     {
  22.         $connection $this->container->get(Connection::class);
  23.         $connection->executeStatement('DROP TABLE IF EXISTS acris_customers_also_viewed');
  24.     }
  25.     private function resetEnableConfigs(): void
  26.     {
  27.         $systemConfigService $this->container->get('Shopware\Core\System\SystemConfig\SystemConfigService');
  28.         
  29.         $systemConfigService->set('AcrisSuggestedProductsCS.config.enableRecentlyViewedItems'false);
  30.         $systemConfigService->set('AcrisSuggestedProductsCS.config.enableCustomersAlsoBought'false);
  31.         $systemConfigService->set('AcrisSuggestedProductsCS.config.enableCustomersAlsoViewed'false);
  32.     }
  33. }