Search code examples
configvqmodopencart2.3

Opencart vqmod 2.3.0.2 $config error


i have just installed opencart 2.3.0.2 and vqmod but i am facing a problem now. In previous version of opencart when i was using the below code in vqmod xml file

global $config;
$variableA =  $config->get('field_value');

then in $variableA i got the value which i saved in the db from admin section but now in 2.3.0.2 when i use this code it shows fatal error

Fatal error: Call to a member function get() on null 

please tell me how can i get the value in vqmod xml file so i can use this variable further

Thanks


Solution

  • Define the variable in a file controller first:

    $data['variableA'] = $this->config->get('variableA');

    then (for example) echo the variable in a view file:

    <?php echo $variableA; ?>