Alright...in order to get Vectors and Genres up and running, you'll need the following files:
- Admin/entityEditProducts.aspx.cs
- App_Code/TemplateBase.cs
- skins/Skin_#/menuData.xml
- Admin/skins/Skin_#/menuData.xml
- ASPDNSFCommon/SiteMapComponentArt.cs (needed to add Genres and Vectors to the site map...only available with full source code)
First, let's make sure that genres and vectors can be viewed in the admin section. In the admin/skins/Skin_#/menuData.xml file, add these two lines
Code:
<item Text="(!admin.menu.Genres!)" NavigateUrl="entityframe.aspx?entityname=genre" LookId="TopItemLook" />
<item Text="(!admin.menu.Vectors!)" NavigateUrl="entityframe.aspx?entityname=vector" LookId="TopItemLook" />
Next, let's make sure customers browsing the front end can access genres and vectors from the top, horizontal nav menu. In the skins/Skin_#/menuData.xml file, add these two lines
Code:
<item Text="(!menu.Genres!)" LookId="TopItemLook" />
<item Text="(!menu.Vectors!)" LookId="TopItemLook" />
Now let's make sure that customers can navigate the front end menu items (eg. the vectors and sub-vectors will dropdown under the main menu header like the existing entities). This will also take care of the expanding menu in the admin section. Open the App_Code/TemplateBase.cs file. Find a section of code in private void Page_Load that is for distributors
Code:
// Find Distributors menu top
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Distributors!)']");
tblMgr = AppLogic.DistributorEntityHelper.m_TblMgr;
if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize())
{
AddEntityMenuXsl(doc, "Distributors", tblMgr, mNode, 0, String.Empty);
}
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Distributors0!)']");
if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize())
{
AddEntityMenuXsl(doc, "Distributors", tblMgr, mNode, 0, "TopItemLook");
}
and underneath this add the following lines of code:
Code:
// Find Genres menu top
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Genres!)']");
AddEntityMenuXsl(doc, "Genre", AppLogic.GenreEntityHelper.m_TblMgr, mNode, 0, String.Empty);
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Genres0!)']");
AddEntityMenuXsl(doc, "Genre", AppLogic.GenreEntityHelper.m_TblMgr, mNode, 0, "TopItemLook");
// Find Vectors menu top
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Vectors!)']");
AddEntityMenuXsl(doc, "Vector", AppLogic.VectorEntityHelper.m_TblMgr, mNode, 0, String.Empty);
mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Vectors0!)']");
AddEntityMenuXsl(doc, "Vector", AppLogic.VectorEntityHelper.m_TblMgr, mNode, 0, "TopItemLook");
Now let's make sure that when the product is added from the admin section, it maps properly when being added. Open the Admin/entityEditProducts.aspx.cs file and find protected void LoadContent(). About part way down you'll find the beginning of a rather large if statement
Code:
if (Editing)
{
TabStrip1.Tabs[TabStrip1.Tabs.Count - 1].Visible = false;
this.phAllVariants.Visible = true;
this.phAddVariant.Visible = false;
SetVariantButtons();
....
....
You'll need to get to the else part of this
Code:
else
{
TabStrip1.Tabs[TabStrip1.Tabs.Count - 1].Visible = true;
this.phAllVariants.Visible = false;
this.phAddVariant.Visible = true;
divltStatus2.Visible = false;
ltStatus.Text = "Adding Product";
btnSubmit.Text = "Add New";
....
....
Near the bottom of this else statement you'll find a section for mappings and in this section there is an affiliate section
Code:
//Affiliate
if (eName.Equals("AFFILIATE", StringComparison.InvariantCultureIgnoreCase))
{
foreach (ListItem li in cblAffiliates.Items)
{
if (li.Value.Equals(eID.ToString()))
{
li.Selected = true;
}
}
}
Under this you'll need to add the following
Code:
//Genre
if (eName.Equals("GENRE", StringComparison.InvariantCultureIgnoreCase))
{
foreach (ListItem li in cblGenres.Items)
{
if (li.Value.Equals(eID.ToString()))
{
li.Selected = true;
}
}
}
//Vector
if (eName.Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase))
{
foreach (ListItem li in cblVectors.Items)
{
if (li.Value.Equals(eID.ToString()))
{
li.Selected = true;
}
}
}
Now, to include vectors and genres in the sitemap (if you have the full source code version). Open up the ASPDNSFCommon/SiteMapComponentArt.cs file. In public SiteMapComponentArt you'll find some if statements that look like
Code:
if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowCategories"))
and
Code:
if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowSections"))
After one of these if blocks, you can add the following code
Code:
if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowVectors"))
{
// Categories:
String s = AppLogic.LookupHelper("Vector").GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250);
if (s.Length != 0)
{
if (AppLogic.IsAdminSite)
{
tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.VectorPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"entityframe.aspx?entityname=category\">\n");
}
else
{
tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.VectorPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
}
tmpS.Append(s);
tmpS.Append("</node>");
}
}
if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowGenres"))
{
// Categories:
String s = AppLogic.LookupHelper("Genre").GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250);
if (s.Length != 0)
{
if (AppLogic.IsAdminSite)
{
tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.GenrePromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"entityframe.aspx?entityname=genre\">\n");
}
else
{
tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.GenrePromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
}
tmpS.Append(s);
tmpS.Append("</node>");
}
}
Then recompile the ASPDNSFCommon project, and upload the new AspDotNetStorefrontCommon.dll to your site's /bin directory (after a backup of the original of course
). The create 2 new appconfig parameters called SiteMap.ShowGenres and SiteMap.ShowVectors, and set both of these appconfig values to true. The genres and vectors should then be showing in your sitemap.
See screenshots for results
The navigation arrows are difficult to screenshot, but these also properly navigate through the vectors/genres and the products that are mapped to them.