Ka Extensions for OpenCart 3

This documentation applies to Ka Extensions for OpenCart 3.x only. It is not compatible with OpenCart 4.

HiddenSettings
in component

Hidden values of a module in the admin area and in the catalog: the installed version, counters and other values that are not fields of the module settings page.

The values are stored in the OpenCart setting table of the default store (store_id 0) in the group '<ext_code>_hidden' under the keys '<ext_code>hidden', the same way as getConfigHidden() and setConfigHidden() of the admin setting model store them. Arrays are stored as JSON (serialized = 1) as OpenCart does. Every method reads or writes one key only, other values of the group are not touched, so saving the module settings page or another key does not overwrite a counter.

The values are loaded into the store config at the start of a request like other settings ('<ext_code>hidden'), the methods below always read the database.

Example:

use \extension\ka_extensions\HiddenSettings;

HiddenSettings::set('mymodule', 'last_run', date('Y-m-d'));
$last_run = HiddenSettings::get('mymodule', 'last_run');      // '2026-10-28'
$requests = HiddenSettings::increase('mymodule', 'requests'); // atomic +1, the new value

Table of Contents

Methods

get()  : mixed
Returns the hidden value $key of the module or $default when it is not stored.
increase()  : mixed
Adds $add to a numeric hidden value with one UPDATE (value = value + $add), so parallel requests
do not lose increments. A missing value is created with $add. Returns the new value.
set()  : mixed
Stores one hidden value of the module, other values are kept. Arrays are stored as JSON,
other values as strings. A null value removes the key.

Methods

get()

Returns the hidden value $key of the module or $default when it is not stored.

public static get(mixed $ext_code, mixed $key[, mixed $default = null ]) : mixed
Parameters
$ext_code : mixed
$key : mixed
$default : mixed = null

increase()

Adds $add to a numeric hidden value with one UPDATE (value = value + $add), so parallel requests do not lose increments. A missing value is created with $add. Returns the new value.

public static increase(mixed $ext_code, mixed $key[, mixed $add = 1 ]) : mixed
Parameters
$ext_code : mixed
$key : mixed
$add : mixed = 1

set()

Stores one hidden value of the module, other values are kept. Arrays are stored as JSON, other values as strings. A null value removes the key.

public static set(mixed $ext_code, mixed $key, mixed $value) : mixed
Parameters
$ext_code : mixed
$key : mixed
$value : mixed

        
On this page

Search results