URGENT!: Adding a new setting to the GlobalSettings section

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
How would i go about adding a new setting, say "Show Category Navigation", to the global settings in the admin section under the 'other' tab.

Any suggestion please.

Thanks
13 years ago
kiwimediapro wrote:
How would i go about adding a new setting, say "Show Category Navigation", to the global settings in the admin section under the 'other' tab.

Any suggestion please.

Thanks


What are you trying to achieve?  If you want to edit the global settings tab you can edit Administration > modules > globalsettings.ascx
13 years ago
Thanks for the reply.

For some reason i did not receive an email saying you replied but in answer to your question...

I want to extend the UI to allow us to hide the Category Navigation in the side menu. SO I presumed the best way to do this would be to add it to the Global settings page. I have failed to determine though how the code for this page works.

Can you explain how to add such a setting to the global settings page under the other tab so my we can hide the category navigation.

Thanks
13 years ago
Can anyone help me with this. I have had to leave it until now.
13 years ago
Do you need to make it configurable?

if you simply require to hide it, look in the folder ' masterpages' and edit twocolumn.master and threeColumn.master


in admin, you could also go and unpublish the categories
13 years ago
Thx for replying.

I need to be able to add to the global settings admin section.

Also how is this coded up?
$NopResources:Admin.GlobalSettings.Profiles.FormFields.PhoneEnabled.Tooltip

Thx
13 years ago
Does anyone know how to answer this plz?
13 years ago
What version are you using?  Also, is this what you are trying to do?

Enable/Disable (the viewing of) the category navigation box through a global setting on the admin side?

t
13 years ago
Thx for your reply

Version 1.8

And yes I am trying to enable/disable the category navigation on the sidebar by implementing a setting under global settings.

In fact I wouuld like to be able to add further settings to the global settings section but how?

I dont seem to understand how the NopResource delarative thing works either.

Thx
13 years ago
Ok.  That clears a few things up.

Most of the settings found in the admin area are simple strings that correspond to some arbitrary value.  What makes this approach powerful for customization is that you are not stuck using a single convention.  Open up all settings and you can see the long list of settings that correspond to strings, boolean values, integers, etc.  This allows you to setup a configuration type setting in anyway you want.

For your example you could create a new setting and call it something like, "Display.ShowCategoryNavigation".  You would then set it's value to true or false based on your needs.  However, this will only register the setting you would need to wire it up.

A quick and dirty example would be to override the OnInit event in /modules/categorynavigation.ascx.cs.  Like this:

protected override void OnInit(EventArgs e)
        {
            if (SettingManager.GetSettingValueBoolean("Display.ShowCategoryNavigation") == false)
            {
                this.Visible = false;
            }
        }


You would also need to reference NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.

As you can see there are countless ways in which you can use admin settings.  All you have to do is wire up your logic in the appropriate place and call the SettingManager.

Hope this helps.

EDIT:  I just noticed you wanted to make this setting available under Global Settings.  The solution I have above has the setting only in 'All Settings'.  If you wanted to make it available under the former then a little more work would be necessary.  Basically what you would have to do is either make a new control tab and then wire a checkbox to your setting or just add a checkbox and the wiring in a existing tab.  NOTE: You will find most of the tab names have corresponding control names in /admin/modules.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.