-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathPromotion.php
More file actions
767 lines (695 loc) · 21.3 KB
/
Promotion.php
File metadata and controls
767 lines (695 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
<?php
namespace Drupal\commerce_promotion\Entity;
use Drupal\commerce\ConditionGroup;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\PromotionOfferInterface;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines the promotion entity class.
*
* @ContentEntityType(
* id = "commerce_promotion",
* label = @Translation("Promotion"),
* label_collection = @Translation("Promotions"),
* label_singular = @Translation("promotion"),
* label_plural = @Translation("promotions"),
* label_count = @PluralTranslation(
* singular = "@count promotion",
* plural = "@count promotions",
* ),
* handlers = {
* "event" = "Drupal\commerce_promotion\Event\PromotionEvent",
* "storage" = "Drupal\commerce_promotion\PromotionStorage",
* "access" = "Drupal\commerce\EntityAccessControlHandler",
* "permission_provider" = "Drupal\commerce\EntityPermissionProvider",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\commerce_promotion\PromotionListBuilder",
* "views_data" = "Drupal\views\EntityViewsData",
* "form" = {
* "default" = "Drupal\commerce_promotion\Form\PromotionForm",
* "add" = "Drupal\commerce_promotion\Form\PromotionForm",
* "edit" = "Drupal\commerce_promotion\Form\PromotionForm",
* "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm"
* },
* "route_provider" = {
* "default" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",
* "delete-multiple" = "Drupal\entity\Routing\DeleteMultipleRouteProvider",
* },
* "translation" = "Drupal\content_translation\ContentTranslationHandler"
* },
* base_table = "commerce_promotion",
* data_table = "commerce_promotion_field_data",
* admin_permission = "administer commerce_promotion",
* fieldable = TRUE,
* translatable = TRUE,
* entity_keys = {
* "id" = "promotion_id",
* "label" = "name",
* "langcode" = "langcode",
* "uuid" = "uuid",
* "status" = "status",
* },
* links = {
* "add-form" = "/promotion/add",
* "edit-form" = "/promotion/{commerce_promotion}/edit",
* "delete-form" = "/promotion/{commerce_promotion}/delete",
* "delete-multiple-form" = "/admin/commerce/promotions/delete",
* "collection" = "/admin/commerce/promotions",
* },
* )
*/
class Promotion extends ContentEntityBase implements PromotionInterface {
/**
* {@inheritdoc}
*/
public function getName() {
return $this->get('name')->value;
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this->set('name', $name);
return $this;
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this->get('description')->value;
}
/**
* {@inheritdoc}
*/
public function setDescription($description) {
$this->set('description', $description);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOrderTypes() {
return $this->get('order_types')->referencedEntities();
}
/**
* {@inheritdoc}
*/
public function setOrderTypes(array $order_types) {
$this->set('order_types', $order_types);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOrderTypeIds() {
$order_type_ids = [];
foreach ($this->get('order_types') as $field_item) {
$order_type_ids[] = $field_item->target_id;
}
return $order_type_ids;
}
/**
* {@inheritdoc}
*/
public function setOrderTypeIds(array $order_type_ids) {
$this->set('order_types', $order_type_ids);
return $this;
}
/**
* {@inheritdoc}
*/
public function getStores() {
return $this->get('stores')->referencedEntities();
}
/**
* {@inheritdoc}
*/
public function setStores(array $stores) {
$this->set('stores', $stores);
return $this;
}
/**
* {@inheritdoc}
*/
public function getStoreIds() {
$store_ids = [];
foreach ($this->get('stores') as $field_item) {
$store_ids[] = $field_item->target_id;
}
return $store_ids;
}
/**
* {@inheritdoc}
*/
public function setStoreIds(array $store_ids) {
$this->set('stores', $store_ids);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOffer() {
if (!$this->get('offer')->isEmpty()) {
return $this->get('offer')->first()->getTargetInstance();
}
}
/**
* {@inheritdoc}
*/
public function setOffer(PromotionOfferInterface $offer) {
$this->set('offer', [
'target_plugin_id' => $offer->getPluginId(),
'target_plugin_configuration' => $offer->getConfiguration(),
]);
return $this;
}
/**
* {@inheritdoc}
*/
public function getConditions() {
$conditions = [];
foreach ($this->get('conditions') as $field_item) {
/** @var \Drupal\commerce\Plugin\Field\FieldType\PluginItemInterface $field_item */
$conditions[] = $field_item->getTargetInstance();
}
return $conditions;
}
/**
* {@inheritdoc}
*/
public function getConditionOperator() {
return $this->get('condition_operator')->value;
}
/**
* {@inheritdoc}
*/
public function setConditionOperator($condition_operator) {
$this->set('condition_operator', $condition_operator);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCouponIds() {
$coupon_ids = [];
foreach ($this->get('coupons') as $field_item) {
$coupon_ids[] = $field_item->target_id;
}
return $coupon_ids;
}
/**
* {@inheritdoc}
*/
public function getCoupons() {
$coupons = $this->get('coupons')->referencedEntities();
return $coupons;
}
/**
* {@inheritdoc}
*/
public function setCoupons(array $coupons) {
$this->set('coupons', $coupons);
return $this;
}
/**
* {@inheritdoc}
*/
public function hasCoupons() {
return !$this->get('coupons')->isEmpty();
}
/**
* {@inheritdoc}
*/
public function addCoupon(CouponInterface $coupon) {
if (!$this->hasCoupon($coupon)) {
$this->get('coupons')->appendItem($coupon);
}
return $this;
}
/**
* {@inheritdoc}
*/
public function removeCoupon(CouponInterface $coupon) {
$index = $this->getCouponIndex($coupon);
if ($index !== FALSE) {
$this->get('coupons')->offsetUnset($index);
}
return $this;
}
/**
* {@inheritdoc}
*/
public function hasCoupon(CouponInterface $coupon) {
return in_array($coupon->id(), $this->getCouponIds());
}
/**
* Gets the index of the given coupon.
*
* @param \Drupal\commerce_promotion\Entity\CouponInterface $coupon
* The coupon.
*
* @return int|bool
* The index of the given coupon, or FALSE if not found.
*/
protected function getCouponIndex(CouponInterface $coupon) {
return array_search($coupon->id(), $this->getCouponIds());
}
/**
* {@inheritdoc}
*/
public function getUsageLimit() {
return $this->get('usage_limit')->value;
}
/**
* {@inheritdoc}
*/
public function setUsageLimit($usage_limit) {
$this->set('usage_limit', $usage_limit);
return $this;
}
/**
* {@inheritdoc}
*/
public function getStartDate() {
// Can't use the ->date property because it resets the timezone to UTC.
return new DrupalDateTime($this->get('start_date')->value);
}
/**
* {@inheritdoc}
*/
public function setStartDate(DrupalDateTime $start_date) {
$this->get('start_date')->value = $start_date->format('Y-m-d');
return $this;
}
/**
* {@inheritdoc}
*/
public function getEndDate() {
if (!$this->get('end_date')->isEmpty()) {
return new DrupalDateTime($this->get('end_date')->value);
}
}
/**
* {@inheritdoc}
*/
public function setEndDate(DrupalDateTime $end_date = NULL) {
$this->get('end_date')->value = $end_date ? $end_date->format('Y-m-d') : NULL;
return $this;
}
/**
* {@inheritdoc}
*/
public function getCompatibility() {
return $this->get('compatibility')->value;
}
/**
* {@inheritdoc}
*/
public function setCompatibility($compatibility) {
if (!in_array($compatibility, [self::COMPATIBLE_NONE, self::COMPATIBLE_ANY])) {
throw new \InvalidArgumentException('Invalid compatibility type');
}
$this->get('compatibility')->value = $compatibility;
return $this;
}
/**
* {@inheritdoc}
*/
public function isEnabled() {
return (bool) $this->getEntityKey('status');
}
/**
* {@inheritdoc}
*/
public function setEnabled($enabled) {
$this->set('status', (bool) $enabled);
return $this;
}
/**
* {@inheritdoc}
*/
public function getWeight() {
return (int) $this->get('weight')->value;
}
/**
* {@inheritdoc}
*/
public function setWeight($weight) {
$this->set('weight', $weight);
return $this;
}
/**
* {@inheritdoc}
*/
public function available(OrderInterface $order) {
if (!$this->isEnabled()) {
return FALSE;
}
if (!in_array($order->bundle(), $this->getOrderTypeIds())) {
return FALSE;
}
if (!in_array($order->getStoreId(), $this->getStoreIds())) {
return FALSE;
}
$time = \Drupal::time()->getRequestTime();
if ($this->getStartDate()->format('U') > $time) {
return FALSE;
}
$end_date = $this->getEndDate();
if ($end_date && $end_date->format('U') <= $time) {
return FALSE;
}
if ($usage_limit = $this->getUsageLimit()) {
/** @var \Drupal\commerce_promotion\PromotionUsageInterface $usage */
$usage = \Drupal::service('commerce_promotion.usage');
if ($usage_limit <= $usage->load($this)) {
return FALSE;
}
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function applies(OrderInterface $order) {
// Check compatibility.
// @todo port remaining strategies from Commerce Discount #2762997.
switch ($this->getCompatibility()) {
case self::COMPATIBLE_NONE:
// If there are any existing promotions, then this cannot apply.
foreach ($order->collectAdjustments() as $adjustment) {
if ($adjustment->getType() == 'promotion') {
return FALSE;
}
}
break;
case self::COMPATIBLE_ANY:
break;
}
$conditions = $this->getConditions();
if (!$conditions) {
// Promotions without conditions always apply.
return TRUE;
}
$order_conditions = array_filter($conditions, function ($condition) {
/** @var \Drupal\commerce\Plugin\Commerce\Condition\ConditionInterface $condition */
return $condition->getEntityTypeId() == 'commerce_order';
});
$order_item_conditions = array_filter($conditions, function ($condition) {
/** @var \Drupal\commerce\Plugin\Commerce\Condition\ConditionInterface $condition */
return $condition->getEntityTypeId() == 'commerce_order_item';
});
$order_conditions = new ConditionGroup($order_conditions, $this->getConditionOperator());
$order_item_conditions = new ConditionGroup($order_item_conditions, $this->getConditionOperator());
if (!$order_conditions->evaluate($order)) {
return FALSE;
}
foreach ($order->getItems() as $order_item) {
// Order item conditions must match at least one order item.
if ($order_item_conditions->evaluate($order_item)) {
return TRUE;
}
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function apply(OrderInterface $order) {
$offer = $this->getOffer();
if ($offer->getEntityTypeId() == 'commerce_order') {
$offer->apply($order, $this);
}
elseif ($offer->getEntityTypeId() == 'commerce_order_item') {
$order_item_conditions = array_filter($this->getConditions(), function ($condition) {
/** @var \Drupal\commerce\Plugin\Commerce\Condition\ConditionInterface $condition */
return $condition->getEntityTypeId() == 'commerce_order_item';
});
$order_item_conditions = new ConditionGroup($order_item_conditions, 'AND');
// Apply the offer to order items that pass the conditions.
foreach ($order->getItems() as $order_item) {
if ($order_item_conditions->evaluate($order_item)) {
$offer->apply($order_item, $this);
}
}
}
}
/**
* {@inheritdoc}
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
// Ensure there's a back-reference on each coupon.
foreach ($this->coupons as $item) {
/** @var \Drupal\commerce_promotion\Entity\CouponInterface $coupon */
$coupon = $item->entity;
if (!$coupon->getPromotionId()) {
$coupon->promotion_id = $this->id();
$coupon->save();
}
}
}
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities) {
// Delete the linked coupons and usage records.
$coupons = [];
foreach ($entities as $entity) {
foreach ($entity->getCoupons() as $coupon) {
$coupons[] = $coupon;
}
}
/** @var \Drupal\commerce_promotion\CouponStorageInterface $coupon_storage */
$coupon_storage = \Drupal::service('entity_type.manager')->getStorage('commerce_promotion_coupon');
$coupon_storage->delete($coupons);
/** @var \Drupal\commerce_promotion\PromotionUsageInterface $usage */
$usage = \Drupal::service('commerce_promotion.usage');
$usage->delete($entities);
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The promotion name.'))
->setRequired(TRUE)
->setTranslatable(TRUE)
->setSettings([
'default_value' => '',
'max_length' => 255,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 0,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayConfigurable('form', TRUE);
$fields['description'] = BaseFieldDefinition::create('text_long')
->setLabel(t('Description'))
->setDescription(t('Additional information about the promotion to show to the customer'))
->setTranslatable(TRUE)
->setDefaultValue('')
->setDisplayOptions('form', [
'type' => 'text_textarea',
'weight' => 1,
'settings' => [
'rows' => 3,
],
])
->setDisplayConfigurable('view', TRUE)
->setDisplayConfigurable('form', TRUE);
$fields['order_types'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Order types'))
->setDescription(t('The order types for which the promotion is valid.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setRequired(TRUE)
->setSetting('target_type', 'commerce_order_type')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('form', [
'type' => 'commerce_entity_select',
'weight' => 2,
]);
$fields['stores'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Stores'))
->setDescription(t('The stores for which the promotion is valid.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setRequired(TRUE)
->setSetting('target_type', 'commerce_store')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('form', [
'type' => 'commerce_entity_select',
'weight' => 2,
]);
$fields['offer'] = BaseFieldDefinition::create('commerce_plugin_item:commerce_promotion_offer')
->setLabel(t('Offer'))
->setCardinality(1)
->setRequired(TRUE)
->setDisplayOptions('form', [
'type' => 'commerce_plugin_radios',
'weight' => 3,
]);
$fields['conditions'] = BaseFieldDefinition::create('commerce_plugin_item:commerce_condition')
->setLabel(t('Conditions'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setRequired(FALSE)
->setDisplayOptions('form', [
'type' => 'commerce_conditions',
'weight' => 3,
'settings' => [
'entity_types' => ['commerce_order', 'commerce_order_item'],
],
]);
$fields['condition_operator'] = BaseFieldDefinition::create('list_string')
->setLabel(t('Condition operator'))
->setDescription(t('The condition operator.'))
->setRequired(TRUE)
->setSetting('allowed_values', [
'AND' => t('All conditions must pass'),
'OR' => t('Only one condition must pass'),
])
->setDisplayOptions('form', [
'type' => 'options_buttons',
'weight' => 4,
])
->setDisplayConfigurable('form', TRUE)
->setDefaultValue('AND');
$fields['coupons'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Coupons'))
->setDescription(t('Coupons which allow promotion to be redeemed.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setRequired(FALSE)
->setSetting('target_type', 'commerce_promotion_coupon')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('form', [
'type' => 'inline_entity_form_complex',
'weight' => 10,
'settings' => [
'override_labels' => TRUE,
'label_singular' => 'coupon',
'label_plural' => 'coupons',
],
]);
$fields['usage_limit'] = BaseFieldDefinition::create('integer')
->setLabel(t('Usage limit'))
->setDescription(t('The maximum number of times the promotion can be used. 0 for unlimited.'))
->setDefaultValue(0)
->setDisplayOptions('form', [
'type' => 'commerce_usage_limit',
'weight' => 4,
]);
$fields['start_date'] = BaseFieldDefinition::create('datetime')
->setLabel(t('Start date'))
->setDescription(t('The date the promotion becomes valid.'))
->setRequired(TRUE)
->setSetting('datetime_type', 'date')
->setDefaultValueCallback('Drupal\commerce_promotion\Entity\Promotion::getDefaultStartDate')
->setDisplayOptions('form', [
'type' => 'datetime_default',
'weight' => 5,
]);
$fields['end_date'] = BaseFieldDefinition::create('datetime')
->setLabel(t('End date'))
->setDescription(t('The date after which the promotion is invalid.'))
->setRequired(FALSE)
->setSetting('datetime_type', 'date')
->setDisplayOptions('form', [
'type' => 'commerce_end_date',
'weight' => 6,
]);
$fields['compatibility'] = BaseFieldDefinition::create('list_string')
->setLabel(t('Compatibility with other promotions'))
->setSetting('allowed_values_function', ['\Drupal\commerce_promotion\Entity\Promotion', 'getCompatibilityOptions'])
->setRequired(TRUE)
->setDefaultValue(self::COMPATIBLE_ANY)
->setDisplayOptions('form', [
'type' => 'options_buttons',
'weight' => 4,
]);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Status'))
->setDescription(t('Whether the promotion is enabled.'))
->setDefaultValue(TRUE)
->setRequired(TRUE)
->setSettings([
'on_label' => t('Enabled'),
'off_label' => t('Disabled'),
])
->setDisplayOptions('form', [
'type' => 'options_buttons',
'weight' => 0,
]);
$fields['weight'] = BaseFieldDefinition::create('integer')
->setLabel(t('Weight'))
->setDescription(t('The weight of this promotion in relation to others.'))
->setDefaultValue(0);
return $fields;
}
/**
* Default value callback for 'start_date' base field definition.
*
* @see ::baseFieldDefinitions()
*
* @return string
* The default value (date string).
*/
public static function getDefaultStartDate() {
$timestamp = \Drupal::time()->getRequestTime();
return gmdate('Y-m-d', $timestamp);
}
/**
* Default value callback for 'end_date' base field definition.
*
* @see ::baseFieldDefinitions()
*
* @return int
* The default value (date string).
*/
public static function getDefaultEndDate() {
// Today + 1 year.
$timestamp = \Drupal::time()->getRequestTime();
return gmdate('Y-m-d', $timestamp + 31536000);
}
/**
* Helper callback for uasort() to sort promotions by weight and label.
*
* @param \Drupal\commerce_promotion\Entity\PromotionInterface $a
* The first promotion to sort.
* @param \Drupal\commerce_promotion\Entity\PromotionInterface $b
* The second promotion to sort.
*
* @return int
* The comparison result for uasort().
*/
public static function sort(PromotionInterface $a, PromotionInterface $b) {
$a_weight = $a->getWeight();
$b_weight = $b->getWeight();
if ($a_weight == $b_weight) {
$a_label = $a->label();
$b_label = $b->label();
return strnatcasecmp($a_label, $b_label);
}
return ($a_weight < $b_weight) ? -1 : 1;
}
/**
* Gets the allowed values for the 'compatibility' base field.
*
* @return array
* The allowed values.
*/
public static function getCompatibilityOptions() {
return [
self::COMPATIBLE_ANY => t('Any promotion'),
self::COMPATIBLE_NONE => t('Not with any other promotions'),
];
}
}