Page 1 of 1

Controlling category pages and product pages separately?

Posted: Thu Aug 28, 2008 8:17 am
by evanb@firefold.com
Is it possible to control category pages and product pages separately? Right now we've run into a conflict where we need to customize our category/subcategory pages differently that our product pages. I haven't found a way to do this other than going to each page and individually changing it for that section only, is there another way around this?

Re: Controlling category pages and product pages separately?

Posted: Thu Aug 28, 2008 3:37 pm
by jmestep
Are you meaning category pages that have subcategories vs. those that have products? If so, you can make a copy of one of the pages and conlibs and customize one for subcats and one for products. For example, I copied category4.aspx and related conlibs and related scriplet and use one set for subcats and one set for products.
If you mean a category display page vs a product display page, I'm not sure what you're asking since they are different display pages to start with.

Re: Controlling category pages and product pages separately?

Posted: Wed Sep 03, 2008 3:07 pm
by William_firefold
The above answer was helpful but didnt work for us.
Here is an example of what we are working with on this one:

Image

The problem lies in the tree structure, and the fact that it assigns
the same div class to both subcategories and products.
We need there to be some differentiation between subcategories and products so we can manipulate them
separately.

Re: Controlling category pages and product pages separately?

Posted: Thu Sep 04, 2008 2:08 am
by mazhar
Wrap all the contents inside the ItemTemplate of the DataList control in a div as below

Code: Select all

<ItemTemplate>
<div class='<%# GetClass(Container.DataItem) %>'>
....
....
....
</div>
</ItemTemplate>
Now add the following function in the .CS file of the current page.

Code: Select all

public string GetClass(Object dataItem) 
    {
        CatalogNode catalogNode = (CatalogNode)dataItem;
        if (catalogNode.CatalogNodeType == CatalogNodeType.Product)
            return "ProductNode";
        else
            return "CategoryNode";
    }
Now when you refresh the page the each category will be wraped in div with class CategoryNode and for product it will be ProductNode just define the styles for these both classes in CSS