PHP Interface Buyable, silvershop-core

Show file Open project: burnbright/silverstripe-shop Interface Usage Examples

Public Methods

Method Description
canPurchase ( Member | null $member = null, integer $quantity = 1 ) : boolean Checks if the buyable can be purchased. If a buyable cannot be purchased then the method should return false
createItem ( integer $quantity = 1, array $filter = [] ) : OrderItem Create a new OrderItem to add to an order.
sellingPrice ( ) : ShopCurrency The price the customer gets this buyable for, with any additional additions or subtractions.

Method Details

canPurchase() public method

Checks if the buyable can be purchased. If a buyable cannot be purchased then the method should return false
public canPurchase ( Member | null $member = null, integer $quantity = 1 ) : boolean
$member Member | null the Member that wants to purchase the buyable. Defaults to null
$quantity integer the quantity to purchase. Defaults to 1
return boolean true if the buyable can be purchased

createItem() public method

Create a new OrderItem to add to an order.
public createItem ( integer $quantity = 1, array $filter = [] ) : OrderItem
$quantity integer
$filter array
return OrderItem new OrderItem object

sellingPrice() public method

The price the customer gets this buyable for, with any additional additions or subtractions.
public sellingPrice ( ) : ShopCurrency
return ShopCurrency