Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZProductCategory Class Reference

## Public Member Functions
| __construct ( $id=-1)
| store ()
| delete ( $catID=-1)
| get ( $id=-1)
& | getAll ()
& | getByParent ( $parent, $sortby='name')
& | path ( $categoryID=0)
| id ()
& | name ()
| remoteID ()
| sectionID ()
& | description ()
& | parent ()
& | sortMode ()
| setName (&$value)
| setRemoteID (&$value)
| setSectionID (&$value)
| setDescription (&$value)
| setParent ( $parent)
| setSortMode ( $value)
| productCount ( $sortMode="time", $fetchNonActive=false, $fetchDiscontinued=false, $categoryID=false)
& | activeProducts ( $sortMode="time", $offset=0, $limit=50, $categoryID=false)
| addOption ( $value)
& | options ()
| moveUp ( $id)
| moveDown ( $id)
| getByRemoteID ( $id, $parent=false)
| cloneObject ()
| copy ( $recursive=true, $id=false)
| setImage ( $value)
& | image ( $AsObject=true)

## Static Public Member Functions
static & | getTree ( $parentID=0, $level=0)
static | sectionIDStatic ( $categoryID)
static | addProduct (&$value, $categoryid=false)
static | removeProduct (&$value, $categoryid=false)
static & | products ( $sortMode="time", $fetchNonActive=false, $offset=0, $limit=50, $fetchDiscontinued=false, $categoryID=0)
static | generatePermissionSQL ( $categoryID=false)

## Public Attributes
| $ID
| $Name
| $Parent
| $Description
| $OptionArray
| $SortMode
| $RemoteID
| $ImageID
| $SectionID

## Detailed Description

! eZTrade eZProductCategory handles product categories.

The eZProductCategory class handles product groups, the relation to products in the productgroup and the options connected to the product group.

Example of usage:

// inserts a new Category to the database:
$category = new eZProductCategory();
$category->setName( "Category name" );
$category->setDescription( "This is a brief description of the category" );
$category->store();
// Fetches every category found in the database
$categoryArray = $category->getAll();
// Prints out every category's name and description , notice it's an array
// of objects.
foreach ( $categoryArray as $catItem )
{
print( $catItem->name() . "<br>" . $catItem->description() . "..<br>" );
}
// Create a option
$option = new eZOption();
$option->setName( "Color" );
$option->setDescription( "This is the color of the product" );
// Add a option to the category
$category->addOption( $option );
$pathArray = $category->path();
// Get the current path of a category
$pathArray = $category->path();
// print the number of levels in the path
print( count( $pathArray ) );
// print out the path with slashes if you use $path[0] you get
// the id of the path
foreach ( $pathArray as $path )
{
print( $path[1] . " / " );
}
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$categoryArray
$categoryArray
Definition: adedit.php:379
$pathArray
$pathArray
Definition: admin/adlist.php:74
eZOption
Definition: ezoption.php:82
eZProductCategory
Definition: ezproductcategory.php:90

See also
  eZProduct eZOption eZOptionValue

Definition at line 89 of file ezproductcategory.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZProductCategory::__construct | ( |  | $id = `-1` | ) |

Constructs a new eZProductCategory object.

If $id is set the object's values are fetched from the database.

Definition at line 97 of file ezproductcategory.php.

References $id, and $ID.

## Member Function Documentation

## ◆ activeProducts()

& eZProductCategory::activeProducts | ( |  | $sortMode = `"time"`,
|  |  | $offset = `0`,
|  |  | $limit = `50`,
|  |  | $categoryID = `false`
| ) |  |

Returns every active product to a category as a array of eZProduct objects.

Definition at line 845 of file ezproductcategory.php.

References $categoryID, $limit, $offset, and products().

## ◆ addOption()

eZProductCategory::addOption | ( |  | $value | ) |

Adds a option to the category.

Definition at line 857 of file ezproductcategory.php.

References $db, $res, and eZDB\globalDatabase().

## ◆ addProduct()

static eZProductCategory::addProduct | ( | & | $value,
|  |  | $categoryid = `false`
| ) |  |
| static

Adds a product to the category. Can be used as a static function if $categoryid is supplied

Definition at line 548 of file ezproductcategory.php.

References $db, $query, $res, and eZDB\globalDatabase().

## ◆ cloneObject()

eZProductCategory::cloneObject | ( |  | ) |

Clone a current object.

Definition at line 1014 of file ezproductcategory.php.

## ◆ copy()

eZProductCategory::copy | ( |  | $recursive = `true`,
|  |  | $id = `false`
| ) |  |

Check if there are a category where RemoteID == $id. Return the category if true.

Definition at line 1030 of file ezproductcategory.php.

## ◆ delete()

