1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class EcommerceCustomDeliveryEcommerceDBConfigExtension extends DataExtension |
|
|
|
|
4
|
|
|
{ |
5
|
|
|
private static $db = array( |
|
|
|
|
6
|
|
|
'DeliveryChargeTitle' => 'Varchar', |
7
|
|
|
'PriceWithoutApplicableProducts' => 'Currency', |
8
|
|
|
'PriceWithApplicableProducts' => 'Currency' |
9
|
|
|
); |
10
|
|
|
|
11
|
|
|
private static $many_many = array( |
|
|
|
|
12
|
|
|
'DeliverySpecialChargedProducts' => 'Product', |
13
|
|
|
'SpecialPricePostalCodes' => 'EcommerceCustomDeliveryPostalCode' |
14
|
|
|
); |
15
|
|
|
|
16
|
|
|
private static $field_labels = array( |
|
|
|
|
17
|
|
|
'PriceWithoutApplicableProducts' => 'Standard Delivery Charge (rest of NZ) without Special Products in Order', |
18
|
|
|
'PriceWithApplicableProducts' => 'Standard Delivery Charge (rest of NZ) with Special Products in Order', |
19
|
|
|
'DeliverySpecialChargedProducts' => 'List of Products with Special Delivery Charge', |
20
|
|
|
'SpecialPricePostalCodes' => 'List of Postal Codes With Special Delivery Charge' |
21
|
|
|
); |
22
|
|
|
|
23
|
|
|
public function updateCMSFields(FieldList $fields) |
24
|
|
|
{ |
25
|
|
|
$fields->removeFieldFromTab("Root", "DeliverySpecialChargedProducts"); |
26
|
|
|
$fields->removeFieldFromTab("Root", "SpecialPricePostalCodes"); |
27
|
|
|
$fields->addFieldsToTab( |
28
|
|
|
"Root.Delivery", |
29
|
|
|
array( |
30
|
|
|
new TextField("DeliveryChargeTitle", "Delivery Charge Title"), |
31
|
|
|
new CurrencyField("PriceWithoutApplicableProducts", "Standard Delivery Charge without Special Products in order"), |
32
|
|
|
new CurrencyField("PriceWithApplicableProducts", "Standard Delivery Charge with Special Products in order"), |
33
|
|
|
new GridField("DeliverySpecialChargedProducts", "Products with special Delivery Charge", $this->owner->DeliverySpecialChargedProducts(), GridFieldEditOriginalPageConfigWithDelete::create()), |
34
|
|
|
new GridField("SpecialPricePostalCodes", "Special Price Postal Codes", $this->owner->SpecialPricePostalCodes(), GridFieldConfig_RelationEditor::create()) |
35
|
|
|
) |
36
|
|
|
); |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
|
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.