diff --git a/controllers/admin/AdminAjaxPsxMktgWithGoogleController.php b/controllers/admin/AdminAjaxPsxMktgWithGoogleController.php index 25eab1aed..1f06a5860 100644 --- a/controllers/admin/AdminAjaxPsxMktgWithGoogleController.php +++ b/controllers/admin/AdminAjaxPsxMktgWithGoogleController.php @@ -23,6 +23,7 @@ use PrestaShop\Module\PsxMarketingWithGoogle\Config\Config; use PrestaShop\Module\PsxMarketingWithGoogle\Conversion\EnhancedConversionToggle; use PrestaShop\Module\PsxMarketingWithGoogle\Handler\ErrorHandler; +use PrestaShop\Module\PsxMarketingWithGoogle\Http\HttpClient; use PrestaShop\Module\PsxMarketingWithGoogle\ProductFilter\FilterApplication\ProductEnumerator; use PrestaShop\Module\PsxMarketingWithGoogle\ProductFilter\Options\OptionsProviderInterface; use PrestaShop\Module\PsxMarketingWithGoogle\ProductFilter\Options\Resolver; @@ -32,7 +33,6 @@ use PrestaShop\Module\PsxMarketingWithGoogle\Repository\CurrencyRepository; use PrestaShop\Module\PsxMarketingWithGoogle\Repository\ModuleRepository; use PrestaShop\Module\PsxMarketingWithGoogle\Repository\ProductRepository; -use PrestaShop\ModuleLibFaq\Faq; class AdminAjaxPsxMktgWithGoogleController extends ModuleAdminController { @@ -567,12 +567,21 @@ private function getModuleStatus(array $inputs) */ public function retrieveFaq() { - $faq = new Faq($this->module->module_key, _PS_VERSION_, $this->context->language->iso_code); + $faq = [ + 'categories' => [], + ]; + + $request = new HttpClient('https://api.addons.prestashop.com'); + $result = $request->get('/request/faq/' . $this->module->module_key . '/' . _PS_VERSION_ . '/' . $this->context->language->iso_code, []); + + if ($result->getStatusCode() === 200) { + $faq['categories'] = json_decode($result->getBody(), true); + } $this->render( json_encode( [ - 'faq' => $faq->getFaq(), + 'faq' => $faq['categories'], 'doc' => $this->getUserDocumentation(), 'contactUs' => 'support-google@prestashop.com', ] diff --git a/controllers/admin/AdminPsxMktgWithGoogleModuleController.php b/controllers/admin/AdminPsxMktgWithGoogleModuleController.php index faaacf47e..6de157524 100644 --- a/controllers/admin/AdminPsxMktgWithGoogleModuleController.php +++ b/controllers/admin/AdminPsxMktgWithGoogleModuleController.php @@ -86,7 +86,11 @@ public function initContent() // from google response if (Tools::getValue('message') !== false || Tools::getValue('from') !== false) { $this->ajax = true; - $this->content = $this->context->smarty->fetch('module:psxmarketingwithgoogle/views/templates/admin/googlePopin.tpl'); + if (version_compare(_PS_VERSION_, '9.0.0', '>=')) { + $this->content = $this->context->smarty->display($this->module->getLocalPath() . '/views/templates/admin/googlePopin.tpl'); + } else { + $this->content = $this->context->smarty->fetch('module:psxmarketingwithgoogle/views/templates/admin/googlePopin.tpl'); + } return; }