How to Add Settings

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sfj
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Tue Apr 22, 2008 9:19 pm

How to Add Settings

Post by sfj » Tue Jan 06, 2009 3:21 am

Whats the best way add system wide settings.

For example, we are adding a new type of image, (instead of icon, thumbnail, and standard) we are adding type 'large'

The width and height, I would like placed somewhere in the control panel, how later can I access it?

(Without modifying the source code, meaning the framework)

Right now it is hard coded...

SFJ

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: How to Add Settings

Post by mazhar » Tue Jan 06, 2009 4:30 am

Whats the best way add system wide settings.
You can create a store setting for this purpose. Look the code posted here for store settings page. It will provide you a good sample to start with.
viewtopic.php?f=42&t=8835
The store setting page is updated to incorporate a new bool type system wide setting that will flag an address setting.

You can add or update some setting in store settings as below

Code: Select all

Token.Instance.Store.Settings.SetValueByKey("setting_name", "your value");
You can get a setting value out as below

Code: Select all

string settingValue = Token.Instance.Store.Settings.GetValueByKey("setting_name");

Post Reply