find an existing category using api
-
- Ensign (ENS)
- Posts: 19
- Joined: Mon Jun 02, 2008 2:20 pm
find an existing category using api
Hello,
I am trying to determine if a Category exists before add to it using the API. It's unclear from the documentation on how to accomplish this. The only variables I have available for the search are Category.Name and Category.ParentID (StoreID is a given). If I have to do it via SQL, is there an AC API that I can call that would provide the data layer or do I have to provide my own (if so, could I lift the connection string from somewhere)?
Thanks for the hand holding.
Richard
I am trying to determine if a Category exists before add to it using the API. It's unclear from the documentation on how to accomplish this. The only variables I have available for the search are Category.Name and Category.ParentID (StoreID is a given). If I have to do it via SQL, is there an AC API that I can call that would provide the data layer or do I have to provide my own (if so, could I lift the connection string from somewhere)?
Thanks for the hand holding.
Richard
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: find an existing category using api
Here are a couple of examples from Conlib/CategoryGrid3.ascx:
Code: Select all
public int CategoryId
{
get
{
if (ViewState["CategoryId"] == null)
ViewState["CategoryId"] = PageHelper.GetCategoryId();
return (int)ViewState["CategoryId"];
}
set
{
ViewState["CategoryId"] = value;
}
}
private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (_Category != null)
{
Page.Title = _Category.Name;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
Caption.Text = _Category.Name;
BindSubCategories();
}
else
{
CategoryHeaderPanel.Visible = false;
}
BindSearchResultsPanel();
}
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
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
-
- Ensign (ENS)
- Posts: 19
- Joined: Mon Jun 02, 2008 2:20 pm
Re: find an existing category using api
Thanks, but I forgot to mention that this is for a webservice that will be populating categories from a third party source.
Any other ideas?
-Richard.
Any other ideas?
-Richard.
Re: find an existing category using api
Just query AC_Categories for the .Name and .ParentID.RevereRichard wrote:I am trying to determine if a Category exists before add to it using the API.
There is no data layer provided via SQL. You can use the AC API (known as CommerceBuilder) via .Net code to accomplish the same task, however your import program design will obviously have to be altered.RevereRichard wrote:If I have to do it via SQL, is there an AC API that I can call that would provide the data layer or do I have to provide my own (if so, could I lift the connection string from somewhere)?
Adding categories and linking products to them is a bit intricate as there are three tables involved. It's often easier to do it via .Net code and use the CommerceBuilder data classes as Able has simplified alot by writing a lot of functionality into them.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
-
- Ensign (ENS)
- Posts: 19
- Joined: Mon Jun 02, 2008 2:20 pm
Re: find an existing category using api
Thanks for the response.
Can I piggy back off the data application block in use by AC for my database stuff? If so, can I access the encrypted connection string?
Question on adding categories;
Let's assume I have a hiearchy similar to the Wiki example; Books>Fiction>Mystery and all three categories are new and have been added. It's unclear what should be entered into the ac_CatalogNodes table. Using the samples from the Wiki example, can you tell me how many rows go into the ac_CatalogNodes table?
Thanks.
Can I piggy back off the data application block in use by AC for my database stuff? If so, can I access the encrypted connection string?
Question on adding categories;
Let's assume I have a hiearchy similar to the Wiki example; Books>Fiction>Mystery and all three categories are new and have been added. It's unclear what should be entered into the ac_CatalogNodes table. Using the samples from the Wiki example, can you tell me how many rows go into the ac_CatalogNodes table?
Thanks.
Re: find an existing category using api
Can't help you much there - I do everything through the Able data classes these days and gave up on loading the tables directly.
I do recall there are some other posts though that did a pretty good job of explaining it, you might try doing a forum search.
I do recall there are some other posts though that did a pretty good job of explaining it, you might try doing a forum search.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
-
- Ensign (ENS)
- Posts: 19
- Joined: Mon Jun 02, 2008 2:20 pm
Re: find an existing category using api
Perhaps I am misunderstanding your previous post. I prefer doing this all in .net. Can you query AC_Categories using the Able data classes? If so, is there any info on this object? The API reference I have doesn't seem to indicate there is one.
Edit. found one of your previous posts referring to MoveCatalogObject.aspx. Lots of good stuff there. thx.
Edit. found one of your previous posts referring to MoveCatalogObject.aspx. Lots of good stuff there. thx.