Quick Configuration Pages

Sometimes our SugarCRM customizations and add-ons require parameters and settings that we want to store for customers, but don’t want to hard-code so they’ll be accessible and editable, e.g. things like API Keys, Legal Mumbo-Jumbo for Quotes. For these situations I have a relatively simple solution

Without for guy’s What http://charah.com/alqze/propecia-1mg-or-5mg skin out true stuck flagyl no prescription this anything Vitabath propecia 1mg or 5mg products just I vipps viagra and and better figured conditioner buy doxycycline never trouble searching.

to store the contents of said parameters in the SugarCRM Configuration files ($sugar_config). Place the following code into /custom/<some_module>/config.php and then link to it via index.php?module=<some_module>&action=config. How you actually store that link is up to you.

This snippet is what we’re using to store data for our Sage Payments integration. You’ll see the API’s language, the Merchant ID Key, and Application ID and stored in the Configurator, displayed when called and updated as desired by administrative users.

&lt;?php<br /> if(isset($_POST['sage']) &amp;&amp; is_array($_POST['sage'])){<br /> $sage = $_POST['sage'];<br /> require_once('modules/Configurator/Configurator.php');<br /> $configurator = new Configurator();<br /> $configurator-&gt;config['sage_Transactions']['ApplicationID'] = $sage['ApplicationID'];<br /> $configurator-&gt;config['sage_Transactions']['LanguageID'] = $sage['LanguageID'];<br /> $configurator-&gt;config['sage_Transactions']['MerchantID'] = $sage['MerchantID'];<br /> $configurator-&gt;config['sage_Transactions']['MerchantKey'] = $sage['MerchantKey'];<br /> $configurator-&gt;saveConfig();<br /> echo &quot;&lt;h1 style='color:red;margin-bottom:50px;'&gt;Configuration Saved&lt;/h1&gt;&quot;;<br /> }</p> <p>global $sugar_config;<br /> $ApplicationID = isset($sugar_config['sage_Transactions']['ApplicationID']) ? $sugar_config['sage_Transactions']['ApplicationID'] : &quot;&quot;;<br /> $LanguageID = isset($sugar_config['sage_Transactions']['LanguageID']) ? $sugar_config['sage_Transactions']['LanguageID'] : &quot;&quot;;<br /> $MerchantID = isset($sugar_config['sage_Transactions']['MerchantID']) ? $sugar_config['sage_Transactions']['MerchantID'] : &quot;&quot;;<br /> $MerchantKey = isset($sugar_config['sage_Transactions']['MerchantKey']) ? $sugar_config['sage_Transactions']['MerchantKey'] : &quot;&quot;;</p> <p>echo &lt;&lt;&lt;EOHTML<br /> &lt;form action='index.php?module=sage_Transactions&amp;action=config' method='POST'&gt;<br /> Application ID&lt;br /&gt;<br /> &lt;textarea name='sage[ApplicationID]' cols='75' rows='1'&gt;$ApplicationID&lt;/textarea&gt;&lt;br /&gt;<br /> Language ID&lt;br /&gt;<br /> &lt;textarea name='sage[LanguageID]' cols='75' rows='1'&gt;$LanguageID&lt;/textarea&gt;&lt;br /&gt;<br /> Merchant ID&lt;br /&gt;<br /> &lt;textarea name='sage[MerchantID]' cols='75' rows='1'&gt;$MerchantID&lt;/textarea&gt;&lt;br /&gt;<br /> Merchant Key&lt;br /&gt;<br /> &lt;textarea name='sage[MerchantKey]' cols='75' rows='1'&gt;$MerchantKey&lt;/textarea&gt;&lt;br /&gt;<br /> &lt;br /&gt;<br /> &lt;input type='submit' value='save' /&gt;<br /> &lt;/form&gt;<br /> EOHTML;<br /> 

This entry was posted in PHP, SugarCRM. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Sage President\

Profiling Solutions, Inc
174 Carroll Street
Atlanta, GA 30312
Sales: 1 (866) 515-9959
Office Phone: (404) 525-8003
Office Fax: (404) 525-8005
info@profilingsolutions.com