SilverShop\Discounts\Model\OrderDiscount
Order discounts.
This class is needed to clearly distinguish between coupons and generic
discounts.
Synopsis
class OrderDiscount
extends Discount
{
- // members
- private static string $table_name = 'SilverShop_OrderDiscount';
- // Inherited members from Discount
- protected $message;
- protected $messagetype;
- // Inherited methods from Discount
- public array getConstraints()
- public static ArrayList get_matching()
- public void getCMSFields()
- public void getDefaultSearchContext()
- public boolean validateOrder()
- public DataObject setCastedField()
- public calculated getDiscountValue()
- public void getDiscountNice()
- public void getAmount()
- public int getUseCount()
- public boolean isUsed()
- public void setPercent()
- public void setFor()
- public string getFor()
- public DataList getAppliedOrders()
- public float getSavingsTotal()
- public double getSavingsForOrder()
- public void canView()
- public void canCreate()
- public void canDelete()
- public void canEdit()
- protected void message()
- protected void error()
- public void getMessage()
- public void getMessageType()
- public void providePermissions()
- public bool valid()
Hierarchy
Members
private
- $table_name
protected
- $message
- $messagetype
Methods
Inherited from SilverShop\Discounts\Model\Discount
protected
public
- canCreate()
- canDelete()
- canEdit()
- canView()
- getAmount() — Get discounting amount
- getAppliedOrders() — Get the orders that this discount has been used on.
- getCMSFields()
- getConstraints()
- getDefaultSearchContext()
- getDiscountNice()
- getDiscountValue() — Works out the discount on a given value.
- getFor()
- getMessage()
- getMessageType()
- getSavingsForOrder() — Get the amount saved on the given order with this discount.
- getSavingsTotal() — Get the total amount saved through the use of this discount, accross all paid orders.
- getUseCount() — Get the number of times a discount has been used.
- get_matching() — Get the smallest possible list of discounts that can apply to a given order.
- isUsed() — Returns whether this coupon is used.
- providePermissions()
- setCastedField() — We have to tap in here to correct "50" to "0.5" for the percent field. This is a common user error and it's nice to just fix it for them.
- setFor() — Map the single 'For' to the For"X" boolean fields
- setPercent()
- valid()
- validateOrder() — Check if this coupon can be used with a given order