Obtaining bread crumb path for a product for use in datafeed

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Obtaining bread crumb path for a product for use in datafeed

Post by jmestep » Mon Nov 10, 2008 6:06 pm

I'm working on re-doing a datafeed I had for an Able 5 store and want to use the bread crumb path to the product as the feed field category. Like Paintball > Paintball Guns > Spyder
I've been working with code I snagged from a bread crumb trail, but I need to have it show only one category path if the product is in more than one. How would I do that in this code, or would there be a better way to construct it?

{ List<CatalogPathNode> path = CatalogDataSource.GetPath(productCategoryId, false);
category = "";
for (int i = path.Count - 1; i >= 0; i--)
{
category = path.Name + " > ";

}
Thanks
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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Obtaining bread crumb path for a product for use in datafeed

Post by mazhar » Tue Nov 11, 2008 11:58 am

What about picking the first category and generating bread crumbs using that

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Obtaining bread crumb path for a product for use in datafeed

Post by mazhar » Tue Nov 11, 2008 11:58 am

For example

Code: Select all

[code]
Product product = ProductDataSource.Load(167);
        List<CatalogPathNode> pathNodeList = CatalogDataSource.GetPath(product.Categories[0], false);
        StringBuilder breadCrumbs = new StringBuilder();
        foreach (CatalogPathNode cpn in pathNodeList)
            breadCrumbs.Append(cpn.Name+">");
        if(breadCrumbs.Length > 0)
            breadCrumbs.Remove((breadCrumbs.Length - 1), 1);
        Response.Write(breadCrumbs.ToString());
[/code]

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

Re: Obtaining bread crumb path for a product for use in datafeed

Post by jmestep » Tue Nov 11, 2008 3:32 pm

Thank you, that's just what I was trying to do. I just couldn't figure out how to get the first category.
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

User avatar
bobr2k
Commander (CMDR)
Commander (CMDR)
Posts: 183
Joined: Fri Oct 26, 2007 2:31 pm
Location: Illinois

Re: Obtaining bread crumb path for a product for use in datafeed

Post by bobr2k » Tue Nov 11, 2008 3:35 pm

I love watching you guys work - even if I don't understand all of it :lol:
Bob R.
"Bills travel through the mail at twice the speed of checks." -- Steven Wright

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: Obtaining bread crumb path for a product for use in datafeed

Post by draneb » Fri Jul 17, 2009 11:19 am

Hello,

Instead of using the entire breadcrumb path, how could you get it to display just the category or sub category that the item is in?

Thank you for your help!
AC 7.0.3 build 13937

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

Re: Obtaining bread crumb path for a product for use in datafeed

Post by jmestep » Fri Jul 17, 2009 4:16 pm

Try something like pathNodeList.RemoveRange(0,1);
before the
StringBuilder breadCrumbs = new StringBuilder();

I haven't tested it lately, though.
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