1

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.

4
  • The payment gateway is for e-commerce, therefore a component. These options should not be part of the Global Configuration
    – Lodder
    Commented Dec 10, 2015 at 9:18
  • @Lodder: Thanks for a response. Can you please tell how to add component-based configuration?
    – azeem
    Commented Dec 10, 2015 at 22:34
  • 1
    Have 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.
    – Lodder
    Commented 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.
    – azeem
    Commented Dec 11, 2015 at 0:23

1 Answer 1

3

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');

3
  • 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.
    – azeem
    Commented Dec 14, 2015 at 22:30
  • 1
    Yes, 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
  • Awesome. That is really helpful.
    – azeem
    Commented Dec 16, 2015 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.