This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

Shop_ExtraOption class

Defined in /modules/shop/models/shop_extraoption.php, lines 21-430
Inheritance Phpr_Extension » Phpr_Extensible » Phpr_Validatable » Db_Base » Db_WhereBase » Db_SqlBase » Db_ActiveRecord » Shop_ExtraOption
Author LemonStand eCommerce Inc.
Represents a product extra option.

Public properties

Show inherited properties.

Property Type Description Defined By
auto_create_timestamps array a list of create timestamp columns. Db_ActiveRecord
auto_timestamps boolean determines whether create and update timestamp field should be set automatically. Db_ActiveRecord
auto_update_timestamps array a list of update timestamp columns. Db_ActiveRecord
belongs_to array contains a list of Belongs To Many relations. Db_ActiveRecord
calculated_columns array contains a list of calculated columns. Db_ActiveRecord
custom_columns array contains a list of custom fields definition. Db_ActiveRecord
depth float specifies the extra option depth. Shop_ExtraOption
description string specifies the extra option description. Shop_ExtraOption
fetched array contains an associative array of table column values fetched from the database. Db_ActiveRecord
group_name string specifies the extra option group name. Shop_ExtraOption
has_and_belongs_to_many array contains a list of Has and Belongs To Many relations. Db_ActiveRecord
has_one array contains a list of Has One relations. Db_ActiveRecord
height float specifies the extra option height. Shop_ExtraOption
id integer specifies the extra option record identifier. Shop_ExtraOption
images Db_DataCollection a collection of the extra option images. Shop_ExtraOption
option_key string specifies the extra option key. Shop_ExtraOption
price float specifies the extra option price. Shop_ExtraOption
primary_key string specifies a name of the table primary key. Db_ActiveRecord
validation Phpr_Validation contains the model's validation object. Db_ActiveRecord
weight float specifies the extra option weight. Shop_ExtraOption
width float specifies the extra option width. Shop_ExtraOption

Public methods

Show inherited methods.

Method Description Defined By
add_form_custom_area() adds a form custom area. Db_ActiveRecord
add_form_field() makes a column visible in forms. Db_ActiveRecord
add_form_partial() adds a custom form partial. Db_ActiveRecord
add_form_section() adds a form section. Db_ActiveRecord
after_create_saved() called after a new object is saved to the database. Db_ActiveRecord
after_delete() called after an existing or new record is deleted from the database. Db_ActiveRecord
after_save() called after an existing or new record is created or updated in the database. Db_ActiveRecord
after_update() called after an existing record is updated in the database. Db_ActiveRecord
after_validation() triggered after the model column values are validated. Db_ActiveRecord
after_validation_on_create() triggered after a new model column values are validated. Db_ActiveRecord
after_validation_on_update() triggered after an existing model column values are validated. Db_ActiveRecord
before_create() called before a new object is saved to the database. Db_ActiveRecord
before_delete() called before a record is deleted from the database. Db_ActiveRecord
before_update() called before an existing record is updated in the database. Db_ActiveRecord
before_validation() triggered before the model column values are validated. Db_ActiveRecord
before_validation_on_create() triggered before a new model column values are validated. Db_ActiveRecord
before_validation_on_update() triggered before an existing model column values are validated. Db_ActiveRecord
collection() executes the find_all() method and returns a collection. Db_ActiveRecord
columnValue() alias for the displayField() method. Db_ActiveRecord
define_column() adds a column definition to the model. Db_ActiveRecord
define_multi_relation_column() adds column definition for has_and_belongs_to_many or has_many relation field. Db_ActiveRecord
define_relation_column() adds column definition for has_on or belongs_to relation field. Db_ActiveRecord
delete() deletes the record from the database. Db_ActiveRecord
delete_form_field() deletes a form field by its corresponding column name. Db_ActiveRecord
displayField() returns a formatted column value. The field should be defined with define_column(), Db_ActiveRecord
find() finds a record by its primary key value. Db_ActiveRecord
find_all() finds all records and returns the Db_DataCollection object, containing a list of models. Db_ActiveRecord
find_by() finds a record by a field value. Db_ActiveRecord
find_column_definition() finds a column definition by the column name. Db_ActiveRecord
find_form_field() finds a form field definition by its corresponding column name. Db_ActiveRecord
find_product_extra_option() finds an extra option belonging to a specific product. Shop_ExtraOption
get_group_names() returns a list of extra option group names. Shop_ExtraOption
get_price() returns the extra option price taking into account the. Shop_ExtraOption
get_price_no_tax() returns the extra option price without the tax included, regardless of the. Shop_ExtraOption
join() adds a table to the query with JOIN statement. Db_SqlBase
limit() allows to limit the result of the find_all() method with the specified number of records. Db_ActiveRecord
list_related_records_deferred() returns a list of relation objects, taking into account deferred relations. Db_ActiveRecord
order() allows to order the result of the find_all() method by a specific table column. Db_SqlBase
orWhere() adds OR statement to the where clause, allowing to to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase
paginate() allows to limit the result of the find_all() method with a single page of records. Db_ActiveRecord
requestRowCount() returns a number of rows which would be returned with find_all() method. Db_ActiveRecord
save() saves record to the database. Db_ActiveRecord
volume() returns the extra option volume. Shop_ExtraOption
where() allows to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase

Events

Event Description
shop:onExtendExtraOptionForm Allows to add new fields to the Create/Edit Extra Option form in the Administration Area.
shop:onExtendExtraOptionModel Allows to define new columns in the extra option model.
shop:onGetExtraOptionFieldOptions Allows to populate drop-down, radio- or checkbox list fields, which have been added with shop:onExtendExtraOptionForm event.
shop:onGetProductExtraPrice Allows to override a product's extra option price.

Property details

depth property

public float $depth;
Specifies the extra option depth.

description property

public string $description;
Specifies the extra option description.

group_name property

public string $group_name;
Specifies the extra option group name.

height property

public float $height;
Specifies the extra option height.

id property

public integer $id;
Specifies the extra option record identifier.

images property

public Db_DataCollection $images;
A collection of the extra option images. Each element in the collection is an object of Db_File class.

option_key property

public string $option_key;
Specifies the extra option key.

price property

public float $price;
Specifies the extra option price.

weight property

public float $weight;
Specifies the extra option weight.

width property

public float $width;
Specifies the extra option width.

Method details

find_product_extra_option() method

public static Shop_ExtraOption find_product_extra_option(Shop_Product $product, string $extra_key)
$product Shop_Product specifies the product object.
$extra_key string specifies the extra option key.
{return} Shop_ExtraOption returns the extra option object. Returns NULL if the extra option is not found.
Finds an extra option belonging to a specific product.

get_group_names() method

public static array get_group_names()
{return} array returns an array of extra option group names.
Returns a list of extra option group names.

get_price() method

public float get_price(Shop_Product $product, boolean $force_tax=false)
$product Shop_Product specifies a product the extra option belongs to.
$force_tax boolean forces the method to include tax into the result.
{return} float returns the extra option price.
Returns the extra option price taking into account the tax inclusive settings. Example:
<? foreach ($product->extra_options as $option): ?>
  <?= h($option->description) ?>: <?= format_currency($option->get_price($product)) ?>
<? endforeach ?>

get_price_no_tax() method

public float get_price_no_tax(Shop_Product $product)
$product Shop_Product specifies a product the extra option belongs to.
{return} float returns the extra option price.
Returns the extra option price without the tax included, regardless of the tax configuration.

volume() method

public float volume()
{return} float returns the extra option volume.
Returns the extra option volume.