Skip to content

Commit

Permalink
Merge pull request #1844 from PoulainMaxime/fix/v9-issues
Browse files Browse the repository at this point in the history
fix: faq & popup google login
  • Loading branch information
PoulainMaxime authored Jan 21, 2025
2 parents 3c89a69 + 723d085 commit 1fe8051
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 12 additions & 3 deletions controllers/admin/AdminAjaxPsxMktgWithGoogleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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' => '[email protected]',
]
Expand Down
6 changes: 5 additions & 1 deletion controllers/admin/AdminPsxMktgWithGoogleModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1fe8051

Please sign in to comment.