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

Defined in /modules/shop/models/shop_shippingoption.php, lines 38-1150
Inheritance Phpr_Extension » Phpr_Extensible » Phpr_Validatable » Db_Base » Db_WhereBase » Db_SqlBase » Db_ActiveRecord » Shop_ShippingOption
Author LemonStand eCommerce Inc.
Represents a shipping option. Object of this class is available through the $shipping_method property of the Shop_Order class. Also, a collection of shipping option objects is available on the Shipping Method step of the Checkout process.

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
description string specifies the shipping option description in plain text format. Shop_ShippingOption
error_hint string contains an error message returned by the shipping service provider. Shop_ShippingOption
fetched array contains an associative array of table column values fetched from the database. 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 option identifier in the database. Shop_ShippingOption
is_free boolean determines whether the shipping option is free. Shop_ShippingOption
ls_api_code string specifies the option API code. Shop_ShippingOption
multi_option boolean indicates whether the option has sub-options. Shop_ShippingOption
multi_option_name boolean specifies the name of the parent option for sub-options. Shop_ShippingOption
name string specifies the shipping option name. Shop_ShippingOption
primary_key string specifies a name of the table primary key. Db_ActiveRecord
quote float specifies the shipping quote. Shop_ShippingOption
sub_options array contains a list of sub-options of a multi-option shipping method. Shop_ShippingOption
taxable boolean determines whether tax is applicable for the shipping option. Shop_ShippingOption
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_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_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_api_code() finds a shipping option by its API code. Shop_ShippingOption
find_by_id() finds a shipping option by its identifier code. Shop_ShippingOption
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
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

Events

Event Description
shop:onBeforeShippingQuote Allows to update shipping parameters before they are sent to a shipping method.
shop:onExtendShippingOptionForm Allows to add new fields to the Create/Edit Shipping Option form in the Administration Area.
shop:onExtendShippingOptionModel Allows to define new columns in the shipping option model.
shop:onFilterShippingOptions Allows to filter the shipping option list before it is displayed on the checkout pages.
shop:onGetShippingOptionFieldOptions Allows to populate drop-down, radio- or checkbox list fields, which have been added with shop:onExtendShippingOptionForm event.
shop:onUpdateShippingQuote Allows to update a shipping quote calculated by a regular shipping method.

Property details

description property

public string $description;
Specifies the shipping option description in plain text format.

error_hint property

public string $error_hint;
Contains an error message returned by the shipping service provider. By default LemonStand does not return shipping options with errors. You can enable this feature on the System/Settings/Shipping Configuration page, on the Parameters tab. If this field is not empty, its content should be displayed instead of the option price and radio button.

id property

public integer $id;
Specifies the option identifier in the database.

is_free property

public boolean $is_free;
Determines whether the shipping option is free.

ls_api_code property

public string $ls_api_code;
Specifies the option API code.

multi_option property

public boolean $multi_option;
Indicates whether the option has sub-options. Some shipping methods can have multiple options, for example UPS Standard and UPS Express.

multi_option_name property

public boolean $multi_option_name;
Specifies the name of the parent option for sub-options. This property is set in the flat shipping option lists. See shop:on_evalShippingRate, shop:checkout.

name property

public string $name;
Specifies the shipping option name.

quote property

public float $quote;
Specifies the shipping quote. This property is applicable only during the Checkout process.

sub_options property

public array $sub_options;
Contains a list of sub-options of a multi-option shipping method. Each element of the array is an object with the following fields:
  • id - specifies the sub-option identifier. Identifiers are specific for each shipping method.
  • name - specifies the sub-option name.
  • quote - specifies the sub-option shipping quote.
  • is_free - indicates whether the sub-option is free

taxable property

public boolean $taxable;
Determines whether tax is applicable for the shipping option.

Method details

find_by_api_code() method

public static Shop_ShippingOption find_by_api_code(string $code)
$code string specifies the API code.
{return} Shop_ShippingOption returns the shipping option object. Returns NULL if the record with the specified API code is not found.
Finds a shipping option by its API code.

find_by_id() method

public static Shop_ShippingOption find_by_id(string $code)
$code string specifies the API code.
{return} Shop_ShippingOption returns the shipping option object. Returns NULL if the record with the specified API code is not found.
Finds a shipping option by its identifier code. This method uses internal memory caching.