@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | ?> |
33 | 33 | <div class="item <?= !$i ? 'active' : ''; ?>"> |
34 | 34 | <?php |
35 | - if ($item->link) { |
|
36 | - echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | - } |
|
38 | - ?> |
|
35 | + if ($item->link) { |
|
36 | + echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | <img src="<?= Statics::file($item->image->path); ?>" alt="<?= $item->name; ?>"> |
40 | 40 | <div class="carousel-caption"> |
41 | 41 | <?= $item->description; ?> |
42 | 42 | </div> |
43 | 43 | <?php |
44 | - if ($item->link) { |
|
45 | - echo "</a>"; |
|
46 | - } |
|
47 | - ?> |
|
44 | + if ($item->link) { |
|
45 | + echo "</a>"; |
|
46 | + } |
|
47 | + ?> |
|
48 | 48 | </div> |
49 | 49 | <?php |
50 | 50 | $i++; |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | </div> |
54 | 54 | |
55 | 55 | <?php |
56 | - if (!isset($arrows) || $arrows) { |
|
57 | - ?> |
|
56 | + if (!isset($arrows) || $arrows) { |
|
57 | + ?> |
|
58 | 58 | <!-- Controls --> |
59 | 59 | <a class="left carousel-control" href="#sliderWidget-<?= $slider->id; ?>" role="button" data-slide="prev"> |
60 | 60 | <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | <span class="sr-only">Next</span> |
66 | 66 | </a> |
67 | 67 | <?php |
68 | - } |
|
69 | - ?> |
|
68 | + } |
|
69 | + ?> |
|
70 | 70 | </div> |
71 | 71 | \ No newline at end of file |
@@ -9,6 +9,6 @@ |
||
9 | 9 | <a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-index='<?= $model::index(); ?>' data-path ='/' data-id='0'> Корень</a> |
10 | 10 | <div class="categoryTree"> |
11 | 11 | <?php |
12 | - $dataManager->drawCategorys(); |
|
13 | - ?> |
|
12 | + $dataManager->drawCategorys(); |
|
13 | + ?> |
|
14 | 14 | </div> |
15 | 15 | \ No newline at end of file |
@@ -29,11 +29,11 @@ |
||
29 | 29 | <select class ='form-control' id = 'widgetChooser' onchange="selectChange(this);"> |
30 | 30 | <option value = ''>Выберите виджет</option> |
31 | 31 | <?php |
32 | - foreach ($widgets as $code => $options) { |
|
33 | - $name = is_string($options) ? $options : $options['name']; |
|
34 | - echo "<option value = '{$code}' data-filename='{$code}'>{$name}</option>"; |
|
35 | - } |
|
36 | - ?> |
|
32 | + foreach ($widgets as $code => $options) { |
|
33 | + $name = is_string($options) ? $options : $options['name']; |
|
34 | + echo "<option value = '{$code}' data-filename='{$code}'>{$name}</option>"; |
|
35 | + } |
|
36 | + ?> |
|
37 | 37 | </select> |
38 | 38 | <?php |
39 | 39 | foreach ($widgets as $code => $options) { |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | </tr> |
9 | 9 | </thead> |
10 | 10 | <?php |
11 | - $orderDeatilCols = [ |
|
12 | - 'id' => '№ Заказа', |
|
13 | - 'complete_data' => 'Дата заказа' |
|
14 | - ]; |
|
15 | - ?> |
|
11 | + $orderDeatilCols = [ |
|
12 | + 'id' => '№ Заказа', |
|
13 | + 'complete_data' => 'Дата заказа' |
|
14 | + ]; |
|
15 | + ?> |
|
16 | 16 | <tbody> |
17 | 17 | <tr> |
18 | 18 | <td class="text-left" style="width: 50%;"> |
@@ -65,91 +65,91 @@ discard block |
||
65 | 65 | </thead> |
66 | 66 | <tbody> |
67 | 67 | <?php |
68 | - $sums = []; |
|
69 | - foreach ($cart->cartItems as $cartItem) { |
|
70 | - $item = $cartItem->item; |
|
71 | - $itemName = $item->name(); |
|
72 | - if (!isset($sums[$cartItem->price->currency_id])) { |
|
73 | - $sums[$cartItem->price->currency_id] = $cartItem->price->price; |
|
74 | - } else { |
|
75 | - $sums[$cartItem->price->currency_id] += $cartItem->price->price; |
|
76 | - } |
|
77 | - ?> |
|
68 | + $sums = []; |
|
69 | + foreach ($cart->cartItems as $cartItem) { |
|
70 | + $item = $cartItem->item; |
|
71 | + $itemName = $item->name(); |
|
72 | + if (!isset($sums[$cartItem->price->currency_id])) { |
|
73 | + $sums[$cartItem->price->currency_id] = $cartItem->price->price; |
|
74 | + } else { |
|
75 | + $sums[$cartItem->price->currency_id] += $cartItem->price->price; |
|
76 | + } |
|
77 | + ?> |
|
78 | 78 | <tr> |
79 | 79 | <td class="text-left"><?= $itemName; ?></td> |
80 | 80 | <td class="text-right"><?= $cartItem->count; ?></td> |
81 | 81 | <td class="text-right"><?= $cartItem->price->price; ?> |
82 | 82 | <?php |
83 | - if (App::$cur->money) { |
|
84 | - $currency = Money\Currency::get($cartItem->price->currency_id); |
|
85 | - if ($currency) { |
|
86 | - echo $currency->acronym(); |
|
87 | - } else { |
|
88 | - echo 'руб.'; |
|
89 | - } |
|
90 | - } else { |
|
91 | - echo 'руб.'; |
|
92 | - } |
|
93 | - ?></td> |
|
83 | + if (App::$cur->money) { |
|
84 | + $currency = Money\Currency::get($cartItem->price->currency_id); |
|
85 | + if ($currency) { |
|
86 | + echo $currency->acronym(); |
|
87 | + } else { |
|
88 | + echo 'руб.'; |
|
89 | + } |
|
90 | + } else { |
|
91 | + echo 'руб.'; |
|
92 | + } |
|
93 | + ?></td> |
|
94 | 94 | <td class="text-right"><?= ($cartItem->price->price * $cartItem->count); ?> |
95 | 95 | <?php |
96 | - if (App::$cur->money) { |
|
97 | - $currency = Money\Currency::get($cartItem->price->currency_id); |
|
98 | - if ($currency) { |
|
99 | - echo $currency->acronym(); |
|
100 | - } else { |
|
101 | - echo 'руб.'; |
|
102 | - } |
|
103 | - } else { |
|
104 | - echo 'руб.'; |
|
105 | - } |
|
106 | - ?></td> |
|
96 | + if (App::$cur->money) { |
|
97 | + $currency = Money\Currency::get($cartItem->price->currency_id); |
|
98 | + if ($currency) { |
|
99 | + echo $currency->acronym(); |
|
100 | + } else { |
|
101 | + echo 'руб.'; |
|
102 | + } |
|
103 | + } else { |
|
104 | + echo 'руб.'; |
|
105 | + } |
|
106 | + ?></td> |
|
107 | 107 | <td class="text-right" style="white-space: nowrap;"> |
108 | 108 | <a onclick = 'inji.Ecommerce.Cart.addItem(<?= $item->getPrice()->id; ?>, 1); |
109 | 109 | return false;' data-original-title="Добавить в корзину" href="#" data-toggle="tooltip" title="" class="btn btn-primary"><i class="glyphicon glyphicon-shopping-cart"></i></a> |
110 | 110 | </tr> |
111 | 111 | <?php |
112 | - } |
|
113 | - ?> |
|
112 | + } |
|
113 | + ?> |
|
114 | 114 | </tbody> |
115 | 115 | <tfoot> |
116 | 116 | <tr> |
117 | 117 | <td colspan="2"></td> |
118 | 118 | <td class="text-right"><b>Сумма</b></td> |
119 | 119 | <td class="text-right"><?php |
120 | - foreach ($sums as $currency_id => $sum) { |
|
121 | - if (!$sum) { |
|
122 | - continue; |
|
123 | - } |
|
124 | - echo number_format($sum, 2, '.', ' '); |
|
125 | - if (App::$cur->money) { |
|
126 | - $currency = Money\Currency::get($currency_id); |
|
127 | - if ($currency) { |
|
128 | - echo ' ' . $currency->acronym(); |
|
129 | - } else { |
|
130 | - echo ' руб.'; |
|
131 | - } |
|
132 | - } else { |
|
133 | - echo ' руб.'; |
|
134 | - } |
|
135 | - echo '<br />'; |
|
136 | - } |
|
137 | - ?></td> |
|
120 | + foreach ($sums as $currency_id => $sum) { |
|
121 | + if (!$sum) { |
|
122 | + continue; |
|
123 | + } |
|
124 | + echo number_format($sum, 2, '.', ' '); |
|
125 | + if (App::$cur->money) { |
|
126 | + $currency = Money\Currency::get($currency_id); |
|
127 | + if ($currency) { |
|
128 | + echo ' ' . $currency->acronym(); |
|
129 | + } else { |
|
130 | + echo ' руб.'; |
|
131 | + } |
|
132 | + } else { |
|
133 | + echo ' руб.'; |
|
134 | + } |
|
135 | + echo '<br />'; |
|
136 | + } |
|
137 | + ?></td> |
|
138 | 138 | <td></td> |
139 | 139 | </tr> |
140 | 140 | <?php |
141 | - $deliveryCurrency = $cart->delivery ? $cart->delivery->currency_id : 0; |
|
142 | - $deliveryPrice = $cart->delivery->price; |
|
143 | - if (!isset($sums[$deliveryCurrency])) { |
|
144 | - $sums[$deliveryCurrency] = $deliveryPrice; |
|
145 | - } else { |
|
146 | - $sums[$deliveryCurrency] += $deliveryPrice; |
|
147 | - } |
|
148 | - $delCurrency = false; |
|
149 | - if (App::$cur->money) { |
|
150 | - $delCurrency = Money\Currency::get($deliveryPrice); |
|
151 | - } |
|
152 | - ?> |
|
141 | + $deliveryCurrency = $cart->delivery ? $cart->delivery->currency_id : 0; |
|
142 | + $deliveryPrice = $cart->delivery->price; |
|
143 | + if (!isset($sums[$deliveryCurrency])) { |
|
144 | + $sums[$deliveryCurrency] = $deliveryPrice; |
|
145 | + } else { |
|
146 | + $sums[$deliveryCurrency] += $deliveryPrice; |
|
147 | + } |
|
148 | + $delCurrency = false; |
|
149 | + if (App::$cur->money) { |
|
150 | + $delCurrency = Money\Currency::get($deliveryPrice); |
|
151 | + } |
|
152 | + ?> |
|
153 | 153 | <tr> |
154 | 154 | <td colspan="2"></td> |
155 | 155 | <td class="text-right"><b><?= $cart->delivery ? $cart->delivery->name : 'Доставка'; ?></b></td> |
@@ -160,24 +160,24 @@ discard block |
||
160 | 160 | <td colspan="2"></td> |
161 | 161 | <td class="text-right"><b>Итого</b></td> |
162 | 162 | <td class="text-right"><?php |
163 | - foreach ($sums as $currency_id => $sum) { |
|
164 | - if (!$sum) { |
|
165 | - continue; |
|
166 | - } |
|
167 | - echo number_format($sum, 2, '.', ' '); |
|
168 | - if (App::$cur->money) { |
|
169 | - $currency = Money\Currency::get($currency_id); |
|
170 | - if ($currency) { |
|
171 | - echo ' ' . $currency->acronym(); |
|
172 | - } else { |
|
173 | - echo ' руб.'; |
|
174 | - } |
|
175 | - } else { |
|
176 | - echo ' руб.'; |
|
177 | - } |
|
178 | - echo '<br />'; |
|
179 | - } |
|
180 | - ?></td> |
|
163 | + foreach ($sums as $currency_id => $sum) { |
|
164 | + if (!$sum) { |
|
165 | + continue; |
|
166 | + } |
|
167 | + echo number_format($sum, 2, '.', ' '); |
|
168 | + if (App::$cur->money) { |
|
169 | + $currency = Money\Currency::get($currency_id); |
|
170 | + if ($currency) { |
|
171 | + echo ' ' . $currency->acronym(); |
|
172 | + } else { |
|
173 | + echo ' руб.'; |
|
174 | + } |
|
175 | + } else { |
|
176 | + echo ' руб.'; |
|
177 | + } |
|
178 | + echo '<br />'; |
|
179 | + } |
|
180 | + ?></td> |
|
181 | 181 | <td></td> |
182 | 182 | </tr> |
183 | 183 | </tfoot> |
@@ -13,85 +13,85 @@ |
||
13 | 13 | |
14 | 14 | class Value extends \Migrations\Parser { |
15 | 15 | |
16 | - public function parse() { |
|
16 | + public function parse() { |
|
17 | 17 | $options = $this->param->options ? json_decode($this->param->options, true) : []; |
18 | 18 | $modelName = get_class($this->model); |
19 | 19 | $cols = $modelName::$cols; |
20 | 20 | $value = $this->data; |
21 | 21 | if (is_array($value)) { |
22 | - $value = ''; |
|
22 | + $value = ''; |
|
23 | 23 | } |
24 | 24 | if (!empty($cols[$this->param->value])) { |
25 | - $col = $cols[$this->param->value]; |
|
26 | - if ($col['type'] == 'dynamicType') { |
|
25 | + $col = $cols[$this->param->value]; |
|
26 | + if ($col['type'] == 'dynamicType') { |
|
27 | 27 | switch ($col['typeSource']) { |
28 | - case'selfMethod': |
|
28 | + case'selfMethod': |
|
29 | 29 | $type = $this->model->{$col['selfMethod']}(); |
30 | 30 | if (is_array($type)) { |
31 | - if (strpos($type['relation'], ':')) { |
|
31 | + if (strpos($type['relation'], ':')) { |
|
32 | 32 | $relationPath = explode(':', $type['relation']); |
33 | 33 | $relationName = array_pop($relationPath); |
34 | 34 | $item = $this->model; |
35 | 35 | foreach ($relationPath as $path) { |
36 | - $item = $item->$path; |
|
36 | + $item = $item->$path; |
|
37 | 37 | } |
38 | 38 | $itemModel = get_class($item); |
39 | 39 | $relation = $itemModel::getRelation($relationName); |
40 | 40 | $sourceModel = $relation['model']; |
41 | - } else { |
|
41 | + } else { |
|
42 | 42 | $relation = $modelName::getRelation($type['relation']); |
43 | 43 | $sourceModel = $relation['model']; |
44 | - } |
|
45 | - $objectId = \App::$cur->migrations->findObject((string) $value, $sourceModel); |
|
46 | - if ($objectId) { |
|
44 | + } |
|
45 | + $objectId = \App::$cur->migrations->findObject((string) $value, $sourceModel); |
|
46 | + if ($objectId) { |
|
47 | 47 | $value = $objectId->object_id; |
48 | - } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | break; |
51 | 51 | } |
52 | - } else { |
|
52 | + } else { |
|
53 | 53 | $type = $col['type']; |
54 | - } |
|
54 | + } |
|
55 | 55 | } else { |
56 | - $type = 'text'; |
|
56 | + $type = 'text'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if (!empty($options['valueReplace'])) { |
60 | - $values = $this->param->values(['key' => 'original']); |
|
61 | - if (empty($values[$value])) { |
|
60 | + $values = $this->param->values(['key' => 'original']); |
|
61 | + if (empty($values[$value])) { |
|
62 | 62 | $valueObject = new \Migrations\Migration\Object\Param\Value(); |
63 | 63 | $valueObject->param_id = $this->param->id; |
64 | 64 | $valueObject->original = $value; |
65 | 65 | $valueObject->save(); |
66 | - } else { |
|
66 | + } else { |
|
67 | 67 | $valueObject = $values[$value]; |
68 | - } |
|
69 | - $value = $valueObject->replace; |
|
68 | + } |
|
69 | + $value = $valueObject->replace; |
|
70 | 70 | } |
71 | 71 | switch ($type) { |
72 | - case 'image': |
|
72 | + case 'image': |
|
73 | 73 | $notEq = true; |
74 | 74 | $dir = pathinfo($this->object->walker->migtarionLog->source, PATHINFO_DIRNAME); |
75 | 75 | if ($this->model->{$this->param->value}) { |
76 | - $file = \Files\File::get($this->model->{$this->param->value}); |
|
77 | - if ($file && $value && file_exists($dir . '/' . $value) && file_exists(\App::$primary->path . $file->path) && md5_file($dir . '/' . $value) == md5_file(\App::$primary->path . $file->path)) { |
|
76 | + $file = \Files\File::get($this->model->{$this->param->value}); |
|
77 | + if ($file && $value && file_exists($dir . '/' . $value) && file_exists(\App::$primary->path . $file->path) && md5_file($dir . '/' . $value) == md5_file(\App::$primary->path . $file->path)) { |
|
78 | 78 | $notEq = false; |
79 | - } |
|
80 | - if ($file && $notEq) { |
|
79 | + } |
|
80 | + if ($file && $notEq) { |
|
81 | 81 | $file->delete(); |
82 | 82 | $this->model->{$this->param->value} = 0; |
83 | - } |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | if ($notEq) { |
86 | - $this->model->{$this->param->value} = \App::$primary->files->uploadFromUrl($dir . '/' . $value, ['accept_group' => 'image', 'upload_code' => 'MigrationUpload']); |
|
86 | + $this->model->{$this->param->value} = \App::$primary->files->uploadFromUrl($dir . '/' . $value, ['accept_group' => 'image', 'upload_code' => 'MigrationUpload']); |
|
87 | 87 | } |
88 | 88 | break; |
89 | - default: |
|
89 | + default: |
|
90 | 90 | if (is_array($value)) { |
91 | - $value = implode(' ', $value); |
|
91 | + $value = implode(' ', $value); |
|
92 | 92 | } |
93 | 93 | $this->model->{$this->param->value} = $value; |
94 | 94 | } |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -13,63 +13,63 @@ discard block |
||
13 | 13 | |
14 | 14 | class Option extends \Model { |
15 | 15 | |
16 | - public static $objectName = 'Свойство'; |
|
17 | - public static $cols = [ |
|
18 | - //Основные параметры |
|
19 | - 'name' => ['type' => 'text'], |
|
20 | - 'filter_name' => ['type' => 'text'], |
|
21 | - 'image_file_id' => ['type' => 'image'], |
|
22 | - 'code' => ['type' => 'text'], |
|
23 | - 'type' => ['type' => 'text'], |
|
24 | - 'postfix' => ['type' => 'text'], |
|
25 | - 'default_val' => ['type' => 'text'], |
|
26 | - 'view' => ['type' => 'bool'], |
|
27 | - 'searchable' => ['type' => 'bool'], |
|
28 | - //Системные |
|
29 | - 'weight' => ['type' => 'number'], |
|
30 | - 'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'], |
|
31 | - 'advance' => ['type' => 'text'], |
|
32 | - 'date_create' => ['type' => 'dateTime'], |
|
33 | - //Менеджеры |
|
34 | - 'item' => ['type' => 'dataManager', 'relation' => 'items'], |
|
35 | - ]; |
|
36 | - public static $labels = [ |
|
37 | - 'name' => 'Название', |
|
38 | - 'filter_name' => 'Название в фильтре', |
|
39 | - 'image_file_id' => 'Иконка', |
|
40 | - 'code' => 'Код', |
|
41 | - 'type' => 'Тип', |
|
42 | - 'postfix' => 'Постфикс', |
|
43 | - 'default_val' => 'Значение по умолчанию', |
|
44 | - 'view' => 'Отображается', |
|
45 | - 'searchable' => 'Используется при поиске', |
|
46 | - 'weight' => 'Вес сортировки', |
|
47 | - 'advance' => 'Дополнительные параметры', |
|
48 | - 'user_id' => 'Создатель', |
|
49 | - 'date_create' => 'Дата создания', |
|
50 | - 'item' => 'Значения для списка' |
|
51 | - ]; |
|
52 | - public static $dataManagers = [ |
|
53 | - 'manager' => [ |
|
54 | - 'name' => 'Свойства товаров', |
|
55 | - 'cols' => [ |
|
56 | - 'name', 'code', 'type', 'item', 'view', 'searchable', 'user_id', 'date_create' |
|
57 | - ] |
|
58 | - ] |
|
59 | - ]; |
|
60 | - public static $forms = [ |
|
61 | - 'manager' => [ |
|
62 | - 'map' => [ |
|
63 | - ['name', 'filter_name'], |
|
64 | - ['code', 'type', 'image_file_id'], |
|
65 | - ['default_val', 'postfix'], |
|
66 | - ['view', 'searchable'], |
|
67 | - ['item'] |
|
68 | - ] |
|
69 | - ] |
|
70 | - ]; |
|
16 | + public static $objectName = 'Свойство'; |
|
17 | + public static $cols = [ |
|
18 | + //Основные параметры |
|
19 | + 'name' => ['type' => 'text'], |
|
20 | + 'filter_name' => ['type' => 'text'], |
|
21 | + 'image_file_id' => ['type' => 'image'], |
|
22 | + 'code' => ['type' => 'text'], |
|
23 | + 'type' => ['type' => 'text'], |
|
24 | + 'postfix' => ['type' => 'text'], |
|
25 | + 'default_val' => ['type' => 'text'], |
|
26 | + 'view' => ['type' => 'bool'], |
|
27 | + 'searchable' => ['type' => 'bool'], |
|
28 | + //Системные |
|
29 | + 'weight' => ['type' => 'number'], |
|
30 | + 'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'], |
|
31 | + 'advance' => ['type' => 'text'], |
|
32 | + 'date_create' => ['type' => 'dateTime'], |
|
33 | + //Менеджеры |
|
34 | + 'item' => ['type' => 'dataManager', 'relation' => 'items'], |
|
35 | + ]; |
|
36 | + public static $labels = [ |
|
37 | + 'name' => 'Название', |
|
38 | + 'filter_name' => 'Название в фильтре', |
|
39 | + 'image_file_id' => 'Иконка', |
|
40 | + 'code' => 'Код', |
|
41 | + 'type' => 'Тип', |
|
42 | + 'postfix' => 'Постфикс', |
|
43 | + 'default_val' => 'Значение по умолчанию', |
|
44 | + 'view' => 'Отображается', |
|
45 | + 'searchable' => 'Используется при поиске', |
|
46 | + 'weight' => 'Вес сортировки', |
|
47 | + 'advance' => 'Дополнительные параметры', |
|
48 | + 'user_id' => 'Создатель', |
|
49 | + 'date_create' => 'Дата создания', |
|
50 | + 'item' => 'Значения для списка' |
|
51 | + ]; |
|
52 | + public static $dataManagers = [ |
|
53 | + 'manager' => [ |
|
54 | + 'name' => 'Свойства товаров', |
|
55 | + 'cols' => [ |
|
56 | + 'name', 'code', 'type', 'item', 'view', 'searchable', 'user_id', 'date_create' |
|
57 | + ] |
|
58 | + ] |
|
59 | + ]; |
|
60 | + public static $forms = [ |
|
61 | + 'manager' => [ |
|
62 | + 'map' => [ |
|
63 | + ['name', 'filter_name'], |
|
64 | + ['code', 'type', 'image_file_id'], |
|
65 | + ['default_val', 'postfix'], |
|
66 | + ['view', 'searchable'], |
|
67 | + ['item'] |
|
68 | + ] |
|
69 | + ] |
|
70 | + ]; |
|
71 | 71 | |
72 | - public static function relations() { |
|
72 | + public static function relations() { |
|
73 | 73 | return [ |
74 | 74 | 'user' => [ |
75 | 75 | 'model' => 'Users\User', |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | 'col' => 'image_file_id' |
86 | 86 | ], |
87 | 87 | ]; |
88 | - } |
|
88 | + } |
|
89 | 89 | |
90 | - public function beforeSave() { |
|
90 | + public function beforeSave() { |
|
91 | 91 | if (!isset($this->id)) { |
92 | - $this->user_id = \Users\User::$cur->id; |
|
92 | + $this->user_id = \Users\User::$cur->id; |
|
93 | 93 | } |
94 | 94 | if ($this->advance && is_array($this->advance)) { |
95 | - $this->advance = json_encode($this->advance); |
|
95 | + $this->advance = json_encode($this->advance); |
|
96 | + } |
|
96 | 97 | } |
97 | - } |
|
98 | 98 | |
99 | 99 | } |
@@ -13,67 +13,67 @@ |
||
13 | 13 | |
14 | 14 | class Options extends \Migrations\Parser { |
15 | 15 | |
16 | - static $options; |
|
16 | + static $options; |
|
17 | 17 | |
18 | - public function parse() { |
|
18 | + public function parse() { |
|
19 | 19 | if (!Options::$options) { |
20 | - Options::$options = \Ecommerce\Item\Option::getList(); |
|
20 | + Options::$options = \Ecommerce\Item\Option::getList(); |
|
21 | 21 | } |
22 | 22 | $options = []; |
23 | 23 | $modelName = 'Ecommerce\Item\Option'; |
24 | 24 | foreach ($this->data['ЗначенияСвойства'] as $opt) { |
25 | - $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id; |
|
26 | - if (Options::$options[$optionId]->type == 'select') { |
|
25 | + $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id; |
|
26 | + if (Options::$options[$optionId]->type == 'select') { |
|
27 | 27 | if (empty($options[$optionId])) { |
28 | - $options[$optionId] = []; |
|
28 | + $options[$optionId] = []; |
|
29 | 29 | } else { |
30 | - if (!Options::$options[$optionId]->advance) { |
|
30 | + if (!Options::$options[$optionId]->advance) { |
|
31 | 31 | Options::$options[$optionId]->advance = ['multi' => true]; |
32 | 32 | Options::$options[$optionId]->save(); |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id; |
36 | - } else { |
|
36 | + } else { |
|
37 | 37 | $options[$optionId] = $opt['Значение']; |
38 | - } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | $itemParams = \Ecommerce\Item\Param::getList(['where' => ['item_id', $this->model->id]]); |
41 | 41 | foreach ($itemParams as $itemParam) { |
42 | - if (Options::$options[$itemParam->item_option_id]->type == 'select') { |
|
42 | + if (Options::$options[$itemParam->item_option_id]->type == 'select') { |
|
43 | 43 | if (empty($options[$itemParam->item_option_id]) || !in_array($itemParam->value, $options[$itemParam->item_option_id])) { |
44 | - $itemParam->delete(); |
|
44 | + $itemParam->delete(); |
|
45 | 45 | } else { |
46 | - unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]); |
|
46 | + unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]); |
|
47 | 47 | } |
48 | - } else { |
|
48 | + } else { |
|
49 | 49 | if (empty($options[$itemParam->item_option_id])) { |
50 | - $itemParam->delete(); |
|
50 | + $itemParam->delete(); |
|
51 | 51 | } else { |
52 | - $itemParam->value = $options[$itemParam->item_option_id]; |
|
53 | - $itemParam->save(); |
|
54 | - unset($options[$itemParam->item_option_id]); |
|
52 | + $itemParam->value = $options[$itemParam->item_option_id]; |
|
53 | + $itemParam->save(); |
|
54 | + unset($options[$itemParam->item_option_id]); |
|
55 | + } |
|
55 | 56 | } |
56 | - } |
|
57 | 57 | } |
58 | 58 | foreach ($options as $optionId => $values) { |
59 | - if (is_array($values)) { |
|
59 | + if (is_array($values)) { |
|
60 | 60 | foreach ($values as $value) { |
61 | - $itemParam = new \Ecommerce\Item\Param([ |
|
62 | - 'item_option_id' => $optionId, |
|
63 | - 'item_id' => $this->model->id, |
|
64 | - 'value' => $value |
|
65 | - ]); |
|
66 | - $itemParam->save(); |
|
61 | + $itemParam = new \Ecommerce\Item\Param([ |
|
62 | + 'item_option_id' => $optionId, |
|
63 | + 'item_id' => $this->model->id, |
|
64 | + 'value' => $value |
|
65 | + ]); |
|
66 | + $itemParam->save(); |
|
67 | 67 | } |
68 | - } else { |
|
68 | + } else { |
|
69 | 69 | $itemParam = new \Ecommerce\Item\Param([ |
70 | 70 | 'item_option_id' => $optionId, |
71 | 71 | 'item_id' => $this->model->id, |
72 | 72 | 'value' => $values |
73 | 73 | ]); |
74 | 74 | $itemParam->save(); |
75 | - } |
|
75 | + } |
|
76 | + } |
|
76 | 77 | } |
77 | - } |
|
78 | 78 | |
79 | 79 | } |
@@ -13,50 +13,50 @@ discard block |
||
13 | 13 | |
14 | 14 | class Category extends \Model { |
15 | 15 | |
16 | - public static $objectName = 'Категория магазина'; |
|
17 | - public static $treeCategory = 'Ecommerce\Item'; |
|
18 | - public static $cols = [ |
|
19 | - //Основные параметры |
|
20 | - 'parent_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'parent'], |
|
21 | - 'name' => ['type' => 'text'], |
|
22 | - 'alias' => ['type' => 'text'], |
|
23 | - 'viewer' => ['type' => 'select', 'source' => 'method', 'method' => 'viewsCategoryList', 'module' => 'Ecommerce'], |
|
24 | - 'template' => ['type' => 'select', 'source' => 'method', 'method' => 'templatesCategoryList', 'module' => 'Ecommerce'], |
|
25 | - 'description' => ['type' => 'html'], |
|
26 | - 'image_file_id' => ['type' => 'image'], |
|
27 | - 'options_inherit' => ['type' => 'bool'], |
|
28 | - //Системные |
|
29 | - 'imported' => ['type' => 'bool'], |
|
30 | - 'weight' => ['type' => 'number'], |
|
31 | - 'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'], |
|
32 | - 'tree_path' => ['type' => 'text'], |
|
33 | - 'date_create' => ['type' => 'dateTime'], |
|
34 | - //Менеджеры |
|
35 | - 'options' => ['type' => 'dataManager', 'relation' => 'options'], |
|
36 | - ]; |
|
37 | - public static $labels = [ |
|
38 | - 'name' => 'Название', |
|
39 | - 'alias' => 'Алиас', |
|
40 | - 'parent_id' => 'Родительская категория', |
|
41 | - 'image_file_id' => 'Изображение', |
|
42 | - 'description' => 'Описание', |
|
43 | - 'options_inherit' => 'Наследовать набор свойств', |
|
44 | - 'options' => 'Свойства товаров', |
|
45 | - ]; |
|
46 | - public static $forms = [ |
|
47 | - 'manager' => [ |
|
48 | - 'map' => [ |
|
49 | - ['name', 'alias'], |
|
50 | - ['parent_id', 'image_file_id'], |
|
51 | - ['viewer', 'template'], |
|
52 | - ['options_inherit'], |
|
53 | - ['options'], |
|
54 | - ['description'] |
|
55 | - ] |
|
56 | - ] |
|
57 | - ]; |
|
16 | + public static $objectName = 'Категория магазина'; |
|
17 | + public static $treeCategory = 'Ecommerce\Item'; |
|
18 | + public static $cols = [ |
|
19 | + //Основные параметры |
|
20 | + 'parent_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'parent'], |
|
21 | + 'name' => ['type' => 'text'], |
|
22 | + 'alias' => ['type' => 'text'], |
|
23 | + 'viewer' => ['type' => 'select', 'source' => 'method', 'method' => 'viewsCategoryList', 'module' => 'Ecommerce'], |
|
24 | + 'template' => ['type' => 'select', 'source' => 'method', 'method' => 'templatesCategoryList', 'module' => 'Ecommerce'], |
|
25 | + 'description' => ['type' => 'html'], |
|
26 | + 'image_file_id' => ['type' => 'image'], |
|
27 | + 'options_inherit' => ['type' => 'bool'], |
|
28 | + //Системные |
|
29 | + 'imported' => ['type' => 'bool'], |
|
30 | + 'weight' => ['type' => 'number'], |
|
31 | + 'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'], |
|
32 | + 'tree_path' => ['type' => 'text'], |
|
33 | + 'date_create' => ['type' => 'dateTime'], |
|
34 | + //Менеджеры |
|
35 | + 'options' => ['type' => 'dataManager', 'relation' => 'options'], |
|
36 | + ]; |
|
37 | + public static $labels = [ |
|
38 | + 'name' => 'Название', |
|
39 | + 'alias' => 'Алиас', |
|
40 | + 'parent_id' => 'Родительская категория', |
|
41 | + 'image_file_id' => 'Изображение', |
|
42 | + 'description' => 'Описание', |
|
43 | + 'options_inherit' => 'Наследовать набор свойств', |
|
44 | + 'options' => 'Свойства товаров', |
|
45 | + ]; |
|
46 | + public static $forms = [ |
|
47 | + 'manager' => [ |
|
48 | + 'map' => [ |
|
49 | + ['name', 'alias'], |
|
50 | + ['parent_id', 'image_file_id'], |
|
51 | + ['viewer', 'template'], |
|
52 | + ['options_inherit'], |
|
53 | + ['options'], |
|
54 | + ['description'] |
|
55 | + ] |
|
56 | + ] |
|
57 | + ]; |
|
58 | 58 | |
59 | - public static function indexes() { |
|
59 | + public static function indexes() { |
|
60 | 60 | return [ |
61 | 61 | 'ecommerce_category_category_parent_id' => [ |
62 | 62 | 'type' => 'INDEX', |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | ] |
72 | 72 | ], |
73 | 73 | ]; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - public static function relations() { |
|
76 | + public static function relations() { |
|
77 | 77 | return [ |
78 | 78 | 'items' => [ |
79 | 79 | 'type' => 'many', |
@@ -103,50 +103,50 @@ discard block |
||
103 | 103 | 'col' => 'parent_id', |
104 | 104 | ] |
105 | 105 | ]; |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - public static $dataManagers = [ |
|
109 | - 'manager' => [ |
|
110 | - 'name' => 'Категории товаров', |
|
111 | - 'cols' => [ |
|
112 | - 'name', |
|
113 | - 'parent_id', |
|
114 | - ], |
|
115 | - 'sortMode' => true |
|
116 | - ] |
|
117 | - ]; |
|
108 | + public static $dataManagers = [ |
|
109 | + 'manager' => [ |
|
110 | + 'name' => 'Категории товаров', |
|
111 | + 'cols' => [ |
|
112 | + 'name', |
|
113 | + 'parent_id', |
|
114 | + ], |
|
115 | + 'sortMode' => true |
|
116 | + ] |
|
117 | + ]; |
|
118 | 118 | |
119 | - public function beforeSave() { |
|
119 | + public function beforeSave() { |
|
120 | 120 | if ($this->id && $this->id == $this->parent_id) { |
121 | - $this->parent_id = 0; |
|
122 | - \Msg::add('Категория не может быть сама себе родителем'); |
|
121 | + $this->parent_id = 0; |
|
122 | + \Msg::add('Категория не может быть сама себе родителем'); |
|
123 | + } |
|
123 | 124 | } |
124 | - } |
|
125 | 125 | |
126 | - public function beforeDelete() { |
|
126 | + public function beforeDelete() { |
|
127 | 127 | foreach ($this->catalogs as $category) { |
128 | - $category->delete(); |
|
128 | + $category->delete(); |
|
129 | + } |
|
129 | 130 | } |
130 | - } |
|
131 | 131 | |
132 | - public function resolveTemplate() { |
|
132 | + public function resolveTemplate() { |
|
133 | 133 | if ($this->template !== 'inherit') { |
134 | - return $this->template; |
|
134 | + return $this->template; |
|
135 | 135 | } elseif ($this->template == 'inherit' && $this->category) { |
136 | - return $this->category->resolveTemplate(true); |
|
136 | + return $this->category->resolveTemplate(true); |
|
137 | 137 | } else { |
138 | - return 'current'; |
|
138 | + return 'current'; |
|
139 | + } |
|
139 | 140 | } |
140 | - } |
|
141 | 141 | |
142 | - public function resolveViewer() { |
|
142 | + public function resolveViewer() { |
|
143 | 143 | if ($this->viewer !== 'inherit') { |
144 | - return $this->viewer; |
|
144 | + return $this->viewer; |
|
145 | 145 | } elseif ($this->viewer == 'inherit' && $this->category) { |
146 | - return $this->category->resolveViewer(true); |
|
146 | + return $this->category->resolveViewer(true); |
|
147 | 147 | } else { |
148 | - return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList'); |
|
148 | + return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList'); |
|
149 | + } |
|
149 | 150 | } |
150 | - } |
|
151 | 151 | |
152 | 152 | } |
@@ -22,13 +22,13 @@ |
||
22 | 22 | 'style' => '' |
23 | 23 | ]; |
24 | 24 | if (!empty($dataManager->managerOptions['categorys'])) { |
25 | - $mainCol['style'].='margin-left:260px;'; |
|
26 | - echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">'; |
|
27 | - $this->widget('Ui\DataManager/categorys', compact('dataManager')); |
|
28 | - echo '</div>'; |
|
25 | + $mainCol['style'].='margin-left:260px;'; |
|
26 | + echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">'; |
|
27 | + $this->widget('Ui\DataManager/categorys', compact('dataManager')); |
|
28 | + echo '</div>'; |
|
29 | 29 | } |
30 | 30 | if (!empty($dataManager->managerOptions['filters'])) { |
31 | - ?> |
|
31 | + ?> |
|
32 | 32 | <div class="modal fade" id = "<?= $dataManager->managerId; ?>_filters" > |
33 | 33 | <div class="modal-dialog modal-lg"> |
34 | 34 | <div class="modal-content"> |