Search code examples
phpjoomlajoomla2.5joomla3.0joomla-extensions

How to Get Params Value in Joomla


I Need to Get Dob Params in Joomla

Params in DB

{"dob":{"label":"Date of Birth","value":"27-11-1987"},"email":{"label":"Email","value":"asktokaje007@gmail.com"}}

My code :

$params = new JRegistry();

$params->loadString($orderinfo->all_billing);

$processed_variables['test123'] = $params->get('dob' ,'value');

Solution

  • Second parameter for get is for default value, not for key.

    $params->get('dob'); will give you stdClass object.

    So:

    $dob = $params->get('dob');
    $processed_variables['test123'] = $dob->value;
    

    Is probably what you are looking for. Remember to check if there exists key like value. If you won't check it and it dosen't exist, you will get an error.