1 | <?php |
||
29 | class PriceModifier extends DataObject implements PriceModifierInterface |
||
30 | { |
||
31 | private static $db = array( |
||
|
|||
32 | 'Title' => 'Varchar(255)', |
||
33 | 'Sort' => 'Int' |
||
34 | ); |
||
35 | |||
36 | private static $default_sort = 'Sort ASC, ID DESC'; |
||
37 | |||
38 | private static $defaults = array( |
||
39 | 'Sort' => 0 |
||
40 | ); |
||
41 | |||
42 | private static $many_many = array( |
||
43 | 'Reservations' => 'Broarm\EventTickets\Reservation' |
||
44 | ); |
||
45 | |||
46 | private static $many_many_extraFields = array( |
||
47 | 'Reservations' => array( |
||
48 | 'PriceModification' => 'Currency' |
||
49 | ) |
||
50 | ); |
||
51 | |||
52 | private static $casting = array( |
||
53 | 'TableValue' => 'Currency' |
||
54 | ); |
||
55 | |||
56 | private static $summary_fields = array( |
||
57 | 'TableTitle', |
||
58 | 'TableValue' |
||
59 | ); |
||
60 | |||
61 | public function getCMSFields() |
||
71 | |||
72 | /** |
||
73 | * Modify the given total |
||
74 | * Implement this on your modifier |
||
75 | * |
||
76 | * @param float $total |
||
77 | * @param Reservation $reservation |
||
78 | */ |
||
79 | public function updateTotal(&$total, Reservation $reservation) {} |
||
80 | |||
81 | /** |
||
82 | * Return a title to display in the summary table |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getTableTitle() |
||
90 | |||
91 | /** |
||
92 | * Return a value to display in the summary table |
||
93 | * |
||
94 | * By default go out from a price reduction. |
||
95 | * if you created a modifier that adds value, like a shipping calculator, make sure to overwrite this method |
||
96 | * |
||
97 | * @return float |
||
98 | */ |
||
99 | public function getTableValue() |
||
103 | |||
104 | /** |
||
105 | * Set the price modification on the join |
||
106 | * |
||
107 | * @param $value |
||
108 | */ |
||
109 | public function setPriceModification($value) |
||
123 | } |
||
124 |