Page 1 of 1
Custom Category Page
Posted: Mon Sep 01, 2008 4:28 pm
by Brewhaus
We are working on a recipe page for customers, and have found that AC works extremely well with very little customizing. In fact, one tiny adaptation has the recipe pages working well, but we need to customize a category page to suit this.
It seems that only on CategoryGrid4 does the description field show up, but we would like to use a simple list of the 'products' in the category (similar to CategoryList, but without the SKU, Manufacturer, or Price fields). Can anyone help us on this? I assume that the simplest option would be to add the Description field to the CategoryList file, and remove the SKU and other fields that we do not want.
Re: Custom Category Page
Posted: Wed Sep 03, 2008 2:17 am
by mazhar
For this copy make copy of
ConLib/CategoryList control rename it to your desired. Then in .cs file locate and the
Page_Load method and make it look like
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(CssClass)) MainPanel.CssClass = CssClass;
if (!string.IsNullOrEmpty(HeaderCssClass)) HeaderPanel.CssClass = HeaderCssClass;
if (!string.IsNullOrEmpty(HeaderText)) HeaderTextLabel.Text = HeaderText;
if (!string.IsNullOrEmpty(ContentCssClass)) ContentPanel.CssClass = ContentCssClass;
if (_CategoryId < 0) _CategoryId = PageHelper.GetCategoryId();
CatalogNodeCollection nc = CatalogNodeDataSource.LoadForCategory(3);
ProductCollection pc = new ProductCollection();
if (nc.Count > 0)
{
foreach (CatalogNode cn in nc)
if (cn.CatalogNodeType == CatalogNodeType.Product)
{
Product p = ProductDataSource.Load(cn.CatalogNodeId);
pc.Add(p);
}
}
CategoryList.DataSource = pc;
CategoryList.DataBind();
}
the edit the aspx file and make it look like
Code: Select all
<asp:Panel ID="MainPanel" runat="server" CssClass="section">
<asp:Panel ID="HeaderPanel" runat="server" CssClass="header">
<h2 class="header"><asp:Localize ID="HeaderTextLabel" runat="server" Text="Categories"></asp:Localize></h2>
</asp:Panel>
<asp:Panel ID="ContentPanel" runat="server" CssClass="content">
<asp:Repeater ID="CategoryList" runat="server">
<HeaderTemplate>
<ul class="category">
</HeaderTemplate>
<ItemTemplate>
<li>
<table>
<tr>
<td>
<asp:HyperLink ID="CategoryLink" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#Eval("NavigateUrl")%>'></asp:HyperLink>
</td>
<td>
<%#Eval("Description")%>
</td>
</tr>
</table>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</asp:Panel>
</asp:Panel>
Re: Custom Category Page
Posted: Sun Sep 07, 2008 7:01 pm
by Brewhaus
Thank you. I realized a big problem, though. As this is really just a category page, if I change it then it also changes all of the other category pages. My only solution is likely to create a special page that links to the recipes so that I can design it differently.
Re: Custom Category Page
Posted: Sun Sep 07, 2008 8:36 pm
by mazhar
Sure... you can do i just floated an idea