eZProductCategory::delete | ( |  | $catID = `-1` | ) |

Deletes a eZProductGroup object from the database.

Definition at line 172 of file ezproductcategory.php.

References $category, $categoryID, $categoryList, $db, $ID, $product, eZDB\globalDatabase(), and products().

## ◆ description()

& eZProductCategory::description | ( |  | ) |

Returns the group description.

Definition at line 413 of file ezproductcategory.php.

## ◆ generatePermissionSQL()

static eZProductCategory::generatePermissionSQL | ( |  | $categoryID = `false` | ) |
| static

Definition at line 789 of file ezproductcategory.php.

References $categoryID, $group, $groups, $permission, $user, and eZUser\currentUser().

Referenced by eZProduct\get(), eZProduct\hotDealProducts(), productCount(), products(), and eZProduct\products().

## ◆ get()

eZProductCategory::get | ( |  | $id = `-1` | ) |

Fetches the object information from the database.

Definition at line 213 of file ezproductcategory.php.

References $category_array, $db, $id, $query, $ret, eZDB\globalDatabase(), and Name.

## ◆ getAll()

& eZProductCategory::getAll | ( |  | ) |

Returns all the categories found in the database.

The categories are returned as an array of eZProductCategory objects.

Definition at line 250 of file ezproductcategory.php.

References $category_array, $db, $i, and eZDB\globalDatabase().

## ◆ getByParent()

& eZProductCategory::getByParent | ( |  | $parent,
|  |  | $sortby = `'name'`
| ) |  |

Returns the categories with the category given as parameter as parent.

The categories are returned as an array of eZProductCategory objects.

Definition at line 272 of file ezproductcategory.php.

References $category_array, $db, $i, $query, and eZDB\globalDatabase().

## ◆ getByRemoteID()

eZProductCategory::getByRemoteID | ( |  | $id,
|  |  | $parent = `false`
| ) |  |

Check if there are a category where RemoteID == $id. Return the category if true.

Definition at line 982 of file ezproductcategory.php.

References $category, $db, $res, and eZDB\globalDatabase().

## ◆ getTree()

static& eZProductCategory::getTree | ( |  | $parentID = `0`,
|  |  | $level = `0`
| ) |  |
| static

Definition at line 335 of file ezproductcategory.php.

References $category, $categoryList, $level, and $tree.

## ◆ id()

eZProductCategory::id | ( |  | ) |

Returns the object ID to the category. This is the unique ID stored in the database.

Definition at line 358 of file ezproductcategory.php.

References $ID, and $ret.

## ◆ image()

& eZProductCategory::image | ( |  | $AsObject = `true` | ) |

Returns the Image ID.

Definition at line 1048 of file ezproductcategory.php.

References $image, and $ImageID.

## ◆ moveDown()

eZProductCategory::moveDown | ( |  | $id | ) |

Moves the product placement with the given ID down.

Definition at line 946 of file ezproductcategory.php.

References $db, $res, and eZDB\globalDatabase().

## ◆ moveUp()

eZProductCategory::moveUp | ( |  | $id | ) |

Moves the product placement with the given ID up.

Definition at line 909 of file ezproductcategory.php.

References $db, $res, and eZDB\globalDatabase().

## ◆ name()

& eZProductCategory::name | ( |  | ) |

Returns the name of the category.

Definition at line 368 of file ezproductcategory.php.

References $ret, and Name.

## ◆ options()

& eZProductCategory::options | ( |  | ) |

Returns every option to a category as a array of eZOption objects.

Definition at line 889 of file ezproductcategory.php.

References $db, $i, and eZDB\globalDatabase().

## ◆ parent()

& eZProductCategory::parent | ( |  | ) |

Returns the parent if one exist. If not 0 is returned.

Definition at line 426 of file ezproductcategory.php.

## ◆ path()

& eZProductCategory::path | ( |  | $categoryID = `0` | ) |

Returns the current path as an array of arrays.

The array is built up like: array( array( id, name ), array( id, name ) );

See detailed description for an example of usage.

Definition at line 305 of file ezproductcategory.php.

References $category, $categoryID, and $ID.

## ◆ productCount()

eZProductCategory::productCount | ( |  | $sortMode = `"time"`,
|  |  | $fetchNonActive = `false`,
|  |  | $fetchDiscontinued = `false`,
|  |  | $categoryID = `false`
| ) |  |

Returns the total number of products in a category.

Definition at line 618 of file ezproductcategory.php.

References $categoryID, $db, $ID, $OrderBy, $products, $query, generatePermissionSQL(), and eZDB\globalDatabase().

## ◆ products()

