Post by scottyboyyy » Fri Feb 03, 2023 1:32 am

I'm trying to access what the default language set to a store within Stores - Settings - local (tab) - language, here it can be set to any language but I can't find how to access it or where it is stored in the database.

This just gets the current language:

Code: Select all

But I want to access the language it is set to within admin settings.

Anyone know? :D



Active Member


Fri Apr 07, 2017 2:36 am

Post by TMD Extension @ » Fri Feb 03, 2023 12:25 pm

get the current language from the session

from the database get the list of languages

or just print the current language code
echo $this->language->get('code')

You can use all these codes to get the language of the OpenCart Store


Thanks & Regards
Sehaj Kaur
TMD Extensions
Contact Us For Customisations

Active Member


Thu Mar 17, 2022 12:59 pm

Post by by mona » Fri Feb 03, 2023 9:11 pm

Yes the above and to add to that ..

Code: Select all

gets all the languages you support in an array

Code: Select all

gets the language code from the client cookie (if set)

Code: Select all

gets the current language id

Code: Select all

gets the current language code (if set)

Code: Select all

gets your store's default language code (as set in admin)

All of these are used in the language part of catalog/controller/startup/startup.php
on every request, in order:
1) use the language stored in the session if present
2) otherwise use the language stored in the cookie if present
3) otherwise use the language set in the client language-accept header if present and supported
4) otherwise use the default language as set in admin
5) store the language code in the session and the language id in config

You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.

User avatar
Expert Member


Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: avsrthe and 11 guests