1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Delivery |
5
|
|
|
* |
6
|
|
|
* @author Alexey Krupskiy <[email protected]> |
7
|
|
|
* @link http://inji.ru/ |
8
|
|
|
* @copyright 2015 Alexey Krupskiy |
9
|
|
|
* @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Ecommerce; |
13
|
|
|
|
14
|
|
|
class Delivery extends \Model { |
15
|
|
|
|
16
|
|
|
public static $objectName = 'Доставка'; |
17
|
|
|
public static $cols = [ |
18
|
|
|
//Основные параметры |
19
|
|
|
'name' => ['type' => 'text'], |
20
|
|
|
'price' => ['type' => 'decimal'], |
21
|
|
|
'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'], |
22
|
|
|
'price_text' => ['type' => 'textarea'], |
23
|
|
|
'max_cart_price' => ['type' => 'decimal'], |
24
|
|
|
'icon_file_id' => ['type' => 'image'], |
25
|
|
|
'info' => ['type' => 'html'], |
26
|
|
|
'disabled' => ['type' => 'bool'], |
27
|
|
|
//Системные |
28
|
|
|
'weight' => ['type' => 'number'], |
29
|
|
|
'date_create' => ['type' => 'dateTime'], |
30
|
|
|
//Менеджеры |
31
|
|
|
'field' => ['type' => 'dataManager', 'relation' => 'fields'], |
32
|
|
|
'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices'] |
33
|
|
|
]; |
34
|
|
|
public static $labels = [ |
35
|
|
|
'name' => 'Название', |
36
|
|
|
'price' => 'Стоимость', |
37
|
|
|
'price_text' => 'Текстовое описание стоимости (отображается вместо цены)', |
38
|
|
|
'max_cart_price' => 'Басплатно при', |
39
|
|
|
'icon_file_id' => 'Иконка', |
40
|
|
|
'currency_id' => 'Валюта', |
41
|
|
|
'info' => 'Дополнительная информация', |
42
|
|
|
'priceChanger' => 'Градация стоимости', |
43
|
|
|
'field' => 'Поля', |
44
|
|
|
'disabled' => 'Отключено', |
45
|
|
|
]; |
46
|
|
|
public static $dataManagers = [ |
47
|
|
|
'manager' => [ |
48
|
|
|
'name' => 'Варианты доставки', |
49
|
|
|
'cols' => [ |
50
|
|
|
'name', |
51
|
|
|
'price', |
52
|
|
|
'currency_id', |
53
|
|
|
'max_cart_price', |
54
|
|
|
'disabled', |
55
|
|
|
'field', |
56
|
|
|
'priceChanger', |
57
|
|
|
], |
58
|
|
|
'sortMode' => true |
59
|
|
|
], |
60
|
|
|
]; |
61
|
|
|
public static $forms = [ |
62
|
|
|
'manager' => [ |
63
|
|
|
'map' => [ |
64
|
|
|
['name', 'disabled'], |
65
|
|
|
['max_cart_price', 'icon_file_id'], |
66
|
|
|
['price', 'currency_id'], |
67
|
|
|
['price_text'], |
68
|
|
|
['info'], |
69
|
|
|
['priceChanger'], |
70
|
|
|
['field'] |
71
|
|
|
] |
72
|
|
|
]]; |
73
|
|
|
|
74
|
|
|
public static function relations() { |
75
|
|
|
return [ |
76
|
|
|
'icon' => [ |
77
|
|
|
'model' => 'Files\File', |
78
|
|
|
'col' => 'icon_file_id' |
79
|
|
|
], |
80
|
|
|
'currency' => [ |
81
|
|
|
'model' => 'Money\Currency', |
82
|
|
|
'col' => 'currency_id' |
83
|
|
|
], |
84
|
|
|
'fields' => [ |
85
|
|
|
'type' => 'relModel', |
86
|
|
|
'model' => 'Ecommerce\Delivery\Field', |
87
|
|
|
'relModel' => 'Ecommerce\Delivery\DeliveryFieldLink' |
88
|
|
|
], |
89
|
|
|
'prices' => [ |
90
|
|
|
'type' => 'many', |
91
|
|
|
'model' => 'Ecommerce\Delivery\Price', |
92
|
|
|
'col' => 'delivery_id' |
93
|
|
|
] |
94
|
|
|
]; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
} |
98
|
|
|
|