Category link in Wishlist page
Posted: Mon Jan 23, 2012 7:26 pm
I'm trying to link to a products parent category in the wishlist page, and I'm striking out. How can I expose the parent category id in this page?
thanks.
thanks.
Code: Select all
/// <summary>
/// Gets the last shopping url for the current user.
/// </summary>
/// <returns>The last shopping url for the current user.</returns>
public static string GetLastShoppingUrl()
{
HttpContext context = HttpContext.Current;
if (context == null) return "~/Default.aspx";
Page page = context.Handler as Page;
if (page == null) return "~/Default.aspx";
PageViewCollection pageViews = Token.Instance.User.PageViews;
pageViews.Sort("ActivityDate", GenericComparer.SortDirection.DESC);
string homePage = page.ResolveUrl("~/Default.aspx");
string searchPage = page.ResolveUrl("~/Search.aspx");
string wishlistPage = page.ResolveUrl("~/ViewWishlist.aspx");
foreach (PageView pageView in pageViews)
{
if ((pageView.UriStem == homePage) || (pageView.UriStem == searchPage) || (pageView.UriStem == wishlistPage)) return pageView.UriStem + "?" + pageView.UriQuery;
if (pageView.CatalogNodeId != 0)
{
ICatalogable node = pageView.CatalogNode;
if ((node != null) && ((pageView.CatalogNodeType == CatalogNodeType.Category) || (pageView.CatalogNodeType == CatalogNodeType.Product)))
{
return node.NavigateUrl;
}
}
}
return homePage;
}