Ok..I'm looking for a slick way (ie. elegant way) to use a particuliar category page as HOME.
I thought I'd post here before I start digging into the code and replacing stuff to see if anyone has a nice, clean way to do this :)
namespace NopSolutions.NopCommerce.Web
{
public partial class Default : BaseNopPage
{
Category category = null;//**** CategoryManager.GetCategoryById(some catid);
private void CreateChildControlsTree()
{
category = CategoryManager.GetCategoryById(48);
if (category != null)
{
Control child = null;
CategoryTemplate categoryTemplate = category.CategoryTemplate;
if (categoryTemplate == null)
throw new NopException(string.Format("Category template path can not be empty. CategoryID={0}", category.CategoryId));
child = base.LoadControl(categoryTemplate.TemplatePath);
this.CategoryPlaceHolder.Controls.Add(child);
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.CreateChildControlsTree();
}
protected void Page_Load(object sender, EventArgs e)
{
if (category == null || category.Deleted || !category.Published)
Response.Redirect(CommonHelper.GetStoreLocation());
string title = string.Empty;
if (!string.IsNullOrEmpty(category.LocalizedMetaTitle))
title = category.LocalizedMetaTitle;
else
title = category.LocalizedName;
SEOHelper.RenderTitle(this, title, true);
SEOHelper.RenderMetaTag(this, "description", category.LocalizedMetaDescription, true);
SEOHelper.RenderMetaTag(this, "keywords", category.LocalizedMetaKeywords, true);
if (!Page.IsPostBack)
{
NopContext.Current.LastContinueShoppingPage = CommonHelper.GetThisPageUrl(true);
}
}
public int CategoryId
{
get
{
return CommonHelper.QueryStringInt("CategoryId");
}
}
public override PageSslProtectionEnum SslProtected
{
get
{
return PageSslProtectionEnum.No;
}
}
}
}