static& eZProductCategory::products | ( |  | $sortMode = `"time"`,
|  |  | $fetchNonActive = `false`,
|  |  | $offset = `0`,
|  |  | $limit = `50`,
|  |  | $fetchDiscontinued = `false`,
|  |  | $categoryID = `0`
| ) |  |
| static

Returns every product to a category as a array of eZProduct objects.

Definition at line 688 of file ezproductcategory.php.

References $categoryID, $db, $groups, $i, $ID, $limit, $offset, $OrderBy, $query, $user, eZUser\currentUser(), generatePermissionSQL(), and eZDB\globalDatabase().

Referenced by activeProducts(), and delete().

## ◆ remoteID()

eZProductCategory::remoteID | ( |  | ) |

Returns the remote ID of the category.

Definition at line 377 of file ezproductcategory.php.

References $RemoteID.

## ◆ removeProduct()

static eZProductCategory::removeProduct | ( | & | $value,
|  |  | $categoryid = `false`
| ) |  |
| static

Removes a product from the category. Can be used as a static function if $categoryid is supplied

Definition at line 589 of file ezproductcategory.php.

References $db, $ID, $query, $res, and eZDB\globalDatabase().

## ◆ sectionID()

eZProductCategory::sectionID | ( |  | ) |

Returns the remote ID of the category.

Definition at line 385 of file ezproductcategory.php.

References $SectionID.

## ◆ sectionIDStatic()

static eZProductCategory::sectionIDStatic | ( |  | $categoryID | ) |
| static

Returns the Section ID. Returns false if the Category was not found.

Definition at line 394 of file ezproductcategory.php.

References $db, $res, and eZDB\globalDatabase().

## ◆ setDescription()

eZProductCategory::setDescription | ( | & | $value | ) |

Sets the description of the category.

Definition at line 510 of file ezproductcategory.php.

## ◆ setImage()

eZProductCategory::setImage | ( |  | $value | ) |

Sets the image of the category.

Definition at line 1037 of file ezproductcategory.php.

## ◆ setName()

eZProductCategory::setName | ( | & | $value | ) |

Sets the name of the category.

Definition at line 486 of file ezproductcategory.php.

References Name.

## ◆ setParent()

eZProductCategory::setParent | ( |  | $parent | ) |

Sets the parent category.

Definition at line 518 of file ezproductcategory.php.

## ◆ setRemoteID()

eZProductCategory::setRemoteID | ( | & | $value | ) |

Sets the remote ID of the category.

Definition at line 494 of file ezproductcategory.php.

## ◆ setSectionID()

eZProductCategory::setSectionID | ( | & | $value | ) |

Sets the remote ID of the category.

Definition at line 502 of file ezproductcategory.php.

## ◆ setSortMode()

eZProductCategory::setSortMode | ( |  | $value | ) |

Sets the sort mode.

1 - publishing date 2 - alphabetic 3 - alphabetic desc 4 - absolute placement

Definition at line 538 of file ezproductcategory.php.

## ◆ sortMode()

& eZProductCategory::sortMode | ( |  | ) |

Returns the sort mode.

1 - publishing date 2 - alphabetic 3 - alphabetic desc 4 - absolute placement

Definition at line 446 of file ezproductcategory.php.

References $SortMode.

## ◆ store()

eZProductCategory::store | ( |  | ) |

Stores a eZProductGroup object to the database.

Definition at line 113 of file ezproductcategory.php.

References $db, $name, $query, $res, eZDB\globalDatabase(), and Name.

## Member Data Documentation

## ◆ $Description

eZProductCategory::$Description

Definition at line 1061 of file ezproductcategory.php.

## ◆ $ID

eZProductCategory::$ID

Definition at line 1058 of file ezproductcategory.php.

Referenced by __construct(), delete(), id(), path(), productCount(), products(), and removeProduct().

## ◆ $ImageID

eZProductCategory::$ImageID

Definition at line 1065 of file ezproductcategory.php.

Referenced by image().

## ◆ $Name

eZProductCategory::$Name

Definition at line 1059 of file ezproductcategory.php.

## ◆ $OptionArray

eZProductCategory::$OptionArray

Definition at line 1062 of file ezproductcategory.php.

## ◆ $Parent

eZProductCategory::$Parent

Definition at line 1060 of file ezproductcategory.php.

## ◆ $RemoteID

eZProductCategory::$RemoteID

Definition at line 1064 of file ezproductcategory.php.

Referenced by remoteID().

## ◆ $SectionID

eZProductCategory::$SectionID

Definition at line 1066 of file ezproductcategory.php.

Referenced by sectionID().

## ◆ $SortMode

eZProductCategory::$SortMode

Definition at line 1063 of file ezproductcategory.php.

Referenced by sortMode().

The documentation for this class was generated from the following file:

- ezproductcategory.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.