1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\CartDiscount; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @package Commercetools\Core\Model\CartDiscount |
10
|
|
|
* |
11
|
|
|
* @method string getType() |
12
|
|
|
* @method MultiBuyLineItemsTarget setType(string $type = null) |
13
|
|
|
* @method string getPredicate() |
14
|
|
|
* @method MultiBuyLineItemsTarget setPredicate(string $predicate = null) |
15
|
|
|
* @method int getTriggerQuantity() |
16
|
|
|
* @method MultiBuyLineItemsTarget setTriggerQuantity(int $triggerQuantity = null) |
17
|
|
|
* @method int getDiscountedQuantity() |
18
|
|
|
* @method MultiBuyLineItemsTarget setDiscountedQuantity(int $discountedQuantity = null) |
19
|
|
|
* @method int getMaxOccurrence() |
20
|
|
|
* @method MultiBuyLineItemsTarget setMaxOccurrence(int $maxOccurrence = null) |
21
|
|
|
* @method string getSelectionMode() |
22
|
|
|
* @method MultiBuyLineItemsTarget setSelectionMode(string $selectionMode = null) |
23
|
|
|
*/ |
24
|
|
|
class MultiBuyLineItemsTarget extends CartDiscountTarget |
25
|
|
|
{ |
26
|
|
|
const TARGET_TYPE = 'multiBuyLineItems'; |
27
|
|
|
const MODE_CHEAPEST = 'Cheapest'; |
28
|
|
|
const MODE_MOST_EXPENSIVE = 'MostExpensive'; |
29
|
|
|
|
30
|
3 |
|
public function fieldDefinitions() |
31
|
|
|
{ |
32
|
|
|
return [ |
33
|
3 |
|
'type' => [static::TYPE => 'string'], |
34
|
3 |
|
'predicate' => [static::TYPE => 'string'], |
35
|
3 |
|
'triggerQuantity' => [static::TYPE => 'int'], |
36
|
3 |
|
'discountedQuantity' => [static::TYPE => 'int'], |
37
|
3 |
|
'maxOccurrence' => [static::TYPE => 'int'], |
38
|
3 |
|
'selectionMode' => [static::TYPE => 'string'], |
39
|
|
|
]; |
40
|
|
|
} |
41
|
|
|
|
42
|
1 |
|
public static function ofPredicateTriggerDiscountedAndMode( |
43
|
|
|
$predicate, |
44
|
|
|
$triggerQuantity, |
45
|
|
|
$discountedQuantity, |
46
|
|
|
$selectionMode, |
47
|
|
|
$context = null |
48
|
|
|
) { |
49
|
1 |
|
return static::of($context) |
50
|
1 |
|
->setPredicate($predicate) |
51
|
1 |
|
->setTriggerQuantity($triggerQuantity) |
52
|
1 |
|
->setDiscountedQuantity($discountedQuantity) |
53
|
1 |
|
->setSelectionMode($selectionMode); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|