Page 1 of 1
question about category grid page
Posted: Mon Jul 30, 2012 8:17 pm
by Chris Hadden
Under the "content" option I there are two options I like.
(Category grid page with category data) [[ConLib:CategoryGridPage4]]
(Category grid page with basket options) [[ConLib:CategoryGridPage3]]
I'd like to have both though, category data displayed AND the basket option. Seems reasonable, how could I do that?
Thanks
Chris
Re: question about category grid page
Posted: Tue Jul 31, 2012 6:49 am
by jmestep
You would have to customize the page. CategoryGrid3 only displays products according to the datasource that is selected in the code. You would need to change that to use a catalognode datasource, then show the quantity box only for catalognodes that are products.l
Re: question about category grid page
Posted: Tue Jul 31, 2012 8:40 am
by david-ebt
Do you just want to add the category description to the category grid with basket? Try this. Add this code to the CategoryGridPage3.ascx page just above the placeholder for the SubCategoryPanel:
Code: Select all
<asp:PlaceHolder ID="CategoryDescriptionPanel" runat="server" EnableViewState="false">
<asp:Literal ID="CategoryDescription" runat="server" Text="" EnableViewState="false" />
<br /><br />
</asp:PlaceHolder>
Then change the beginning of the BindPage function in the CategoryGridPage3.ascx.cs file to this:
Code: Select all
private void BindPage()
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
if (_Category != null)
{
Page.Title = _Category.Name;
Caption.Text = _Category.Name;
if (!string.IsNullOrEmpty(_Category.Description))
{
CategoryDescriptionPanel.Visible = true;
CategoryDescription.Text = _Category.Description;
}
else CategoryDescriptionPanel.Visible = false;
}
Just adding the few lines for the Description.
That will display the category description above the subcategory list. If that's not exactly what you want, hopefully it will put you on the right track.
Re: question about category grid page
Posted: Fri Aug 03, 2012 12:23 pm
by Chris Hadden
Yes I am just trying to add the category description to the top of the categorygrid3.aspx
I tried changing the code as suggested. I have not gotten it to work yet. I am confused about something maybe someone can clear up. I didn't want to fool with the original file so I created CategoryCUSTOMGridPage3.ascx.cs and CategoryCUSTOMGridPage3.ascx.cs this is in the same conlib folder.
Do I now have to have a CUSTOMGirdPage3.aspx in the root folder to get it to work?
Also I was not certain whether the following line of code should stay
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption;
Caption.Text = DefaultCaption;
I don't have a reference in the snipet of code to know whether I am deleting that or just inserting that code above it.
Thanks for your help
Re: question about category grid page
Posted: Fri Aug 03, 2012 12:30 pm
by david-ebt
You don't have to create a new CustomGridPage3.aspx unless you want to have two different category pages.
The normal convention is to NOT directly edit the Able-supplied files as you say. The convention is to copy the control files you want to customize into the CUSTOM folder. So you can keep the CategoryGridPage3 name. Then in the scriptlet for the content, change it from:
Code: Select all
[[ConLib:CategoryGridPage3 DisplayBreadCrumbs="false"]]
to
Code: Select all
[[ConLib:Custom\CategoryGridPage3 DisplayBreadCrumbs="false"]]
The code you ask about should probably stay. It's for setting the title for page and the header on the page.