Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZOption Class Reference

## Public Member Functions
| __construct ( $id=-1)
| store ()
| get ( $id=-1)
& | getAll ()
| delete ()
| id ()
| name ()
| description ()
| remoteID ()
& | values ()
| setName ( $value)
| setDescription ( $value)
| setRemoteID ( $value)
& | descriptionHeaders ( $id=false)
| removeHeaders ( $id=false)
| addHeader ( $header, $id=false)
| removeValues ( $id=false)
| removeValue ( $id)
| addValue (&$value)
| getByRemoteID ( $id)

## Public Attributes
| $ID
| $Name
| $Description
| $RemoteID

## Detailed Description

! eZTrade The eZOption class handles options for products and product categories.

eZOption class handles product options. The class has functions for storing to the database and fetching from the database.

You can add option values to options, and get the values for a option.

Example code:

// Create a new option object
$option = new eZOption();
$option->setName( "Color" );
$option->setDescription( "The color of the product" );
// Store the option to the database
$option->store();
// Fetch all the options from the database.
$optionArray = $option->getAll();
//print out all the options.
foreach ( $optionArray as $optionItem )
{
print( "Option: " . $optionItem->name() . "<br>" );
}
// Create some values
$value1 = new eZOptionValue();
$value1->setName( "Red" );
$value2 = new eZOptionValue();
$value2->setName( "Green" );
$value3 = new eZOptionValue();
$value3->setName( "Blue" );
// Add them to the option
$option->addValue( $value1 );
$option->addValue( $value2 );
$option->addValue( $value3 );
eZOptionValue
Definition: ezoptionvalue.php:54
eZOption
Definition: ezoption.php:82

See also
  eZProductCategory eZOptionValue

Definition at line 81 of file ezoption.php.

## Constructor & Destructor Documentation

## ◆ __construct()

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

Constructs a new eZOption object. Retrieves the data from the database if a valid id is given as an argument.

Definition at line 87 of file ezoption.php.

References $id, and $ID.

## Member Function Documentation

## ◆ addHeader()

eZOption::addHeader | ( |  | $header,
|  |  | $id = `false`
| ) |  |

Definition at line 303 of file ezoption.php.

References $db, $header, $id, $ID, $res, eZDB\finish(), and eZDB\globalDatabase().

## ◆ addValue()

eZOption::addValue | ( | & | $value | ) |

Adds a value to the option. The value must be of eZOptionValue type.

NOTE: It stores the value object to the database.

Definition at line 374 of file ezoption.php.

## ◆ delete()

eZOption::delete | ( |  | ) |

Deletes a option from the database.

Definition at line 184 of file ezoption.php.

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

## ◆ description()

eZOption::description | ( |  | ) |

Returns the option description.

Definition at line 226 of file ezoption.php.

References $Description.

## ◆ descriptionHeaders()

& eZOption::descriptionHeaders | ( |  | $id = `false` | ) |

Definition at line 275 of file ezoption.php.

References $db, $id, $ID, $ret, $row, and eZDB\globalDatabase().

## ◆ get()

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

Fetches the option object values from the database.

Definition at line 139 of file ezoption.php.

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

## ◆ getAll()

& eZOption::getAll | ( |  | ) |

Retrieves every option from the database.

Definition at line 164 of file ezoption.php.

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

## ◆ getByRemoteID()

eZOption::getByRemoteID | ( |  | $id | ) |

Definition at line 383 of file ezoption.php.

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

Referenced by eZFreeTradeImport\makeValue().

## ◆ id()

eZOption::id | ( |  | ) |

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

Definition at line 210 of file ezoption.php.

References $ID.

## ◆ name()

eZOption::name | ( |  | ) |

Returns the name of the option.

Definition at line 218 of file ezoption.php.

References $Name.

## ◆ remoteID()

eZOption::remoteID | ( |  | ) |

Returns the option remote id.

Definition at line 234 of file ezoption.php.

References $RemoteID.

## ◆ removeHeaders()

eZOption::removeHeaders | ( |  | $id = `false` | ) |

Definition at line 291 of file ezoption.php.

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

## ◆ removeValue()

eZOption::removeValue | ( |  | $id | ) |

Removes all values connected to this option.

Definition at line 362 of file ezoption.php.

References $id, and eZOptionValue\delete().

## ◆ removeValues()

eZOption::removeValues | ( |  | $id = `false` | ) |

Removes all values connected to this option.

Definition at line 345 of file ezoption.php.

References $db, $id, $ID, $row, and eZDB\globalDatabase().

## ◆ setDescription()

eZOption::setDescription | ( |  | $value | ) |

Sets the description of the option.

Definition at line 261 of file ezoption.php.

## ◆ setName()

eZOption::setName | ( |  | $value | ) |

Sets the name of the option.

Definition at line 253 of file ezoption.php.

References Name.

## ◆ setRemoteID()

eZOption::setRemoteID | ( |  | $value | ) |

Sets the remote id of the option.

Definition at line 269 of file ezoption.php.

## ◆ store()

eZOption::store | ( |  | ) |

Stores a eZOption object to the database.

Definition at line 99 of file ezoption.php.

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

## ◆ values()

& eZOption::values | ( |  | ) |

Returns all the values to the current option.

The values are returned as an array of eZOptionValue objects.

Definition at line 244 of file ezoption.php.

## Member Data Documentation

## ◆ $Description

eZOption::$Description

Definition at line 402 of file ezoption.php.

Referenced by description().

## ◆ $ID

eZOption::$ID

Definition at line 400 of file ezoption.php.

Referenced by __construct(), addHeader(), descriptionHeaders(), id(), removeHeaders(), and removeValues().

## ◆ $Name

eZOption::$Name

Definition at line 401 of file ezoption.php.

Referenced by name().

## ◆ $RemoteID

eZOption::$RemoteID

Definition at line 403 of file ezoption.php.

Referenced by remoteID().

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

- ezoption.php

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