|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Link between delivery and link |
|
5
|
|
|
* |
|
6
|
|
|
* @author Alexey Krupskiy <[email protected]> |
|
7
|
|
|
* @link http://inji.ru/ |
|
8
|
|
|
* @copyright 2016 Alexey Krupskiy |
|
9
|
|
|
* @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Ecommerce\Delivery; |
|
13
|
|
|
|
|
14
|
|
View Code Duplication |
class Price extends \Model { |
|
15
|
|
|
|
|
16
|
|
|
public static $labels = [ |
|
17
|
|
|
'delivery_id' => 'Тип доставки', |
|
18
|
|
|
'cart_price' => 'Сумма корзины', |
|
19
|
|
|
'price' => 'Стоимость доставки', |
|
20
|
|
|
'currency_id' => 'Валюта', |
|
21
|
|
|
]; |
|
22
|
|
|
public static $cols = [ |
|
23
|
|
|
'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'], |
|
24
|
|
|
'cart_price' => ['type' => 'number'], |
|
25
|
|
|
'price' => ['type' => 'number'], |
|
26
|
|
|
'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'], |
|
27
|
|
|
'date_create' => ['type' => 'dateTime'] |
|
28
|
|
|
]; |
|
29
|
|
|
public static $dataManagers = [ |
|
30
|
|
|
'manager' => [ |
|
31
|
|
|
'name' => 'Цены для стоимости корзин', |
|
32
|
|
|
'cols' => ['delivery_id', 'cart_price', 'price', 'currency_id'], |
|
33
|
|
|
] |
|
34
|
|
|
]; |
|
35
|
|
|
public static $forms = [ |
|
36
|
|
|
'manager' => [ |
|
37
|
|
|
'map' => [ |
|
38
|
|
|
['delivery_id', 'currency_id'], |
|
39
|
|
|
['cart_price', 'price'], |
|
40
|
|
|
] |
|
41
|
|
|
] |
|
42
|
|
|
]; |
|
43
|
|
|
|
|
44
|
|
|
public static function relations() { |
|
45
|
|
|
return [ |
|
46
|
|
|
'delivery' => [ |
|
47
|
|
|
'model' => 'Ecommerce\Delivery', |
|
48
|
|
|
'col' => 'delivery_id' |
|
49
|
|
|
], |
|
50
|
|
|
'currency' => [ |
|
51
|
|
|
'model' => 'Money\Currency', |
|
52
|
|
|
'col' => 'currency_id' |
|
53
|
|
|
], |
|
54
|
|
|
]; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|