Blesta Source Documentation

CouponPackageOptions extends AppModel

Coupon Package Option management

Table of Contents

Methods

__construct() Initialize CouponPackageOptions
add() Creates a new coupon package option limitation
delete() Permanently removes the coupon package option from the system
edit() Edits a coupon package option limitation
get() Gets the specified coupon package option if it meets the given criteria
getAll() Gets all coupon package options that meet the given criteria
validatePackageOptions() Validates that the given option limitation matches the service package options
getPackageOptions() Gets all coupon package options that meet the given criteria
getRules() Returns the rule set for adding/editing coupon package options
Methods

add()

Creates a new coupon package option limitation

public add(array<string|int, mixed> $vars) : int
Parameters
$vars : array<string|int, mixed>

An array of coupon package option information including:

  • coupon_id The coupon ID this package option limitation belongs to
  • option_group_id The package option group ID this limitation belongs to
  • option_id The package option ID this limitation applies to
  • option_value_ids JSON encoded array of option value IDs (for radio/dropdown/checkbox)
  • min_quantity Minimum quantity required (for quantity type options)
  • regex_pattern Regex pattern for text validation (for text/textarea/password)
Return values
int

The ID for this coupon package option

delete()

Permanently removes the coupon package option from the system

public delete(int $coupon_id[, int $package_option_id = null ]) : mixed
Parameters
$coupon_id : int

The ID of the coupon to delete package options for

$package_option_id : int = null

The ID of the coupon package option to delete (optional)

edit()

Edits a coupon package option limitation

public edit(int $package_option_id, array<string|int, mixed> $vars) : mixed
Parameters
$package_option_id : int

The ID of the coupon package option to update

$vars : array<string|int, mixed>

An array of coupon package option information including:

  • coupon_id The coupon ID this package option limitation belongs to
  • option_group_id The package option group ID this limitation belongs to
  • option_id The package option ID this limitation applies to
  • option_value_ids JSON encoded array of option value IDs (for radio/dropdown/checkbox)
  • min_quantity Minimum quantity required (for quantity type options)
  • regex_pattern Regex pattern for text validation (for text/textarea/password)

get()

Gets the specified coupon package option if it meets the given criteria

public get(int $package_option_id[, array<string|int, mixed> $criteria = [] ]) : The
Parameters
$package_option_id : int

The ID of the coupon package option to fetch

$criteria : array<string|int, mixed> = []

A list of criteria to filter by, including:

  • coupon_id The coupon ID this package option limitation belongs to
  • option_id The package option ID this limitation applies to
Return values
The

given coupon package option, false on failure

getAll()

Gets all coupon package options that meet the given criteria

public getAll([array<string|int, mixed> $criteria = [] ]) : mixed
Parameters
$criteria : array<string|int, mixed> = []

A list of criteria to filter by, including:

  • coupon_id The coupon ID this package option limitation belongs to
  • option_id The package option ID this limitation applies to

validatePackageOptions()

Validates that the given option limitation matches the service package options

public validatePackageOptions(int $coupon_id, array<string|int, mixed> $package_options) : bool
Parameters
$coupon_id : int

The ID of the coupon

$package_options : array<string|int, mixed>

An array of service package options

Return values
bool

True if all coupon package option limitations are met, false otherwise

getPackageOptions()

Gets all coupon package options that meet the given criteria

private getPackageOptions([array<string|int, mixed> $criteria = [] ]) : Record
Parameters
$criteria : array<string|int, mixed> = []

A list of criteria to filter by, including:

  • id The ID of the coupon package option to fetch
  • coupon_id The coupon ID this package option limitation belongs to
  • option_id The package option ID this limitation applies to
Return values
Record

The partially constructed query Record object

getRules()

Returns the rule set for adding/editing coupon package options

private getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

A list of input vars

$edit : bool = false

True to get the edit rules, false for the add rules

Return values
array<string|int, mixed>

Coupon package option rules

Tags
subpackage

app.models

copyright

Copyright (c) 2025, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results