Failed to get more category items

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Able-fans
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Mon Sep 03, 2012 8:45 pm

Failed to get more category items

Post by Able-fans » 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;


        }

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Failed to get more category items

Post by jmestep » Mon Oct 29, 2012 6:59 am

This is a bug in Gold and Able patched it like this:
replace:

Code:
//ATTEMPT TO CAST TO PRODUCT
CatalogProductNode p = node as CatalogProductNode;
if (p != null) productNodes.Add(p);


with:

Code:
// FILTER PRODUCT NODES
if (node.CatalogNodeType == CatalogNodeType.Product && node.ChildObject != null)
{
productNodes.Add(node);
}
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply