Code: Select all
[[ConLib:CategoryMenuEx]]
Code: Select all
[[ConLib:CategoryMenuEx]]
Code: Select all
<div class="pageHeader">
<div class="caption">
<h1>
<asp:Localize ID="Caption" runat="server" Text="Categories"></asp:Localize>
</h1>
</div>
</div>
<div style="clear: both; margin-top: 6px;">
<asp:Menu ID="CategoryMenu" runat="server" Orientation="Horizontal" BackColor="#E3EAEB" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#666666" StaticSubMenuIndent="10px">
<StaticSelectedStyle BackColor="#1C5E55" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#666666" ForeColor="White" />
<DynamicMenuStyle BackColor="#E3EAEB" />
<DynamicSelectedStyle BackColor="#1C5E55" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="#666666" ForeColor="White" />
</asp:Menu>
</div>
Code: Select all
<asp:Menu ID="CategoryMenu" runat="server" Orientation="Horizontal" BackColor="#E3EAEB" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#666666" StaticSubMenuIndent="10px">
<StaticSelectedStyle BackColor="#1C5E55" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#666666" ForeColor="White" />
<DynamicMenuStyle BackColor="#E3EAEB" />
<DynamicSelectedStyle BackColor="#1C5E55" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="#666666" ForeColor="White" />
</asp:Menu>
Code: Select all
private void PopulateMenuItem(MenuItem parentMenu,int categoryId)
{
CategoryCollection children = new CategoryCollection();
CatalogNodeCollection otherNodes = new CatalogNodeCollection();
CatalogNodeCollection nodes = CatalogNodeDataSource.LoadForCategory(categoryId);
foreach (CatalogNode node in nodes)
{
if (node.CatalogNodeType == CatalogNodeType.Category)
children.Add((Category)node.ChildObject);
else
otherNodes.Add(node);
}
foreach (Category child in children)
{
MenuItem menuItem = new MenuItem();
menuItem.Text = child.Name;
menuItem.Value = child.CategoryId.ToString();
if (CategoryDataSource.CountForParent(child.CategoryId) > 1)
PopulateMenuItem(menuItem, child.CategoryId);
menuItem.NavigateUrl = child.NavigateUrl;
parentMenu.ChildItems.Add(menuItem);
foreach (CatalogNode node in otherNodes)
{
menuItem = new MenuItem();
menuItem.Text = node.Name;
menuItem.Value = node.CatalogNodeId.ToString();
menuItem.NavigateUrl = node.NavigateUrl;
parentMenu.ChildItems.Add(menuItem);
}
}
Code: Select all
<table id="storeHeader" cellpadding="0" cellspacing="0">
<tr>
<td class="logo">
<a href="~/Default.aspx">[[ConLib:StoreLogo]]</a>
</td>
<td class="headerContent" align="right" valign="top">
<div class="shortcuts">
#if($customer.IsAnonymous)
<a href="~/Login.aspx" class="login">Login</a>
#else
<a href="~/Logout.aspx" class="login">Logout</a>
#end
<a href="~/Members/MyAccount.aspx" class="acct">Account</a>
<a href="~/Members/MyWishlist.aspx" class="wishlist">Wishlist</a>
<a href="~/Basket.aspx" class="basket">Basket</a>
#if($customer.IsAdmin)
<a href="~/Admin/Default.aspx" class="admin">Admin</a>
#end
</div>
<div class="search">
[[ConLib:SimpleSearch]]
</div>
</td>
</tr>
<tr>
<td class="navigation" colspan="2">
<div class="content" style="float:left;">
<a href="~/Default.aspx" class="tab">Home</a>
<a href="~/Search.aspx" class="tab">Product Finder</a>
<a href="~/AdvancedSearch.aspx" class="tab">Advanced Search</a>
#if ($store.Currencies.Count > 1 )
<a href="~/Currencies.aspx" class="tab">Currencies</a>
#end
<a href="~/ContactUs.aspx" class="tab">Contact Us</a>
</div>
</td>
</tr>
<tr>
<td style="background-color: #1C5E55">
<div style="float: left;">
[[Conlib:Custom\CategoryMenuEx]]
</td>
</tr>
</div>
</table>
Code: Select all
<tr>
<td style="background-color: #1C5E55">
<div style="float: left;">
[[Conlib:Custom\CategoryMenuEx]]
</td>
</tr>
</div>
</table>
Code: Select all
<tr>
<td style="background-color: #1C5E55" colspan="2">
<div style="float: left;">
[[Conlib:Custom\CategoryMenuEx]]
</div>
</td>
</tr>
</table>
Code: Select all
<script runat="server">
................
.................
</script>
Code: Select all
<script runat="server">
int _CategoryId;
int[] _BannedCategories = new int[] { 5,8,9 };
System.Collections.ArrayList _BannedCategoriesList = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
_CategoryId = PageHelper.GetCategoryId();
if (!Page.IsPostBack)
{
_BannedCategoriesList.AddRange(_BannedCategories);
PopulateMenu();
}
}
private void PopulateMenu()
{
CategoryMenu.Items.Clear();
CategoryCollection children = CategoryDataSource.LoadForParent(0, true);
foreach (Category child in children)
{
if (_BannedCategoriesList.Contains(child.CategoryId))
continue;
MenuItem menuItem = new MenuItem();
menuItem.Text = child.Name;
menuItem.Value = child.CategoryId.ToString();
menuItem.NavigateUrl = child.NavigateUrl;
if (CategoryDataSource.CountForParent(child.CategoryId) > 0)
PopulateMenuItem(menuItem, child.CategoryId);
CategoryMenu.Items.Add(menuItem);
}
CategoryMenu.DataBind();
}
private void PopulateMenuItem(MenuItem parentMenu,int categoryId)
{
CategoryCollection children = CategoryDataSource.LoadForParent(categoryId, true);
foreach (Category child in children)
{
if (_BannedCategoriesList.Contains(child.CategoryId))
continue;
MenuItem menuItem = new MenuItem();
menuItem.Text = child.Name;
menuItem.Value = child.CategoryId.ToString();
if (CategoryDataSource.CountForParent(child.CategoryId) > 1)
PopulateMenuItem(menuItem, child.CategoryId);
menuItem.NavigateUrl = child.NavigateUrl;
parentMenu.ChildItems.Add(menuItem);
}
}
</script>
Code: Select all
int[] _BannedCategories = new int[] { 5,8,9 };
Code: Select all
int[] _BannedCategories = new int[] { 5,8,9 };
System.Collections.ArrayList _BannedCategoriesList = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
_CategoryId = PageHelper.GetCategoryId();
if (!Page.IsPostBack)
{
_BannedCategoriesList.AddRange(_BannedCategories);
PopulateMenu();
}
}
Code: Select all
int[] _BannedCategories = new int[] { 5,8,9,10 };
Code: Select all
<%@ Control Language="C#" ClassName="CategoryMenuEx" %>
<script runat="server">
int _CategoryId;
int[] _BannedCategories = new int[] { 5,8,9 };
System.Collections.ArrayList _BannedCategoriesList = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
_CategoryId = PageHelper.GetCategoryId();
if (!Page.IsPostBack)
{
_BannedCategoriesList.AddRange(_BannedCategories);
PopulateMenu();
}
}
private void PopulateMenu()
{
CategoryMenu.Items.Clear();
CategoryCollection children = CategoryDataSource.LoadForParent(0, true);
foreach (Category child in children)
{
if (_BannedCategoriesList.Contains(child.CategoryId))
continue;
MenuItem menuItem = new MenuItem();
menuItem.Text = child.Name;
menuItem.Value = child.CategoryId.ToString();
menuItem.NavigateUrl = child.NavigateUrl;
if (CategoryDataSource.CountForParent(child.CategoryId) > 0)
PopulateMenuItem(menuItem, child.CategoryId);
CategoryMenu.Items.Add(menuItem);
}
CategoryMenu.DataBind();
}
private void PopulateMenuItem(MenuItem parentMenu,int categoryId)
{
CategoryCollection children = CategoryDataSource.LoadForParent(categoryId, true);
foreach (Category child in children)
{
if (_BannedCategoriesList.Contains(child.CategoryId))
continue;
MenuItem menuItem = new MenuItem();
menuItem.Text = child.Name;
menuItem.Value = child.CategoryId.ToString();
if (CategoryDataSource.CountForParent(child.CategoryId) > 1)
PopulateMenuItem(menuItem, child.CategoryId);
menuItem.NavigateUrl = child.NavigateUrl;
parentMenu.ChildItems.Add(menuItem);
}
}
</script>
<div class="pageHeader">
<div class="caption">
<h1>
<asp:Localize ID="Caption" runat="server" Text="Categories"></asp:Localize>
</h1>
</div>
</div>
<div style="clear: both; margin-top: 6px;">
<asp:Menu ID="CategoryMenu" runat="server" Orientation="Horizontal" BackColor="#E3EAEB" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#666666" StaticSubMenuIndent="10px">
<StaticSelectedStyle BackColor="#1C5E55" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#666666" ForeColor="White" />
<DynamicMenuStyle BackColor="#E3EAEB" />
<DynamicSelectedStyle BackColor="#1C5E55" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
BackColor="#FF9933" />
<StaticHoverStyle BackColor="#666666" ForeColor="White" />
</asp:Menu>
</div>
Code: Select all
int[] _BannedCategories = new int[] { 5,8,9 };
Code: Select all
int[] _BannedCategories = new int[] { };