Failed to get more category items
Posted: Sun Oct 28, 2012 9:25 pm
I got a category includes 49 products and no sub-categories. There is nothing showing for more category item tab in product page. Via debug, finding there is a place to cast catalogNode to catalogProductNode fails. Is anyone know why the 49 products nodes can not be cast to catalogProductNode?
Code: Select all
private IList<CatalogNode> GetProductNodes(int categoryId)
{
//GET ALL NODES IN THE CATEGORY
IList<CatalogNode> allNodes = CatalogDataSource.LoadForCategory(categoryId, true, "OrderBy");
//EXTRACT THE PRODUCT NODES
IList<CatalogNode> productNodes = new List<CatalogNode>();
foreach (CatalogNode node in allNodes)
{
//ATTEMPT TO CAST TO PRODUCT
CatalogProductNode p = node as CatalogProductNode;
if (p != null) productNodes.Add(p);
}
return productNodes;
}