0

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 – Lodder Dec 10 '15 at 9:18
  • @Lodder: Thanks for a response. Can you please tell how to add component-based configuration? – azeem Dec 10 '15 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 Dec 10 '15 at 23:02
  • @Lodder: If I was able to find relevant documentation, I was not going to post a question. Thanks anyway. – azeem Dec 11 '15 at 0:23
2

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. – azeem Dec 14 '15 at 22:30
  • 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' ); ) – Dennis Heiden Dec 15 '15 at 11:35
  • Awesome. That is really helpful. – azeem Dec 16 '15 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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