Blesta Source Documentation

CouponTerms extends AppModel

Coupon term management

Table of Contents

Methods

__construct() Initialize Coupons
add() Creates a new coupon term
delete() Permanently removes the coupon term from the system
edit() Edits a coupon term
get() Gets the specified coupon term if it meets the given criteria
getAll() Gets all coupon terms that meet the given criteria
getPeriods() Gets a list of valid periods for coupon terms
getRules() Returns the rule set for adding/editing coupon terms
getTerms() Gets all coupon terms that meet the given criteria
Methods

__construct()

Initialize Coupons

public __construct() : mixed

add()

Creates a new coupon term

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

An array of coupon term information including:

  • coupon_id The coupon ID this coupon term belongs to
  • term The number of periods for this coupon term
  • period The period for this coupon term
Return values
int

The ID for this coupon term

delete()

Permanently removes the coupon term from the system

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

The ID of the coupon to delete terms for

$term_id : int = null

The ID of the coupon term to delete (optional)

edit()

Edits a coupon term

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

The ID of the coupon term to update

$vars : array<string|int, mixed>

An array of coupon term information including:

  • coupon_id The coupon ID this coupon term belongs to
  • term The number of periods for this coupon term
  • period The period for this coupon term

get()

Gets the specified coupon term if it meets the given criteria

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

The ID of the coupon term to fetch

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

A list of criteria to filter by, including:

  • coupon_id The coupon ID this coupon term belongs to
  • term The number of periods for this coupon term
  • period The period for this coupon term
Return values
The

given coupon term, false on failure

getAll()

Gets all coupon terms 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 coupon term belongs to
  • term The number of periods for this coupon term
  • period The period for this coupon term

getPeriods()

Gets a list of valid periods for coupon terms

public getPeriods() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list of valid periods and their language

getRules()

Returns the rule set for adding/editing coupon terms

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 term rules

getTerms()

Gets all coupon terms that meet the given criteria

private getTerms([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 term to fetch
  • coupon_id The coupon ID this coupon term belongs to
  • term The number of periods for this coupon term
  • period The period for this coupon term
Return values
Record

The partially constructed query Record object

Tags
subpackage

app.models

copyright

Copyright (c) 2017, Phillips Data, Inc.

license

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

link

Blesta


        
On this page

Search results