Using my custom object as a Catalognode object

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:

Using my custom object as a Catalognode object

Post by jmestep » Tue Jan 27, 2009 5:08 pm

OK, I'm one step further on this and need advice on the best way to do something. I've got a custom object and dataclass coded to allow two-way cross linking of Able objects the way Able 5 used to do it. It's working OK, but I'm working on displaying the links in various places. I think the best way might be to take my object collection and turn it into a catalognode collection so that I can get the Name, Url of the object. I thought about having my object use the CatalogNode interface instead of IPersistable because that way I could get the name, Url easily. But that caused a problem with the OrderBy because my OrderBy is not the CatalogNode OrderBy. I was also afraid there would be other problems I don't know about yet.
One place I'm trying to use the name and/or url in the admin is on a page to connect certain custom types of webpages to certain types of products which are custom objects. I'm adapting the EditSimilarProducts.aspx in the admin and I can pull the data from my object in (like the objectId2). That shows up fine. What is the best way to acquire the CatalogNode name for that id in the objectdatasource that the control uses?
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
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Using my custom object as a Catalognode object

Post by jmestep » Thu Jan 29, 2009 12:16 pm

I did get this done, but I'm trying to simplify the code. I would like to put the code in the custom class and get the CatalogNode from there so I won't have to put so much code on the page. Right now I have to load my custom cross links using the objectId1 and objecttype1, then loop thru the links returned
CatalogNodeCollection nodes = CatalogNodeDataSource.LoadForCriteria("CatalogNodeId = " + link.ObjectId2);
then loop thru the Catalog Nodes for that collection.


In Able 5, it was done this way:

Code: Select all

'THESE ARE READONLY
		Private m_Name As String = ""
		Private m_DisplayPage As String = ""
		Private m_Target As String = ""


............................

[List of parameters]		
Public Sub New(ByVal intObjectID1 As Integer, ByVal intObjectType1 As Integer, ByVal intObjectID2 As Integer, ByVal intObjectType2 As Integer, ByVal intVisible As Integer, ByVal intOrderBy As Integer, ByVal sName As String, ByVal sDisplayPage As String, ByVal sTarget As String)
			Object_ID1 = intObjectID1
			ObjectType1 = intObjectType1
			Object_ID2 = intObjectID2
			ObjectType2 = intObjectType2
			Visible = intVisible
			OrderBy = intOrderBy
			LinkType = LINK_TO
			SetName(sName)
			SetDisplayPage(sDisplayPage)
			SetTarget(sTarget)
		End Sub

...................................
Then:

Friend Sub SetName(ByVal Value As String)
			m_Name = Value
		End Sub

I'm working on this in my custom class with

Code: Select all

 public string GetName(Int32 ObjectId, Int32 ObjectType)//objectid2 and objecttype2
             {
                 

                     switch (ObjectType2)
                     {

                         case 0:
                            CatalogNode relatedCategory = CatalogNodeDataSource.Load(0,ObjectId2,0);
                            _Name = relatedCategory.Name;

............................ more cases...................
}
return _Name;
}

 public string Name
            {
                  get { return this._Name; }
            }

I'm missing something, because I'm not getting the name.
Thanks for any help.
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: Using my custom object as a Catalognode object

Post by mazhar » Thu Jan 29, 2009 12:26 pm

Make sure that before calling obj.Name you have made a call to GetName function.

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

Re: Using my custom object as a Catalognode object

Post by jmestep » Thu Jan 29, 2009 1:05 pm

Like this?
public string Name
{
get {
GetName(ObjectId2, ObjectType2);
return this._Name; }
}
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