Custom Category Page

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Custom Category Page

Post by Brewhaus » Mon Sep 01, 2008 4:28 pm

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Custom Category Page

Post by mazhar » Wed Sep 03, 2008 2:17 am

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>

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Custom Category Page

Post by Brewhaus » Sun Sep 07, 2008 7:01 pm

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Custom Category Page

Post by mazhar » Sun Sep 07, 2008 8:36 pm

Sure... you can do i just floated an idea

Post Reply