@@ -260,8 +260,7 @@ discard block |
||
260 | 260 | } else { |
261 | 261 | $value = $item->$colName; |
262 | 262 | } |
263 | - } |
|
264 | - else { |
|
263 | + } else { |
|
265 | 264 | $value = $item->$colName; |
266 | 265 | } |
267 | 266 | break; |
@@ -751,17 +750,21 @@ discard block |
||
751 | 750 | if (!$query) { |
752 | 751 | return []; |
753 | 752 | } |
754 | - if (!empty($options['where'])) |
|
755 | - $query->where($options['where']); |
|
753 | + if (!empty($options['where'])) { |
|
754 | + $query->where($options['where']); |
|
755 | + } |
|
756 | 756 | if (!empty($options['group'])) { |
757 | 757 | $query->group($options['group']); |
758 | 758 | } |
759 | - if (!empty($options['order'])) |
|
760 | - $query->order($options['order']); |
|
761 | - if (!empty($options['join'])) |
|
762 | - $query->join($options['join']); |
|
763 | - if (!empty($options['distinct'])) |
|
764 | - $query->distinct = $options['distinct']; |
|
759 | + if (!empty($options['order'])) { |
|
760 | + $query->order($options['order']); |
|
761 | + } |
|
762 | + if (!empty($options['join'])) { |
|
763 | + $query->join($options['join']); |
|
764 | + } |
|
765 | + if (!empty($options['distinct'])) { |
|
766 | + $query->distinct = $options['distinct']; |
|
767 | + } |
|
765 | 768 | |
766 | 769 | foreach (static::$relJoins as $join) { |
767 | 770 | $query->join($join[0], $join[1]); |
@@ -787,14 +790,14 @@ discard block |
||
787 | 790 | } |
788 | 791 | static::$needJoin = []; |
789 | 792 | |
790 | - if (!empty($options['limit'])) |
|
791 | - $limit = (int) $options['limit']; |
|
792 | - else { |
|
793 | + if (!empty($options['limit'])) { |
|
794 | + $limit = (int) $options['limit']; |
|
795 | + } else { |
|
793 | 796 | $limit = 0; |
794 | 797 | } |
795 | - if (!empty($options['start'])) |
|
796 | - $start = (int) $options['start']; |
|
797 | - else { |
|
798 | + if (!empty($options['start'])) { |
|
799 | + $start = (int) $options['start']; |
|
800 | + } else { |
|
798 | 801 | $start = 0; |
799 | 802 | } |
800 | 803 | if ($limit || $start) { |
@@ -1061,21 +1064,23 @@ discard block |
||
1061 | 1064 | if (!empty($options['where'])) { |
1062 | 1065 | static::fixPrefix($options['where'], 'first'); |
1063 | 1066 | } |
1064 | - if (!empty($options['where'])) |
|
1065 | - $query->where($options['where']); |
|
1066 | - if (!empty($options['join'])) |
|
1067 | - $query->join($options['join']); |
|
1067 | + if (!empty($options['where'])) { |
|
1068 | + $query->where($options['where']); |
|
1069 | + } |
|
1070 | + if (!empty($options['join'])) { |
|
1071 | + $query->join($options['join']); |
|
1072 | + } |
|
1068 | 1073 | if (!empty($options['order'])) { |
1069 | 1074 | $query->order($options['order']); |
1070 | 1075 | } |
1071 | - if (!empty($options['limit'])) |
|
1072 | - $limit = (int) $options['limit']; |
|
1073 | - else { |
|
1076 | + if (!empty($options['limit'])) { |
|
1077 | + $limit = (int) $options['limit']; |
|
1078 | + } else { |
|
1074 | 1079 | $limit = 0; |
1075 | 1080 | } |
1076 | - if (!empty($options['start'])) |
|
1077 | - $start = (int) $options['start']; |
|
1078 | - else { |
|
1081 | + if (!empty($options['start'])) { |
|
1082 | + $start = (int) $options['start']; |
|
1083 | + } else { |
|
1079 | 1084 | $start = 0; |
1080 | 1085 | } |
1081 | 1086 | if ($limit || $start) { |
@@ -1153,8 +1158,9 @@ discard block |
||
1153 | 1158 | |
1154 | 1159 | $values = []; |
1155 | 1160 | foreach ($cols as $col => $param) { |
1156 | - if (isset($params[$col])) |
|
1157 | - $values[$col] = $params[$col]; |
|
1161 | + if (isset($params[$col])) { |
|
1162 | + $values[$col] = $params[$col]; |
|
1163 | + } |
|
1158 | 1164 | } |
1159 | 1165 | if (empty($values)) { |
1160 | 1166 | return false; |
@@ -1337,8 +1343,9 @@ discard block |
||
1337 | 1343 | $values = []; |
1338 | 1344 | |
1339 | 1345 | foreach ($this->cols() as $col => $param) { |
1340 | - if (isset($this->_params[$col])) |
|
1341 | - $values[$col] = $this->_params[$col]; |
|
1346 | + if (isset($this->_params[$col])) { |
|
1347 | + $values[$col] = $this->_params[$col]; |
|
1348 | + } |
|
1342 | 1349 | } |
1343 | 1350 | if (empty($values) && empty($options['empty'])) { |
1344 | 1351 | return false; |
@@ -1498,8 +1505,9 @@ discard block |
||
1498 | 1505 | { |
1499 | 1506 | |
1500 | 1507 | foreach (static::relations() as $relName => $rel) { |
1501 | - if ($rel['col'] == $col) |
|
1502 | - return $relName; |
|
1508 | + if ($rel['col'] == $col) { |
|
1509 | + return $relName; |
|
1510 | + } |
|
1503 | 1511 | } |
1504 | 1512 | return NULL; |
1505 | 1513 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $name = ''; |
53 | 53 | foreach ($fields as $field) { |
54 | 54 | if ($field->save && !empty($data[$field->id])) { |
55 | - $name .= htmlspecialchars($data[$field->id]) . ' '; |
|
55 | + $name .= htmlspecialchars($data[$field->id]).' '; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | $name = trim($name); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $name = ''; |
110 | 110 | foreach ($fields as $field) { |
111 | 111 | if ($field->save && !empty($data[$field->id])) { |
112 | - $name .= htmlspecialchars($data[$field->id]) . ' '; |
|
112 | + $name .= htmlspecialchars($data[$field->id]).' '; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | $name = trim($name); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | foreach ($options['sort'] as $col => $direction) { |
197 | 197 | switch ($col) { |
198 | 198 | case 'price': |
199 | - $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
|
199 | + $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
|
200 | 200 | break; |
201 | 201 | case 'name': |
202 | 202 | $selectOptions['order'][] = ['name', strtolower($direction) == 'desc' ? 'desc' : 'asc']; |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | $selectOptions['where'][] = ['image_file_id', 0, '!=']; |
216 | 216 | } |
217 | 217 | |
218 | - $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = ' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'inner']; |
|
218 | + $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index().' = '.Ecommerce\Item\Offer::colPrefix().Ecommerce\Item::index(), 'inner']; |
|
219 | 219 | |
220 | 220 | $selectOptions['join'][] = [Ecommerce\Item\Offer\Price::table(), |
221 | - Ecommerce\Item\Offer::index() . ' = ' . Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer::index() . |
|
222 | - (empty($this->config['show_zero_price']) ? ' and ' . Ecommerce\Item\Offer\Price::colPrefix() . 'price>0' : ''), |
|
221 | + Ecommerce\Item\Offer::index().' = '.Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer::index(). |
|
222 | + (empty($this->config['show_zero_price']) ? ' and '.Ecommerce\Item\Offer\Price::colPrefix().'price>0' : ''), |
|
223 | 223 | empty($this->config['show_without_price']) ? 'inner' : 'left']; |
224 | 224 | |
225 | 225 | $selectOptions['join'][] = [ |
226 | - Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer\Price\Type::index() . ' = ' . Ecommerce\Item\Offer\Price\Type::index() |
|
226 | + Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer\Price\Type::index().' = '.Ecommerce\Item\Offer\Price\Type::index() |
|
227 | 227 | ]; |
228 | 228 | |
229 | 229 | $selectOptions['where'][] = [ |
230 | 230 | [Ecommerce\Item\Offer\Price\Type::index(), NULL, 'is'], |
231 | 231 | [ |
232 | - [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '', '=', 'OR'], |
|
233 | - [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '%|' . \Users\User::$cur->role_id . '|%', 'LIKE', 'OR'], |
|
232 | + [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '', '=', 'OR'], |
|
233 | + [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '%|'.\Users\User::$cur->role_id.'|%', 'LIKE', 'OR'], |
|
234 | 234 | ], |
235 | 235 | ]; |
236 | 236 | |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | if (!empty($this->config['view_filter'])) { |
239 | 239 | if (!empty($this->config['view_filter']['options'])) { |
240 | 240 | foreach ($this->config['view_filter']['options'] as $optionId => $optionValue) { |
241 | - $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' . |
|
242 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
243 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"', |
|
244 | - 'inner', 'option' . $optionId]; |
|
241 | + $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '. |
|
242 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '. |
|
243 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = "'.(int) $optionValue.'"', |
|
244 | + 'inner', 'option'.$optionId]; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | switch ($col) { |
252 | 252 | case 'price': |
253 | 253 | if (!empty($filter['min'])) { |
254 | - $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>=']; |
|
254 | + $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['min'], '>=']; |
|
255 | 255 | } |
256 | 256 | if (!empty($filter['max'])) { |
257 | - $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<=']; |
|
257 | + $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['max'], '<=']; |
|
258 | 258 | } |
259 | 259 | break; |
260 | 260 | case 'options': |
261 | 261 | foreach ($filter as $optionId => $optionValue) { |
262 | 262 | $optionId = (int) $optionId; |
263 | - $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' . |
|
264 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
265 | - 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '', |
|
266 | - 'inner', 'option' . $optionId]; |
|
263 | + $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '. |
|
264 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '. |
|
265 | + 'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = '.\App::$cur->db->connection->pdo->quote($optionValue).'', |
|
266 | + 'inner', 'option'.$optionId]; |
|
267 | 267 | } |
268 | 268 | break; |
269 | 269 | case 'offerOptions': |
270 | 270 | //$selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = offer.' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'left', 'offer']; |
271 | 271 | foreach ($filter as $optionId => $optionValue) { |
272 | 272 | $optionId = (int) $optionId; |
273 | - $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' . |
|
274 | - 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
275 | - 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '', |
|
276 | - 'inner', 'offerOption' . $optionId]; |
|
273 | + $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index().' = '.'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer::index().' AND '. |
|
274 | + 'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer\Option::index().' = "'.(int) $optionId.'" AND '. |
|
275 | + 'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().'value = '.\App::$cur->db->connection->pdo->quote($optionValue).'', |
|
276 | + 'inner', 'offerOption'.$optionId]; |
|
277 | 277 | } |
278 | 278 | break; |
279 | 279 | } |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | continue; |
289 | 289 | } |
290 | 290 | $category = \Ecommerce\Category::get($categoryId); |
291 | - $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
291 | + $where[] = ['tree_path', $category->tree_path.(int) $categoryId.'/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
292 | 292 | $first = false; |
293 | 293 | } |
294 | 294 | $selectOptions['where'][] = $where; |
295 | 295 | } elseif (!empty($options['parent'])) { |
296 | 296 | $category = \Ecommerce\Category::get($options['parent']); |
297 | - $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE']; |
|
297 | + $selectOptions['where'][] = ['tree_path', $category->tree_path.(int) $options['parent'].'/%', 'LIKE']; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | //search |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | foreach (explode(' ', $searchStr) as $part) { |
305 | 305 | $part = trim($part); |
306 | 306 | if ($part && strlen($part) > 2) { |
307 | - $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE']; |
|
307 | + $searchArr[] = ['search_index', '%'.$part.'%', 'LIKE']; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | if (!empty($searchArr)) { |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | } |
324 | 324 | $selectOptions['where'][] = [ |
325 | 325 | '( |
326 | - (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count`),0) |
|
327 | - FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Item\Offer\Warehouse::table() . ' iciw |
|
328 | - WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ' |
|
329 | - ' . ($warehouseIds ? ' AND iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index() . ' IN(' . implode(',', $warehouseIds) . ')' : '') . ' |
|
326 | + (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix().'count`),0) |
|
327 | + FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Item\Offer\Warehouse::table().' iciw |
|
328 | + WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().' |
|
329 | + ' . ($warehouseIds ? ' AND iciw.'.\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index().' IN('.implode(',', $warehouseIds).')' : '').' |
|
330 | 330 | ) |
331 | 331 | - |
332 | - (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) |
|
333 | - FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Warehouse\Block::table() . ' iewb |
|
334 | - inner JOIN ' . \App::$cur->db->table_prefix . \Ecommerce\Cart::table() . ' icc ON icc.' . \Ecommerce\Cart::index() . ' = iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND ( |
|
335 | - (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) || |
|
336 | - (`' . \Ecommerce\Cart::colPrefix() . \Ecommerce\Cart\Status::index() . '` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
332 | + (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix().'count) ,0) |
|
333 | + FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Warehouse\Block::table().' iewb |
|
334 | + inner JOIN ' . \App::$cur->db->table_prefix.\Ecommerce\Cart::table().' icc ON icc.'.\Ecommerce\Cart::index().' = iewb.'.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND ( |
|
335 | + (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) || |
|
336 | + (`' . \Ecommerce\Cart::colPrefix().\Ecommerce\Cart\Status::index().'` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
337 | 337 | ) |
338 | - WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ') |
|
338 | + WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().') |
|
339 | 339 | )', |
340 | 340 | 0, |
341 | 341 | '>' |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $items = Ecommerce\Item::getList($selectOptions); |
365 | 365 | $items = Ecommerce\Item\Param::getList([ |
366 | 366 | 'where' => ['item_id', array_keys($items), 'IN'], |
367 | - 'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index() . ' = ' . \Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' and ' . \Ecommerce\Item\Option::colPrefix() . 'searchable = 1', 'inner']], |
|
367 | + 'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index().' = '.\Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' and '.\Ecommerce\Item\Option::colPrefix().'searchable = 1', 'inner']], |
|
368 | 368 | 'distinct' => \Ecommerce\Item\Option::index() |
369 | 369 | ]); |
370 | 370 | return $items; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if (is_array($counts)) { |
398 | 398 | $sum = 0; |
399 | 399 | foreach ($counts as $count) { |
400 | - $sum +=$count['count']; |
|
400 | + $sum += $count['count']; |
|
401 | 401 | } |
402 | 402 | return $sum; |
403 | 403 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | if (!empty($conf['files']['aditionTemplateFiels'])) { |
435 | 435 | foreach ($conf['files']['aditionTemplateFiels'] as $file) { |
436 | - $return[$file['file']] = '- ' . $file['name']; |
|
436 | + $return[$file['file']] = '- '.$file['name']; |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | return $return; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | public function realType() |
57 | 57 | { |
58 | - if ($this->option && $this->option->type) { |
|
58 | + if ($this->option && $this->option->type) { |
|
59 | 59 | $type = $this->option->type; |
60 | 60 | |
61 | 61 | if ($type == 'select') { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'col' => 'item_offer_id', |
77 | 77 | //'resultKey' => 'code', |
78 | 78 | 'resultKey' => 'item_offer_option_id', |
79 | - 'join' => [Offer\Option::table(), Offer\Option::index() . ' = ' . Offer\Param::colPrefix() . Offer\Option::index()] |
|
79 | + 'join' => [Offer\Option::table(), Offer\Option::index().' = '.Offer\Param::colPrefix().Offer\Option::index()] |
|
80 | 80 | ], |
81 | 81 | 'item' => [ |
82 | 82 | 'model' => 'Ecommerce\Item', |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | { |
90 | 90 | $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]); |
91 | 91 | if ($warehouse) { |
92 | - $warehouse->count +=(float) $count; |
|
92 | + $warehouse->count += (float) $count; |
|
93 | 93 | $warehouse->save(); |
94 | 94 | } else { |
95 | 95 | $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]); |
96 | 96 | if ($warehouse) { |
97 | - $warehouse->count +=(float) $count; |
|
97 | + $warehouse->count += (float) $count; |
|
98 | 98 | $warehouse->save(); |
99 | 99 | } |
100 | 100 | } |
@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | if ($warehouseIds) { |
115 | - \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index(), $warehouseIds, 'IN'); |
|
115 | + \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index(), $warehouseIds, 'IN'); |
|
116 | 116 | } |
117 | - \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id); |
|
118 | - \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count),0) as `sum` '; |
|
117 | + \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index(), $this->id); |
|
118 | + \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Item\Offer\Warehouse::colPrefix().'count),0) as `sum` '; |
|
119 | 119 | $warehouse = \App::$cur->db->select(\Ecommerce\Item\Offer\Warehouse::table())->fetch(); |
120 | 120 | |
121 | - \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) as `sum` '; |
|
122 | - \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id); |
|
121 | + \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Warehouse\Block::colPrefix().'count) ,0) as `sum` '; |
|
122 | + \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index(), $this->id); |
|
123 | 123 | if ($cart_id) { |
124 | - \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index(), (int) $cart_id, '!='); |
|
124 | + \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index(), (int) $cart_id, '!='); |
|
125 | 125 | } |
126 | 126 | $on = ' |
127 | - ' . \Ecommerce\Cart::index() . ' = ' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND ( |
|
128 | - (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) || |
|
129 | - (`' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
127 | + ' . \Ecommerce\Cart::index().' = '.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND ( |
|
128 | + (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) || |
|
129 | + (`' . \Ecommerce\Cart::colPrefix().'cart_status_id` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE)) |
|
130 | 130 | ) |
131 | 131 | '; |
132 | 132 | \App::$cur->db->join(\Ecommerce\Cart::table(), $on, 'inner'); |
@@ -38,25 +38,25 @@ |
||
38 | 38 | $return = new Server\Result(); |
39 | 39 | ob_start(); |
40 | 40 | $form->checkRequest($params, true); |
41 | - $_GET['item'] = get_class($form->model) . ($model->pk() ? ':' . $model->pk() : ''); |
|
41 | + $_GET['item'] = get_class($form->model).($model->pk() ? ':'.$model->pk() : ''); |
|
42 | 42 | $get = $_GET; |
43 | 43 | if (isset($get['notSave'])) { |
44 | 44 | unset($get['notSave']); |
45 | 45 | } |
46 | - $form->action = (App::$cur->system ? '/' . App::$cur->name : '') . '/ui/formPopUp/?' . http_build_query($get); |
|
46 | + $form->action = (App::$cur->system ? '/'.App::$cur->name : '').'/ui/formPopUp/?'.http_build_query($get); |
|
47 | 47 | $form->draw($params, true); |
48 | 48 | $return->content = ob_get_contents(); |
49 | 49 | ob_end_clean(); |
50 | 50 | $return->send(); |
51 | 51 | } else { |
52 | 52 | $form->checkRequest($params); |
53 | - $_GET['item'] = get_class($form->model) . ($model->pk() ? ':' . $model->pk() : ''); |
|
53 | + $_GET['item'] = get_class($form->model).($model->pk() ? ':'.$model->pk() : ''); |
|
54 | 54 | $get = $_GET; |
55 | 55 | if (isset($get['notSave'])) { |
56 | 56 | unset($get['notSave']); |
57 | 57 | } |
58 | - $form->action = (App::$cur->system ? '/' . App::$cur->name : '') . '/ui/formPopUp/?' . http_build_query($get); |
|
59 | - $this->view->setTitle(($model && $model->pk() ? 'Изменить ' : 'Создать ') . $form->header); |
|
58 | + $form->action = (App::$cur->system ? '/'.App::$cur->name : '').'/ui/formPopUp/?'.http_build_query($get); |
|
59 | + $this->view->setTitle(($model && $model->pk() ? 'Изменить ' : 'Создать ').$form->header); |
|
60 | 60 | $this->view->page(['content' => 'form', 'data' => compact('form', 'params')]); |
61 | 61 | } |
62 | 62 | } |