--------------------------------------------------------------------------------------------------------------
Create new control /Modules/HomePageText.ascx
Move current static welcome page text from Default.aspx into HomePageText.ascx.
No code is required but control should be in namespace NopSolutions.NopCommerce.Web.Modules for consistency.
Add the control to default.aspx in place of the existing static content. Use the same tag naming/prefixing as other controls:
To register control:
<%@ Register TagPrefix="nopCommerce" TagName="HomePageText" Src="Modules/HomePageText.ascx" %>
And add the control to the page:
<nopCommerce:HomePageText ID="ctrlHomePageText" runat="server" />
In the code behind (Default.aspx.cs), add the following code to the BindData() event:
bool showWelcomeMessageOnMainPage = SettingManager.GetSettingValueBoolean("Display.ShowWelcomeMessageOnMainPage");
if (!showWelcomeMessageOnMainPage)
{
ctrlHomePageText.Visible = false;
}
Next add a new setting within admin gui in etc settings:
Name: Display.ShowWelcomeMessageOnMainPage
Value: True
Description: Determines whether or not to show the Welcome message content on the home page.
Reason:
As all the other elements of the home page can be controlled within the application (show news / categories etc.) it would be good to have the same configuration for the home page static content.
By moving the static content into an external control it makes it easier to update so that it will not interfere with other elements on the Default.aspx page.
--------------------------------------------------------------------------------------------------------------
All tested working okay.
Ben.