Total Complexity | 6 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | class ProductDataExtension extends DataExtension |
||
18 | { |
||
19 | /** |
||
20 | * @var string[] |
||
21 | */ |
||
22 | private static $db = [ |
||
1 ignored issue
–
show
|
|||
23 | //'ExcludeFromDiscounts' => 'Boolean', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $belongs_many_many = [ |
||
30 | 'Discounts' => Discount::class, |
||
31 | ]; |
||
32 | |||
33 | public function updateCMSFields(FieldList $fields) |
||
34 | { |
||
35 | /*$fields->addFieldToTab( |
||
36 | 'Root.' |
||
37 | );//*/ |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param int $quantity |
||
42 | * @return DiscountHelper |
||
43 | */ |
||
44 | public function getBestDiscount($quantity = 1) |
||
45 | { |
||
46 | return DiscountHelper::create($this->owner, $quantity); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param int $quantity |
||
51 | * @return false|DBCurrency |
||
52 | */ |
||
53 | public function getDiscountPrice($quantity = 1) |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function getHasDiscount() |
||
74 |