CHAPTER 9 Category Object
ProgID: ACBStore.tCategory
Description
The Category object contains data about a specific Category.
|
Category_ID
|
Read Only. A Long value that holds the unique ID of the Category.
|
|
CategoryLevel
|
Read Only. An Integer value that holds the level of this Category.
|
|
CategoryPath
|
Read Only. A String that contains a list of the Category IDs that are parent to this category.
|
|
Description
|
Read/Write. A String value that contains the description of the category.
|
|
IsDirty
|
Read/Write. A boolean value that indicates whether the data in this object has been changed and requires a database update.
|
|
Name
|
Read/Write. A String value that contains the name of the category.
|
|
OrderBy
|
Read/Write. A Long value that indicates the order in which this Attribute will be displayed. Attributes are displayed in ascending order based on this value.
|
|
Parent_ID
|
Read Only. A Long value that indicates the ID of the category which is parent to this one. 0 indicates no parent (root level).
|
|
Store_ID
|
Read Only. A Long value that holds the ID of the Store to which this category applies.
|
|
Thumbnail
|
Read/Write. A String value that contains the url of the thumbnail image to be displayed for this category.
|
|
ThumbnailParams
|
Read/Write. A String value that contains the html parameters (e.g. height, width, alt, etc.) to be used for the thumbnail image display.
|
|
Categories
|
Returns a reference to a collection that contains all subcategories of the active category.
|
|
Delete
|
Deletes the specified object from the database.
|
|
GetCategoryTree
|
Returns an array that contains all subcategories of the active category.
|
|
GetOrderBy
|
Returns the next OrderBy value for a given parent category.
|
|
GetPath
|
Returns an array containing all parent category names and IDs that lead to this category.
|
|
GetProducts
|
Returns an array containing all products in the active category.
|
|
GetProductTree
|
Returns an array that contains all products and subcategories of the active category.
|
|
Load
|
Loads the object from the database.
|
|
Products
|
Returns a reference to a collection that contains all products for the active category.
|
|
Reset
|
Resets the object, freeing any allocated resources.
|
|
Save
|
This method commits to the database all changes made to the object.
|
|
SaveAsNew
|
This method assigns a new unique ID to the object and then commits the data as a new object in the database.
|
|
SetParent
|
This method can be used to change the Parent of the active category.
|
Categories Method
Returns a reference to a collection that contains all subcategories of the active category.
Syntax
Set colCategories = objCategory.Categories
Return Value
Returns a reference to an ACBStore.cCategories collection.
Delete Method
Deletes the specified object from the database.
Syntax
objCategory.Delete(objToken,[intCategoryID])
Parameters
objToken [in] A reference to a loaded Token object.
intCategoryID [in] Optional. A long value that specifies the category to delete. Default is the current value of the Category ID Property.
Notes
When Delete is called, the properties within the object itself are not reset. However, all applicable data is immediately removed from the database and the Product_ID property is reset to 0.
GetCategoryTree Method
Returns an array that contains all subcategories of the active category.
Syntax
arrCategories = objCategory.GetCategoryTree([intMaxLevel])
Return Value
Returns a two dimensional Variant Array (5,x), where "x" is the number of rows in the array (0 based). The array structure is as follows:
-
arrCategories(0,x) = Category_ID (long)
-
arrCategories(1,x) = Parent Category_ID (long)
-
arrCategories(2,x) = Category Name (string)
-
arrCategories(3,x) = Category Level (integer)
-
arrCategories(4,x) = IsProduct (boolean)
-
arrCategories(5,x) = Active (boolean)
Parameters
intMaxLevel [in] Optional. An Integer value that specifies the maximum number of levels to recurse. Use -1 to recurse all levels. Default value is -1.
GetOrderBy Method
Returns the next OrderBy value for a given parent category.
Syntax
intOrderBy = objCategory.GetOrderBy(objToken, [intParentID], [intBound])
Return Value
Returns a long value that indicates the next OrderBy value for the desired insertion point.
Parameters
objToken [in] A reference to a loaded Token object.
intParentID [in] Optional. A Long value that contains the ID of the category to obtain the OrderBy value from. Default is the current value of the category ID property.
intBound [in] Optional. An integer value that indicates the desired insertion point for the OrderBy value. Valid values are 0 (beginning of list) and 1 (end of list). Default value is 1.
GetPath Method
Returns an array containing all parent category names and IDs that lead to this category.
Syntax
arrPath = objCategory.GetPath(objToken)
Return Value
Returns a two dimensional Variant Array (1,x), where "x" is the number of rows in the array (0 based). The array structure is as follows:
-
arrPath(0,x) = Category_ID
-
arrPath(1,x) = Category Name
Parameters
objToken [in] A reference to a loaded Token object.
Notes
The parent categories in the array are in order starting with the root level category. All the way to the active category.
GetProducts Method
Returns an array containing all products in the active category.
Syntax
arrProducts = objCategory.GetProducts
Return Value
Returns a two dimensional Variant Array (5,x), where "x" is the number of rows in the array (0 based). The array structure is as follows:
-
arrProducts(0,x) = Product_ID (long)
-
arrProducts(1,x) = Active Category_ID (long)
-
arrProducts(2,x) = Product Name (string)
-
arrProducts(3,x) = Product Level (integer)
-
arrProducts(4,x) = IsProduct (boolean; always true)
-
arrProducts(5,x) = Active (boolean)
Notes
If no products are found, the function returns 0.
GetProductTree Method
Returns an array that contains all products and subcategories of the active category.
Syntax
arrChildren = objCategory.GetProductTree([intMaxLevel])
Return Value
Returns a two dimensional Variant Array (5,x), where "x" is the number of rows in the array (0 based). The array structure is as follows:
-
arrChildren(0,x) = Category_ID (long)
-
arrChildren(1,x) = Parent Category_ID (long)
-
arrChildren(2,x) = Category Name (string)
-
arrChildren(4,x) = IsProduct (boolean)
-
arrChildren(5,x) = Active (boolean)
Parameters
intMaxLevel [in] Optional. An Integer value that specifies the maximum number of levels to recurse. Use -1 to recurse all levels. Default is -1.
Load Method
Loads the object from the database.
Syntax
Boolean = objProduct.Load(objToken, intCategoryID)
Return Value
Returns a boolean value indicating success (true) or failure (false).
Parameters
objToken [in] A reference to a loaded Token object.
intCategoryID [in] A long value indicating the Category to load from the database.
Products Method
Returns a reference to a collection that contains all products for the active category.
Syntax
Set colProducts = objCategory.Products
Return Value
Returns a reference to an ACBStore.cProducts collection.
Reset Method
Resets the object, freeing any allocated resources.
Notes
Reset should always be called before setting the object to nothing. This will force all allocated memory to be freed.
Save Method
This method commits to the database all changes made to the object.
Syntax
Boolean = objCategory.Save(objToken)
Return Value
Returns a boolean value indicating success (true) or failure (false).
Parameters
objToken [in] A reference to a loaded Token object.
SaveAsNew Method
This method assigns a new unique ID to the object and then commits the data as a new object in the database.
Syntax
Boolean = objCategory.SaveAsNew(objToken)
Return Value
Returns a boolean value indicating success (true) or failure (false).
Parameters
objToken [in] A reference to a loaded Token object.
SetParent Method
This method can be used to change the Parent of the active category.
Syntax
Boolean = objCategory.SetParent(intNewParentID)
Return Value
Returns a boolean value indicating success (true) or failure (false).
Parameters
intNewParentID [in] A long value indicating the Category to set as parent for the active category.
Go to Main Go to Previous Go to Next