@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | |
14 | 14 | class Delivery extends \Model { |
15 | 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 | - //Системные |
|
27 | - 'weight' => ['type' => 'number'], |
|
28 | - 'date_create' => ['type' => 'dateTime'], |
|
29 | - //Менеджеры |
|
30 | - 'field' => ['type' => 'dataManager', 'relation' => 'fields'], |
|
31 | - 'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices'] |
|
32 | - ]; |
|
33 | - public static $labels = [ |
|
34 | - 'name' => 'Название', |
|
35 | - 'price' => 'Стоимость', |
|
36 | - 'price_text' => 'Текстовое описание стоимости (отображается вместо цены)', |
|
37 | - 'max_cart_price' => 'Басплатно при', |
|
38 | - 'icon_file_id' => 'Иконка', |
|
39 | - 'currency_id' => 'Валюта', |
|
40 | - 'info' => 'Дополнительная информация', |
|
41 | - 'priceChanger' => 'Градация стоимости', |
|
42 | - 'field' => 'Поля', |
|
43 | - ]; |
|
44 | - public static $dataManagers = [ |
|
45 | - 'manager' => [ |
|
46 | - 'name' => 'Варианты доставки', |
|
47 | - 'cols' => [ |
|
48 | - 'name', |
|
49 | - 'price', |
|
50 | - 'currency_id', |
|
51 | - 'max_cart_price', |
|
52 | - 'field', |
|
53 | - 'priceChanger' |
|
54 | - ], |
|
55 | - 'sortMode' => true |
|
56 | - ], |
|
57 | - ]; |
|
58 | - public static $forms = [ |
|
59 | - 'manager' => [ |
|
60 | - 'map' => [ |
|
61 | - ['name',], |
|
62 | - ['max_cart_price', 'icon_file_id'], |
|
63 | - ['price', 'currency_id'], |
|
64 | - ['price_text'], |
|
65 | - ['info'], |
|
66 | - ['priceChanger'], |
|
67 | - ['field'] |
|
68 | - ] |
|
69 | - ]]; |
|
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 | + //Системные |
|
27 | + 'weight' => ['type' => 'number'], |
|
28 | + 'date_create' => ['type' => 'dateTime'], |
|
29 | + //Менеджеры |
|
30 | + 'field' => ['type' => 'dataManager', 'relation' => 'fields'], |
|
31 | + 'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices'] |
|
32 | + ]; |
|
33 | + public static $labels = [ |
|
34 | + 'name' => 'Название', |
|
35 | + 'price' => 'Стоимость', |
|
36 | + 'price_text' => 'Текстовое описание стоимости (отображается вместо цены)', |
|
37 | + 'max_cart_price' => 'Басплатно при', |
|
38 | + 'icon_file_id' => 'Иконка', |
|
39 | + 'currency_id' => 'Валюта', |
|
40 | + 'info' => 'Дополнительная информация', |
|
41 | + 'priceChanger' => 'Градация стоимости', |
|
42 | + 'field' => 'Поля', |
|
43 | + ]; |
|
44 | + public static $dataManagers = [ |
|
45 | + 'manager' => [ |
|
46 | + 'name' => 'Варианты доставки', |
|
47 | + 'cols' => [ |
|
48 | + 'name', |
|
49 | + 'price', |
|
50 | + 'currency_id', |
|
51 | + 'max_cart_price', |
|
52 | + 'field', |
|
53 | + 'priceChanger' |
|
54 | + ], |
|
55 | + 'sortMode' => true |
|
56 | + ], |
|
57 | + ]; |
|
58 | + public static $forms = [ |
|
59 | + 'manager' => [ |
|
60 | + 'map' => [ |
|
61 | + ['name',], |
|
62 | + ['max_cart_price', 'icon_file_id'], |
|
63 | + ['price', 'currency_id'], |
|
64 | + ['price_text'], |
|
65 | + ['info'], |
|
66 | + ['priceChanger'], |
|
67 | + ['field'] |
|
68 | + ] |
|
69 | + ]]; |
|
70 | 70 | |
71 | - public static function relations() { |
|
71 | + public static function relations() { |
|
72 | 72 | return [ |
73 | 73 | 'icon' => [ |
74 | 74 | 'model' => 'Files\File', |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | 'col' => 'delivery_id' |
90 | 90 | ] |
91 | 91 | ]; |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | } |
@@ -13,44 +13,44 @@ discard block |
||
13 | 13 | |
14 | 14 | class Field extends \Model { |
15 | 15 | |
16 | - public static $objectName = 'Поле доставки'; |
|
17 | - public static $cols = [ |
|
18 | - //Основные параметры |
|
19 | - 'name' => ['type' => 'text'], |
|
20 | - 'type' => ['type' => 'text'], |
|
21 | - 'userfield' => ['type' => 'text'], |
|
22 | - 'required' => ['type' => 'bool'], |
|
23 | - 'save' => ['type' => 'bool'], |
|
24 | - 'fieldItem'=>['type'=>'dataManager','relation'=>'fieldItems'], |
|
25 | - //Системные |
|
26 | - 'date_create' => ['type' => 'dateTime'], |
|
27 | - ]; |
|
28 | - public static $labels = [ |
|
29 | - 'name' => 'Название', |
|
30 | - 'type' => 'Тип', |
|
31 | - 'userfield' => 'Связь с данными пользователя', |
|
32 | - 'required' => 'Обязательно', |
|
33 | - 'save' => 'Сохраняется', |
|
34 | - 'fieldItem' => 'Значения для списка', |
|
35 | - ]; |
|
36 | - public static $dataManagers = [ |
|
37 | - 'manager' => [ |
|
38 | - 'cols' => [ |
|
39 | - 'name', 'type', 'userfield', 'required','fieldItem', 'save' |
|
40 | - ], |
|
41 | - ] |
|
42 | - ]; |
|
43 | - public static $forms = [ |
|
44 | - 'manager' => [ |
|
45 | - 'map' => [ |
|
46 | - ['name', 'type'], |
|
47 | - ['required', 'save'], |
|
48 | - [ 'userfield'] |
|
49 | - ] |
|
50 | - ] |
|
51 | - ]; |
|
16 | + public static $objectName = 'Поле доставки'; |
|
17 | + public static $cols = [ |
|
18 | + //Основные параметры |
|
19 | + 'name' => ['type' => 'text'], |
|
20 | + 'type' => ['type' => 'text'], |
|
21 | + 'userfield' => ['type' => 'text'], |
|
22 | + 'required' => ['type' => 'bool'], |
|
23 | + 'save' => ['type' => 'bool'], |
|
24 | + 'fieldItem'=>['type'=>'dataManager','relation'=>'fieldItems'], |
|
25 | + //Системные |
|
26 | + 'date_create' => ['type' => 'dateTime'], |
|
27 | + ]; |
|
28 | + public static $labels = [ |
|
29 | + 'name' => 'Название', |
|
30 | + 'type' => 'Тип', |
|
31 | + 'userfield' => 'Связь с данными пользователя', |
|
32 | + 'required' => 'Обязательно', |
|
33 | + 'save' => 'Сохраняется', |
|
34 | + 'fieldItem' => 'Значения для списка', |
|
35 | + ]; |
|
36 | + public static $dataManagers = [ |
|
37 | + 'manager' => [ |
|
38 | + 'cols' => [ |
|
39 | + 'name', 'type', 'userfield', 'required','fieldItem', 'save' |
|
40 | + ], |
|
41 | + ] |
|
42 | + ]; |
|
43 | + public static $forms = [ |
|
44 | + 'manager' => [ |
|
45 | + 'map' => [ |
|
46 | + ['name', 'type'], |
|
47 | + ['required', 'save'], |
|
48 | + [ 'userfield'] |
|
49 | + ] |
|
50 | + ] |
|
51 | + ]; |
|
52 | 52 | |
53 | - public static function relations() { |
|
53 | + public static function relations() { |
|
54 | 54 | return [ |
55 | 55 | 'fieldItems' => [ |
56 | 56 | 'model' => 'Ecommerce\Delivery\Field\Item', |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | 'type' => 'many' |
59 | 59 | ], |
60 | 60 | ]; |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -13,31 +13,31 @@ discard block |
||
13 | 13 | |
14 | 14 | class DeliveryFieldLink extends \Model { |
15 | 15 | |
16 | - public static $labels = [ |
|
17 | - 'delivery_id' => 'Тип доставки', |
|
18 | - 'delivery_field_id' => 'Поле доставки' |
|
19 | - ]; |
|
20 | - public static $cols = [ |
|
21 | - 'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'], |
|
22 | - 'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'], |
|
23 | - 'weight' => ['type' => 'number'], |
|
24 | - 'date_create' => ['type' => 'dateTime'] |
|
25 | - ]; |
|
26 | - public static $dataManagers = [ |
|
27 | - 'manager' => [ |
|
28 | - 'name' => 'Поля для доставки', |
|
29 | - 'cols' => ['delivery_id', 'delivery_field_id', 'date_create'], |
|
30 | - ] |
|
31 | - ]; |
|
32 | - public static $forms = [ |
|
33 | - 'manager' => [ |
|
34 | - 'map' => [ |
|
35 | - ['delivery_id', 'delivery_field_id'], |
|
36 | - ] |
|
37 | - ] |
|
38 | - ]; |
|
16 | + public static $labels = [ |
|
17 | + 'delivery_id' => 'Тип доставки', |
|
18 | + 'delivery_field_id' => 'Поле доставки' |
|
19 | + ]; |
|
20 | + public static $cols = [ |
|
21 | + 'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'], |
|
22 | + 'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'], |
|
23 | + 'weight' => ['type' => 'number'], |
|
24 | + 'date_create' => ['type' => 'dateTime'] |
|
25 | + ]; |
|
26 | + public static $dataManagers = [ |
|
27 | + 'manager' => [ |
|
28 | + 'name' => 'Поля для доставки', |
|
29 | + 'cols' => ['delivery_id', 'delivery_field_id', 'date_create'], |
|
30 | + ] |
|
31 | + ]; |
|
32 | + public static $forms = [ |
|
33 | + 'manager' => [ |
|
34 | + 'map' => [ |
|
35 | + ['delivery_id', 'delivery_field_id'], |
|
36 | + ] |
|
37 | + ] |
|
38 | + ]; |
|
39 | 39 | |
40 | - public static function relations() { |
|
40 | + public static function relations() { |
|
41 | 41 | return [ |
42 | 42 | 'field' => [ |
43 | 43 | 'model' => 'Ecommerce\Delivery\Field', |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | 'col' => 'delivery_id' |
49 | 49 | ], |
50 | 50 | ]; |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | 53 | } |
@@ -13,35 +13,35 @@ discard block |
||
13 | 13 | |
14 | 14 | class Price extends \Model { |
15 | 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 | - ]; |
|
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 | 43 | |
44 | - public static function relations() { |
|
44 | + public static function relations() { |
|
45 | 45 | return [ |
46 | 46 | 'delivery' => [ |
47 | 47 | 'model' => 'Ecommerce\Delivery', |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | 'col' => 'currency_id' |
53 | 53 | ], |
54 | 54 | ]; |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | 57 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | class File extends \Exchange1c\Mode { |
15 | 15 | |
16 | - public function process() { |
|
16 | + public function process() { |
|
17 | 17 | $dir = $this->exchange->path; |
18 | 18 | \Tools::createDir($dir); |
19 | 19 | $file = new \Exchange1c\Exchange\File(); |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | $file->save(); |
24 | 24 | |
25 | 25 | if (strpos($_GET['filename'], '/') !== false) { |
26 | - $subDir = substr($_GET['filename'], 0, strrpos($_GET['filename'], "/") + 1); |
|
27 | - \Tools::createDir($dir . '/' . $subDir); |
|
26 | + $subDir = substr($_GET['filename'], 0, strrpos($_GET['filename'], "/") + 1); |
|
27 | + \Tools::createDir($dir . '/' . $subDir); |
|
28 | 28 | } |
29 | 29 | $text = ''; |
30 | 30 | if (false === file_put_contents($dir . '/' . $_GET['filename'], file_get_contents("php://input"))) { |
31 | - $text = 'Fail on save file: ' . $_GET['filename']; |
|
32 | - $file->status = 'failure'; |
|
31 | + $text = 'Fail on save file: ' . $_GET['filename']; |
|
32 | + $file->status = 'failure'; |
|
33 | 33 | } else { |
34 | - $file->size = ceil(filesize($dir . '/' . $_GET['filename'])); |
|
35 | - $file->status = 'success'; |
|
34 | + $file->size = ceil(filesize($dir . '/' . $_GET['filename'])); |
|
35 | + $file->status = 'success'; |
|
36 | 36 | } |
37 | 37 | $file->save(); |
38 | 38 | if (strpos($_GET['filename'], '1cbitrix') !== false) { |
39 | - $data = new \SimpleXMLElement(file_get_contents($dir . '/' . $_GET['filename'])); |
|
40 | - $orders = new \Exchange1c\Parser\Orders($data); |
|
41 | - $orders->process(); |
|
39 | + $data = new \SimpleXMLElement(file_get_contents($dir . '/' . $_GET['filename'])); |
|
40 | + $orders = new \Exchange1c\Parser\Orders($data); |
|
41 | + $orders->process(); |
|
42 | 42 | } |
43 | 43 | \App::$cur->exchange1c->response($file->status, $text, false); |
44 | 44 | $this->end($file->status); |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -13,18 +13,18 @@ |
||
13 | 13 | |
14 | 14 | class File extends \Model { |
15 | 15 | |
16 | - public static $cols = [ |
|
17 | - 'name' => ['type' => 'text'], |
|
18 | - 'size' => ['type' => 'number'], |
|
19 | - 'status' => ['type' => 'text'], |
|
20 | - 'date_create' => ['type' => 'dateTime'], |
|
21 | - ]; |
|
22 | - public static $dataManagers = [ |
|
23 | - 'manager' => [ |
|
24 | - 'cols' => [ |
|
25 | - 'name', 'size', 'date_create' |
|
26 | - ], |
|
27 | - ] |
|
28 | - ]; |
|
16 | + public static $cols = [ |
|
17 | + 'name' => ['type' => 'text'], |
|
18 | + 'size' => ['type' => 'number'], |
|
19 | + 'status' => ['type' => 'text'], |
|
20 | + 'date_create' => ['type' => 'dateTime'], |
|
21 | + ]; |
|
22 | + public static $dataManagers = [ |
|
23 | + 'manager' => [ |
|
24 | + 'cols' => [ |
|
25 | + 'name', 'size', 'date_create' |
|
26 | + ], |
|
27 | + ] |
|
28 | + ]; |
|
29 | 29 | |
30 | 30 | } |