PHP Class Order

Inheritance: extends AppModel
Show file Open project: yupe/yupe Class Usage Examples

Public Properties

Property Type Description
$couponId null

Protected Properties

Property Type Description
$oldAttributes

Public Methods

Method Description
afterDelete ( )
afterFind ( )
afterSave ( )
applyCoupons ( array $coupons ) : boolean
attributeLabels ( ) : array
beforeSave ( ) : boolean
beforeValidate ( ) : boolean
behaviors ( ) : array
checkManager ( IWebUser $user ) : boolean
findByNumber ( $number ) : static
findByUrl ( $url ) : static
getAddress ( ) : string
getCouponDiscount ( array $coupons ) : float Получает скидку для переданных купонов
getCoupons ( ) : mixed
getCouponsCodes ( ) : array
getDeliveryCost ( ) : integer | mixed
getDeliveryPrice ( ) : float
getPaidStatus ( ) : string
getPaidStatusList ( ) : array
getProducts ( ) : CActiveDataProvider
getProductsCost ( ) : float | integer
getStatusTitle ( ) : string
getTotalPrice ( ) : float
getTotalPriceWithDelivery ( ) : float
getValidCoupons ( $codes ) : Coupon[] Фильтрует переданные коды купонов и возвращает объекты купонов
hasCoupons ( ) : boolean
isCouponsAvailable ( ) : boolean
isPaid ( ) : boolean
isPaymentMethodSelected ( ) : mixed
isStatusChanged ( ) : boolean
model ( null | string $className = __CLASS__ )
pay ( Payment $payment, integer $paid = self::PAID_STATUS_PAID ) : boolean
relations ( ) : array
rules ( ) : array
scopes ( ) : array
search ( ) : CActiveDataProvider
searchCoupons ( ) : CActiveDataProvider
setProducts ( $orderProducts ) Формат массива:
array(
   '45' => array( //реальный id или сгенерированный новый, у новых внутри массива нет id
       'id' => '10', //если нет id, то новый
       'variant_ids' => array('10', '20, '30'), // массив с id вариантов
       'quantity' = > '5',
       'price' => '1000',
       'product_id' => '123',
   )
)
store ( array $attributes, array $products, integer $client = null, integer $status = OrderStatus::STATUS_NEW ) : boolean
tableName ( ) : string

Private Methods

Method Description
updateOrderProducts ( $products ) Массив объектов OrderProduct

Method Details

afterDelete() public method

public afterDelete ( )

afterFind() public method

public afterFind ( )

afterSave() public method

public afterSave ( )

applyCoupons() public method

public applyCoupons ( array $coupons ) : boolean
$coupons array
return boolean

attributeLabels() public method

public attributeLabels ( ) : array
return array customized attribute labels (name=>label)

beforeSave() public method

public beforeSave ( ) : boolean
return boolean

beforeValidate() public method

public beforeValidate ( ) : boolean
return boolean

behaviors() public method

public behaviors ( ) : array
return array

checkManager() public method

public checkManager ( IWebUser $user ) : boolean
$user IWebUser
return boolean

findByNumber() public method

public findByNumber ( $number ) : static
$number
return static

findByUrl() public method

public findByUrl ( $url ) : static
$url
return static

getAddress() public method

public getAddress ( ) : string
return string

getCouponDiscount() public method

Получает скидку для переданных купонов
public getCouponDiscount ( array $coupons ) : float
$coupons array Coupon[]
return float - скидка

getCoupons() public method

public getCoupons ( ) : mixed
return mixed

getCouponsCodes() public method

public getCouponsCodes ( ) : array
return array

getDeliveryCost() public method

public getDeliveryCost ( ) : integer | mixed
return integer | mixed

getDeliveryPrice() public method

public getDeliveryPrice ( ) : float
return float

getPaidStatus() public method

public getPaidStatus ( ) : string
return string

getPaidStatusList() public method

public getPaidStatusList ( ) : array
return array

getProducts() public method

public getProducts ( ) : CActiveDataProvider
return CActiveDataProvider

getProductsCost() public method

public getProductsCost ( ) : float | integer
return float | integer

getStatusTitle() public method

public getStatusTitle ( ) : string
return string

getTotalPrice() public method

public getTotalPrice ( ) : float
return float

getTotalPriceWithDelivery() public method

public getTotalPriceWithDelivery ( ) : float
return float

getValidCoupons() public method

Фильтрует переданные коды купонов и возвращает объекты купонов
public getValidCoupons ( $codes ) : Coupon[]
$codes - массив кодов купонов
return Coupon[] - массив объектов-купонов

hasCoupons() public method

public hasCoupons ( ) : boolean
return boolean

isCouponsAvailable() public method

public isCouponsAvailable ( ) : boolean
return boolean

isPaid() public method

public isPaid ( ) : boolean
return boolean

isPaymentMethodSelected() public method

public isPaymentMethodSelected ( ) : mixed
return mixed

isStatusChanged() public method

public isStatusChanged ( ) : boolean
return boolean

model() public static method

public static model ( null | string $className = __CLASS__ )
$className null | string

pay() public method

public pay ( Payment $payment, integer $paid = self::PAID_STATUS_PAID ) : boolean
$payment Payment
$paid integer
return boolean

relations() public method

public relations ( ) : array
return array

rules() public method

public rules ( ) : array
return array validation rules for model attributes.

scopes() public method

public scopes ( ) : array
return array

searchCoupons() public method

public searchCoupons ( ) : CActiveDataProvider
return CActiveDataProvider

setProducts() public method

Формат массива:
array(
   '45' => array( //реальный id или сгенерированный новый, у новых внутри массива нет id
       'id' => '10', //если нет id, то новый
       'variant_ids' => array('10', '20, '30'), // массив с id вариантов
       'quantity' = > '5',
       'price' => '1000',
       'product_id' => '123',
   )
)
public setProducts ( $orderProducts )
$orderProducts Array

store() public method

public store ( array $attributes, array $products, integer $client = null, integer $status = OrderStatus::STATUS_NEW ) : boolean
$attributes array
$products array
$client integer
$status integer
return boolean

tableName() public method

public tableName ( ) : string
return string the associated database table name

Property Details

$couponId public property

public null $couponId
return null

$oldAttributes protected property

protected $oldAttributes