Skip to content

Commit

Permalink
fixed language
Browse files Browse the repository at this point in the history
  • Loading branch information
zsoltoroszlany82 committed Oct 29, 2024
1 parent 4584b5c commit 4eb5da8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/upload/catalog/controller/extension/feed/ps_google_sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@ public function index()
$this->load->model('localisation/language');

$languages = $this->model_localisation_language->getLanguages();
$firstLanguage = current($languages);
$defaultLanguage = $firstLanguage['code'];

if (isset($this->request->get['language'])) {
$language = $this->request->get['language'];
$language = $this->config->get('config_language');
$language_id = (int) $this->config->get('config_language_id');
$old_language_id = $language_id;

if (false === in_array($language, array_column($languages, 'code'))) {
$language = $defaultLanguage;
}
} else {
$language = $defaultLanguage;
if (isset($this->request->get['language']) && isset($languages[$this->request->get['language']])) {
$cur_language = $languages[$this->request->get['language']];

$language = $cur_language['code'];
$language_id = $cur_language['language_id'];
}

$this->config->set('config_language_id', $language_id);


$this->xml = new \XMLWriter();
$this->xml->openMemory();
Expand Down Expand Up @@ -127,6 +128,8 @@ public function index()
$this->xml->endElement();
$this->xml->endDocument();

$this->config->set('config_language_id', $old_language_id);

$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($this->xml->outputMemory());

Expand Down

0 comments on commit 4eb5da8

Please sign in to comment.