1 | <?php |
||
4 | class SecondHandProductGroup extends ProductGroup |
||
|
|||
5 | { |
||
6 | private static $db = array( |
||
7 | 'RootParent' => 'Boolean' |
||
8 | ); |
||
9 | |||
10 | private static $allowed_children = array( |
||
11 | 'SecondHandProductGroup', |
||
12 | 'SecondHandProduct' |
||
13 | ); |
||
14 | |||
15 | private static $icon = 'ecommerce_second_hand_product/images/treeicons/SecondHandProductGroup'; |
||
16 | |||
17 | /** |
||
18 | * Standard SS variable. |
||
19 | */ |
||
20 | private static $singular_name = 'Second Hand Product Holder'; |
||
21 | public function i18n_singular_name() |
||
22 | { |
||
23 | return self::$singular_name; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Standard SS variable. |
||
28 | */ |
||
29 | private static $plural_name = 'Second Hand Product Holders'; |
||
30 | public function i18n_plural_name() |
||
31 | { |
||
32 | return self::$plural_name; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Standard SS variable. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private static $description = 'A product category page specifically for second had products'; |
||
41 | |||
42 | public function getCMSFields() |
||
43 | { |
||
44 | $fields = parent::getCMSFields(); |
||
45 | $fields->addFieldToTab( |
||
46 | 'Root.SecondHand', |
||
47 | CheckboxField::create( |
||
48 | 'RootParent', |
||
49 | _t('SecondHandProductGroup.LANDING_PAGE', 'Landing Page') |
||
50 | ) |
||
51 | ); |
||
52 | return $fields; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Event handler called before writing to the database. |
||
57 | */ |
||
58 | public function onBeforeWrite() |
||
78 | |||
79 | /** |
||
80 | * Level is within SiteTree hierarchy |
||
81 | * @return boolean |
||
82 | */ |
||
83 | protected function hasOtherSecondHandProductGroupsOnThisLevel() |
||
93 | |||
94 | /** |
||
95 | * @return SecondHandProductGroup |
||
96 | */ |
||
97 | public function BestRootParentPage() |
||
109 | |||
110 | /** |
||
111 | * Returns the class we are working with. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | protected function getBuyableClassName() |
||
119 | } |
||
120 | |||
174 |
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.