Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decrypt/use config values stored as config_backend_encrypted in magento

Tags:

I'm working on a shipping module. In system.xml I set some fields to be backend_encrypted. Here is the node:

<client_id translate="label">      <label>Client ID</label>      <frontend_type>obscure</frontend_type>      <backend_model>adminhtml/system_config_backend_encrypted</backend_model>      <sort_order>10</sort_order>      <show_in_default>1</show_in_default>      <show_in_website>1</show_in_website>      <show_in_store>0</show_in_store> </client_id> 

I need that value to pass using cURL to shipping API but, when I try to retrieve it using $this->getConfigData('client_id');, it come out encrypted.

I was looking in other modules and I see values stored the same but somehow, they manage to get the right value.

Any idea how to get it?

like image 975
Ovidiu Avatar asked Dec 20 '11 13:12

Ovidiu


1 Answers

In order to use $this->getConfigData('client_id'); without manually decrypting it, you need to update your config.xml by adding <client_id backend_model="adminhtml/system_config_backend_encrypted" />, see example below

In your config.xml

...     <default>         <carriers>             <magepal>                 ......                 <client_id backend_model="adminhtml/system_config_backend_encrypted" />             </magepal>         </carriers>     </default> </config> 
like image 97
Renon Stewart Avatar answered Sep 27 '22 20:09

Renon Stewart