Skip to content

Commit

Permalink
feat: install ps_account on dashboard hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jinpresta committed Sep 4, 2024
1 parent 828e463 commit a3bd702
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Traits/Hooks/UseDashboardZoneOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ protected function loadPsAccounts(): string
$accountsService = $accountsFacade->getPsAccountsService();
if ($this->ensurePsAccountIsEnabled()) $this->get('mbo.ps_eventbus.installer')->install();
} catch (\PrestaShop\PsAccountsInstaller\Installer\Exception\InstallerException $e) {
ErrorHelper::reportError($e);
$accountsInstaller = $this->get('mbo.ps_accounts.installer');
// Seems the module is not here, try to install it
$accountsInstaller->install();
$accountsFacade = $this->get('mbo.ps_accounts.facade');
try {
$accountsService = $accountsFacade->getPsAccountsService();
} catch (\Exception $e) {
// Installation seems to not work properly
$accountsService = $accountsFacade = null;
ErrorHelper::reportError($e);
}
}

if (null !== $accountsFacade && null !== $accountsService) {
Expand Down

0 comments on commit a3bd702

Please sign in to comment.