Can we customize global configurations ( configuration.php ) to add custom parameters? . As it stores DB / FTP settings, I want to add payment gateway configurations. If there is a way to add configuration / parameters in a component then that will be helpful as well.
-
The payment gateway is for e-commerce, therefore a component. These options should not be part of the Global Configuration– LodderCommented Dec 10, 2015 at 9:18
-
@Lodder: Thanks for a response. Can you please tell how to add component-based configuration?– azeemCommented Dec 10, 2015 at 22:34
-
1Have a read through the Joomla documentation. I would however strongly suggest you don't start building up a Joomla 1.5 site as this version is old and unsupported.– LodderCommented Dec 10, 2015 at 23:02
-
@Lodder: If I was able to find relevant documentation, I was not going to post a question. Thanks anyway.– azeemCommented Dec 11, 2015 at 0:23
1 Answer
First: Use a current Joomla. Your 1.5 site will be hacked in no time.
Second - the answer (Joomla 2.x - 3.x):
You can add component params to the component configuration. (You can access the component config in the backend. Just navigate to the component and click the option button in the toolbar.)
How to add / extend component params:
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_configuration/en
Access the params in the fronted view:
$params = JComponentHelper::getParams('com_yourcomponent');
$test = $params->get('param_name');
-
You are right but in order to move to a newer version, You need to clean existing code so that migration should be easy and much painless. The system in question contains highly customized code. If there is configuration parameter like payment processor settings / some API settings which is being used by component and module, Will you save that in a component? For configuration like DB settings which can be used across the site, there is a configuration file.– azeemCommented Dec 14, 2015 at 22:30
-
1Yes, because Joomla is a CMS and not a shop. So the global config contains only system relevant data. I would store payment processor settings in the DB and not in a file, therefore the code is untouched and that is what you can archive with my answer above. Joomla stores component params in the DB and you can load those params via JComponentHelper everywhere. If you still want a config file, just create your own in the root and load it into your component, module, plugin etc. ( require_once (JPATH_SITE.'/myglobal_config.php' ); ) Commented Dec 15, 2015 at 11:35
-