EcommerceCustomDeliveryEcommerceDBConfigExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 7
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 15 1
1
<?php
2
3
class EcommerceCustomDeliveryEcommerceDBConfigExtension extends DataExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    private static $db = array(
0 ignored issues
show
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
6
        'DeliveryChargeTitle' => 'Varchar',
7
        'PriceWithoutApplicableProducts' => 'Currency',
8
        'PriceWithApplicableProducts' => 'Currency'
9
    );
10
11
    private static $many_many = array(
0 ignored issues
show
Unused Code introduced by
The property $many_many is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
12
        'DeliverySpecialChargedProducts' => 'Product',
13
        'SpecialPricePostalCodes' => 'EcommerceCustomDeliveryPostalCode'
14
    );
15
16
    private static $field_labels = array(
0 ignored issues
show
Unused Code introduced by
The property $field_labels is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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