PHP 클래스 EShoppingCart

저자: pirrat ([email protected])
상속: extends CMap
파일 보기 프로젝트 열기: yupe/yupe 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cartId string
$discounts array
$refresh boolean Update the model on session restore?

보호된 프로퍼티들

프로퍼티 타입 설명
$couponManager CouponManager
$discountPrice float Cart-wide discount sum
$eventManager yupe\components\EventManager

공개 메소드들

메소드 설명
add ( mixed $key, mixed $value ) : void Add $value items to position with $key specified
addDiscountPrice ( float $price ) : void Add $price to cart-wide discount sum
getCost ( boolean $withDiscount = true ) : float Returns total price for all items in the shopping cart.
getCouponManager ( ) : CouponManager
getItemsCount ( ) : integer Returns count of items in shopping cart
getPositions ( ) : array Returns array all positions
init ( )
isEmpty ( ) : boolean Returns if cart is empty
put ( IECartPosition $position, $quantity = 1 ) Add item to the shopping cart If the position was previously added to the cart, then information about it is updated, and count increases by $quantity
remove ( mixed $key ) : mixed | void Removes position from the shopping cart of key
restoreFromSession ( ) Restores the shopping cart from the session
setDiscountPrice ( float $price ) : void Set cart-wide discount sum
update ( IECartPosition $position, integer $quantity ) Updates the position in the shopping cart If position was previously added, then it will be updated in shopping cart, if position was not previously in the cart, it will be added there.

보호된 메소드들

메소드 설명
applyDiscounts ( ) : void Apply discounts to all positions
saveState ( ) : void Saves the state of the object in the session.

메소드 상세

add() 공개 메소드

Add $value items to position with $key specified
public add ( mixed $key, mixed $value ) : void
$key mixed
$value mixed
리턴 void

addDiscountPrice() 공개 메소드

Add $price to cart-wide discount sum
public addDiscountPrice ( float $price ) : void
$price float
리턴 void

applyDiscounts() 보호된 메소드

Apply discounts to all positions
protected applyDiscounts ( ) : void
리턴 void

getCost() 공개 메소드

Returns total price for all items in the shopping cart.
public getCost ( boolean $withDiscount = true ) : float
$withDiscount boolean
리턴 float

getCouponManager() 공개 메소드

public getCouponManager ( ) : CouponManager
리턴 CouponManager

getItemsCount() 공개 메소드

Returns count of items in shopping cart
public getItemsCount ( ) : integer
리턴 integer

getPositions() 공개 메소드

Returns array all positions
public getPositions ( ) : array
리턴 array

init() 공개 메소드

public init ( )

isEmpty() 공개 메소드

Returns if cart is empty
public isEmpty ( ) : boolean
리턴 boolean

put() 공개 메소드

Add item to the shopping cart If the position was previously added to the cart, then information about it is updated, and count increases by $quantity
public put ( IECartPosition $position, $quantity = 1 )
$position IECartPosition

remove() 공개 메소드

Removes position from the shopping cart of key
public remove ( mixed $key ) : mixed | void
$key mixed
리턴 mixed | void

restoreFromSession() 공개 메소드

Restores the shopping cart from the session
public restoreFromSession ( )

saveState() 보호된 메소드

Saves the state of the object in the session.
protected saveState ( ) : void
리턴 void

setDiscountPrice() 공개 메소드

Set cart-wide discount sum
public setDiscountPrice ( float $price ) : void
$price float
리턴 void

update() 공개 메소드

If count is less than 1, the position will be deleted.
public update ( IECartPosition $position, integer $quantity )
$position IECartPosition
$quantity integer

프로퍼티 상세

$cartId 공개적으로 프로퍼티

public string $cartId
리턴 string

$couponManager 보호되어 있는 프로퍼티

protected CouponManager $couponManager
리턴 CouponManager

$discountPrice 보호되어 있는 프로퍼티

Cart-wide discount sum
protected float $discountPrice
리턴 float

$discounts 공개적으로 프로퍼티

public array $discounts
리턴 array

$eventManager 보호되어 있는 프로퍼티

protected EventManager,yupe\components $eventManager
리턴 yupe\components\EventManager

$refresh 공개적으로 프로퍼티

Update the model on session restore?
public bool $refresh
리턴 boolean