|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Adds individual country messages |
|
5
|
|
|
* for ordersteps |
|
6
|
|
|
* |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
class CountryPrice_OrderStepDOD extends DataExtension |
|
|
|
|
|
|
10
|
|
|
{ |
|
11
|
|
|
private static $db = array( |
|
|
|
|
|
|
12
|
|
|
'SendEmailToDistributor' => 'Boolean' |
|
13
|
|
|
); |
|
14
|
|
|
|
|
15
|
|
|
private static $has_many = array( |
|
|
|
|
|
|
16
|
|
|
'EcommerceOrderStepCountryDatas' => 'EcommerceOrderStepCountryData', |
|
17
|
|
|
); |
|
18
|
|
|
|
|
19
|
|
|
private static $field_labels = array( |
|
|
|
|
|
|
20
|
|
|
'EcommerceOrderStepCountryDatas' => 'Regionalisation', |
|
21
|
|
|
); |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Update Fields |
|
25
|
|
|
* @return FieldList |
|
|
|
|
|
|
26
|
|
|
*/ |
|
27
|
|
|
public function updateCMSFields(FieldList $fields) |
|
28
|
|
|
{ |
|
29
|
|
|
$owner = $this->owner; |
|
|
|
|
|
|
30
|
|
|
$bccExplanation = _t( |
|
31
|
|
|
'CountryPrice_OrderStepDOD.BCC_EXPLANATION', |
|
32
|
|
|
' |
|
33
|
|
|
E-mails during this step (if any) will be copied to distributor? |
|
34
|
|
|
<br />These emails can be customised. |
|
35
|
|
|
'); |
|
36
|
|
|
|
|
37
|
|
|
$gridField = $fields->dataFieldByName('EcommerceOrderStepCountryDatas'); |
|
38
|
|
|
$fields->removeFieldFromTab( |
|
39
|
|
|
'Root.EcommerceOrderStepCountryDatas', |
|
40
|
|
|
'EcommerceOrderStepCountryDatas' |
|
41
|
|
|
); |
|
42
|
|
|
$fields->addFieldsToTab( |
|
43
|
|
|
'Root.EcommerceOrderStepCountryDatas', |
|
44
|
|
|
array( |
|
45
|
|
|
CheckboxField::create( |
|
46
|
|
|
'SendEmailToDistributor', |
|
47
|
|
|
_t('CountryPrice_OrderStepDOD.SEND_EMAIL_TO_DISTRIBUTOR', 'BCC to Distributor') |
|
48
|
|
|
)->setDescription( |
|
49
|
|
|
$bccExplanation |
|
50
|
|
|
), |
|
51
|
|
|
) |
|
52
|
|
|
); |
|
53
|
|
|
if($this->owner->SendEmailToDistributor) { |
|
54
|
|
|
$customisation = _t( |
|
55
|
|
|
'CountryPrice_OrderStepDOD.CUSTOMISATION_PER_COUNTRY', |
|
56
|
|
|
'Customisation per country'); |
|
57
|
|
|
$gridField->setTitle($customisation); |
|
58
|
|
|
$fields->addFieldsToTab( |
|
59
|
|
|
'Root.EcommerceOrderStepCountryDatas', |
|
60
|
|
|
$gridField |
|
|
|
|
|
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.