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_BundleItemProduct class

Defined in /modules/shop/models/shop_bundleitemproduct.php, lines 23-200
Inheritance Phpr_Extension » Phpr_Extensible » Phpr_Validatable » Db_Base » Db_WhereBase » Db_SqlBase » Db_ActiveRecord » Shop_BundleItemProduct
Author LemonStand eCommerce Inc.
Represents a product record in a bundle item. Usually you don't need to create objects of this class directly, because Bundle Helper class has methods for manipulating with objects of this class.

Public properties

Show inherited properties.

Property Type Description Defined By
allow_manual_quantity boolean determines whether manual quantity input is allowed for this product. Shop_BundleItemProduct
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
bundle_item Shop_ProductBundleItem a reference to the parent bundle item object. Shop_BundleItemProduct
calculated_columns array contains a list of calculated columns. Db_ActiveRecord
custom_columns array contains a list of custom fields definition. Db_ActiveRecord
default_quantity integer specifies the default product quantity. Shop_BundleItemProduct
fetched array contains an associative array of table column values fetched from the database. Db_ActiveRecord
has_and_belongs_to_many array contains a list of Has and Belongs To Many relations. Db_ActiveRecord
has_many array contains a list of Has Many relations. Db_ActiveRecord
has_one array contains a list of Has One relations. Db_ActiveRecord
id integer specifies the bundle item product identifier. Shop_BundleItemProduct
is_default boolean determines whether this product is a default product in the bundle item. Shop_BundleItemProduct
primary_key string specifies a name of the table primary key. Db_ActiveRecord
product Shop_Product a reference to the product associated with this bundle item product record. Shop_BundleItemProduct
product_id integer identifier of a product (Shop_Product) object associated with this bundle item product record. Shop_BundleItemProduct
validation Phpr_Validation contains the model's validation object. Db_ActiveRecord

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() called after a new object is saved to the database. 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_modify() called after an existing or new record was modified. 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_save() called before an existing or new record is created or updated in 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_by_id() finds a bundle item product by its identifier. Shop_BundleItemProduct
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
get_price() returns the bundle item product price. Shop_BundleItemProduct
get_price_no_tax() returns the bundle item product price without any taxes applied. Shop_BundleItemProduct
get_sale_price() returns the bundle item product sale price. Shop_BundleItemProduct
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
where() allows to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase

Property details

allow_manual_quantity property

public boolean $allow_manual_quantity;
Determines whether manual quantity input is allowed for this product.

bundle_item property

public Shop_ProductBundleItem $bundle_item;
A reference to the parent bundle item object.

default_quantity property

public integer $default_quantity;
Specifies the default product quantity.

id property

public integer $id;
Specifies the bundle item product identifier.

is_default property

public boolean $is_default;
Determines whether this product is a default product in the bundle item.

product property

public Shop_Product $product;
A reference to the product associated with this bundle item product record.

product_id property

public integer $product_id;
Identifier of a product (Shop_Product) object associated with this bundle item product record.

Method details

find_by_id() method

public static Shop_BundleItemProduct find_by_id(integer $id)
$id integer specifies the bundle item product identifier.
{return} Shop_BundleItemProduct returns the bundle item product object. Returns NULL if the object is not found.
Finds a bundle item product by its identifier.

get_price() method

public float get_price(Shop_Product $product=NULL, array $product_options=NULL, boolean $apply_catalog_price_rules=false)
$product Shop_Product currently selected product object. If no object provided, the product assigned to the item will be used.
$product_options array specifies selected product options (Option Matrix support)
$apply_catalog_price_rules boolean determines whether catalog price rules should be applied to the result. Pass TRUE to this parameter to get the item sale price.
{return} float returns the bundle item product price.
Returns the bundle item product price. Takes into account the price mode settings applied to the product. Applies the tax if it is required by the configuration. The optional $product parameter represents a currently selected product object. If no object provided, the product assigned to the item will be used. If you use Option Matrix feature, pass selected bundle item product's options to the second parameter. Use Shop_BundleHelper::get_selected_options() method to load the selected options. Example:
$selected_options = Shop_BundleHelper::get_selected_options($item, $item_product);
Price: <?= format_currency($item_product->get_price($product, $selected_options)) ?>

get_price_no_tax() method

public float get_price_no_tax(Shop_Product $product=NULL, integer $quantity=1, integer $customer_group_id=NULL, array $product_options=NULL, boolean $apply_catalog_price_rules=false)
$product Shop_Product currently selected product object. If no object provided, the product assigned to the item will be used.
$quantity integer specifies the product quantity ordered.
$customer_group_id integer specifies an identifier of a customer group. If no value provided, uses the current front-end customer's group identifier.
$product_options array specifies selected product options (Option Matrix support)
$apply_catalog_price_rules boolean determines whether catalog price rules should be applied to the result. Pass TRUE to this parameter to get the item sale price.
{return} float returns the bundle item product price without any taxes applied.
Returns the bundle item product price without any taxes applied. The optional $product parameter represents a currently selected product object. If no object provided, the product assigned to the item will be used. Usually using of this method is not necessary in front-end code - use get_price() method instead.

get_sale_price() method

public float get_sale_price(Shop_Product $product=NULL, array $product_options=NULL)
$product Shop_Product currently selected product object. If no object provided, the product assigned to the item will be used.
$product_options array specifies selected product options (Option Matrix support)
{return} float returns the bundle item product sale price.
Returns the bundle item product sale price. Takes into account the price mode settings applied to the product. Applies the tax if it is required by the configuration. The optional $product parameter represents a currently selected product object. If no object provided, the product assigned to the item will be used. If you use Option Matrix feature, pass selected bundle item product's options to the second parameter. Use Shop_BundleHelper::get_selected_options() method to load the selected options. Example:
$selected_options = Shop_BundleHelper::get_selected_options($item, $item_product);
Sale price: <?= format_currency($item_product->get_sale_price($product, $selected_options)) ?>