KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: DaveO on August 23, 2010, 11:29:21 pm

Title: Best way to add properties to the application
Post by: DaveO on August 23, 2010, 11:29:21 pm
I need to add some custom properties to the application (URLs, IDs, etc...) and I am wondering what the best way to do this is. Is there a build-in mechanism for this or should I just add a new properties file and load it somehow when the application starts?

Thanks!
Title: Re: Best way to add properties to the application
Post by: ming on August 24, 2010, 05:50:00 pm
If you want these to be configuration variables in the database you can add these with a little SQL - see the konakart_demo.sql scripts for examples.

Here's an example for convenience:


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Warn of Duplicate SKUs', 'ADMIN_APP_WARN_OF_DUPLICATE_SKUS', 'false', 'Issue warning in Admin App of duplicate SKUs', '21', '32', 'choice(\'true\', \'false\')', now());


Note that if you do this these will automatically appear to the KonaKart Admin Application for subsequent modification.

Just make sure you set the configuration_group_Id to the group that's most relevant and almost as if by magic ( :o) your new config variales will appear in the same panels as the others in that Group.

Naturally, you will then be able to access these config variables using the KonaKart APIs from your code.
Title: Re: Best way to add properties to the application
Post by: DaveO on August 25, 2010, 09:15:33 pm
That worked great, thanks for the help!
Title: Re: Best way to add properties to the application
Post by: DaveO on September 20, 2010, 11:13:02 pm
One more question - is it also possible to add a new configuration group for my custom properties and have it show up as a menu item?

Thanks
Title: Re: Best way to add properties to the application
Post by: Brian on September 21, 2010, 05:54:41 am
No, that won't create a new menu item.