ElectronicDownloadProduct::getCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
class ElectronicDownloadProduct extends Product
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
6
    /**
7
     * Standard SS variable.
8
     */
9
    private static $many_many = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
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...
10
        'DownloadFiles' => 'File'
11
    );
12
13
    /**
14
     * Standard SS variable.
15
     */
16
    private static $icon = 'ecommerce_delivery_electronic/images/icons/ElectronicDownloadProduct';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $icon 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
18
    /**
19
     * Standard SS variable.
20
     * @var String
21
     */
22
    private static $description = "A product can be downloaded.";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $description 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...
23
24
    /**
25
     * Standard SS variable.
26
     */
27
    private static $singular_name = "Electronic Download Product";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $singular_name 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...
28
    public function i18n_singular_name()
29
    {
30
        return _t("ElectronicDownloadProduct.SINGULAR_NAME", "Electronic Download Product");
31
    }
32
33
    /**
34
     * Standard SS variable.
35
     */
36
    private static $plural_name = "Electronic Download Products";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $plural_name 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...
37
    public function i18n_plural_name()
38
    {
39
        return _t("ElectronicDownloadProduct.PLURAL_NAME", "Electronic Download Products");
40
    }
41
42
43
    /**
44
     * Standard SS Method
45
     */
46
    public function getCMSFields()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
47
    {
48
        $fields = parent::getCMSFields();
49
        $fields->addFieldToTab('Root.Details', new UploadField('DownloadFiles', _t('ElectronicDownloadProduct.DOWNLOADFILES', 'Download Files')));
50
        return $fields;
51
    }
52
53
    /**
54
     * This is used when you add a product to your cart
55
     * if you set it to 1 then you can add 0.1 product to cart.
56
     * If you set it to -1 then you can add 10, 20, 30, etc.. products to cart.
57
     *
58
     * @return Int
59
     **/
60
    public function QuantityDecimals()
61
    {
62
        return 0;
63
    }
64
}
65
66
67
class ElectronicDownloadProduct_Controller extends Product_Controller
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
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...
68
{
69
}
70