Completed
Push — master ( 0afdc4...0e57e6 )
by Alexey
04:27
created
system/modules/View/appAdminControllers/content/Template/chooseFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 <hr/>
4 4
 <?php
5 5
 foreach ($template->config['css'] as $file) {
6
-    if (file_exists($template->path . '/css/' . $file)) {
6
+    if (file_exists($template->path.'/css/'.$file)) {
7 7
         ?>
8
-        <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/' . $file; ?>'><?= $file; ?></a>
8
+        <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/'.$file; ?>'><?= $file; ?></a>
9 9
         <?php
10 10
     }
11 11
 }
Please login to merge, or discard this patch.
system/modules/Sitemap/Sitemap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         header("Content-Type: text/xml");
29 29
         header("Expires: Thu, 19 Feb 1998 13:24:18 GMT");
30
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
30
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
31 31
         header("Cache-Control: no-cache, must-revalidate");
32 32
         header("Cache-Control: post-check=0,pre-check=0");
33 33
         header("Cache-Control: max-age=0");
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $root->setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");
40 40
         $root = $xml->appendChild($root);
41 41
 
42
-        $addToXml = function ($xml, $parent, $nodeName, $text) {
42
+        $addToXml = function($xml, $parent, $nodeName, $text) {
43 43
             $node = $parent->appendChild($xml->createElement($nodeName));
44 44
             $node->appendChild($xml->createTextNode($text));
45 45
             return $node;
Please login to merge, or discard this patch.
system/modules/Sitemap/install_script.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-return function ($step = NULL, $params = []) {
3
+return function($step = NULL, $params = []) {
4 4
 
5 5
     $groups = [
6 6
         [
Please login to merge, or discard this patch.
system/modules/Materials/Materials.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         if (!empty($conf['files']['aditionTemplateFiels'])) {
43 43
             foreach ($conf['files']['aditionTemplateFiels'] as $file) {
44
-                $return[$file['file']] = '- ' . $file['name'];
44
+                $return[$file['file']] = '- '.$file['name'];
45 45
             }
46 46
         }
47 47
         return $return;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         if (!empty($conf['files']['aditionTemplateFiels'])) {
79 79
             foreach ($conf['files']['aditionTemplateFiels'] as $file) {
80
-                $return[$file['file']] = '- ' . $file['name'];
80
+                $return[$file['file']] = '- '.$file['name'];
81 81
             }
82 82
         }
83 83
         return $return;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $map[] = [
92 92
                 'name' => $mat->name,
93 93
                 'url' => [
94
-                    'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($mat->getHref())
94
+                    'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.INJI_DOMAIN_NAME.($mat->getHref())
95 95
                 ],
96 96
             ];
97 97
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $map[] = [
105 105
                     'name' => $mat->name,
106 106
                     'url' => [
107
-                        'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($mat->getHref())
107
+                        'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.INJI_DOMAIN_NAME.($mat->getHref())
108 108
                     ],
109 109
                 ];
110 110
             }
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/content/Cart/orderDetail.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 '&nbsp;' . $currency->acronym();
129
-                      } else {
130
-                          echo '&nbsp;руб.';
131
-                      }
132
-                  } else {
133
-                      echo '&nbsp;руб.';
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 '&nbsp;' . $currency->acronym();
129
+                        } else {
130
+                            echo '&nbsp;руб.';
131
+                        }
132
+                    } else {
133
+                        echo '&nbsp;руб.';
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
 block discarded – undo
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 '&nbsp;' . $currency->acronym();
172
-                      } else {
173
-                          echo '&nbsp;руб.';
174
-                      }
175
-                  } else {
176
-                      echo '&nbsp;руб.';
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 '&nbsp;' . $currency->acronym();
172
+                        } else {
173
+                            echo '&nbsp;руб.';
174
+                        }
175
+                    } else {
176
+                        echo '&nbsp;руб.';
177
+                    }
178
+                    echo '<br />';
179
+                }
180
+                ?></td>
181 181
             <td></td>
182 182
           </tr>
183 183
         </tfoot>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
           <td class="text-left" style="width: 50%;">              
19 19
             <?php
20 20
             foreach ($orderDeatilCols as $col => $label) {
21
-                echo "<b>{$label}</b> " . $cart->$col . "<br>";
21
+                echo "<b>{$label}</b> ".$cart->$col."<br>";
22 22
             }
23 23
             ?>
24 24
           </td>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             <?php
42 42
             if ($cart->infos) {
43 43
                 foreach ($cart->infos as $info) {
44
-                    echo "<b>{$info->field->name()}</b> " . $info->value . "<br>";
44
+                    echo "<b>{$info->field->name()}</b> ".$info->value."<br>";
45 45
                 }
46 46
             }
47 47
             ?>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                   if (App::$cur->money) {
126 126
                       $currency = Money\Currency::get($currency_id);
127 127
                       if ($currency) {
128
-                          echo '&nbsp;' . $currency->acronym();
128
+                          echo '&nbsp;'.$currency->acronym();
129 129
                       } else {
130 130
                           echo '&nbsp;руб.';
131 131
                       }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                   if (App::$cur->money) {
169 169
                       $currency = Money\Currency::get($currency_id);
170 170
                       if ($currency) {
171
-                          echo '&nbsp;' . $currency->acronym();
171
+                          echo '&nbsp;'.$currency->acronym();
172 172
                       } else {
173 173
                           echo '&nbsp;руб.';
174 174
                       }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     case'2':
208 208
                         $price = Ecommerce\Item\Offer\Price::get($status->info);
209 209
                         if ($price) {
210
-                            echo "<a href = '/ecommerce/view/{$item->id}'>" . $price->offer->item->name() . "</a>";
210
+                            echo "<a href = '/ecommerce/view/{$item->id}'>".$price->offer->item->name()."</a>";
211 211
                         } else {
212 212
                             echo 'Товар удален';
213 213
                         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                         $info = explode('|', $status->info);
217 217
                         $price = Ecommerce\Item\Offer\Price::get($info[0]);
218 218
                         if ($price) {
219
-                            echo "<a href = '/ecommerce/view/{$item->id}'>" . $price->offer->item->name() . "</a> " . ($info[1] > 0 ? '+' . $info[1] : $info[1]);
219
+                            echo "<a href = '/ecommerce/view/{$item->id}'>".$price->offer->item->name()."</a> ".($info[1] > 0 ? '+'.$info[1] : $info[1]);
220 220
                         } else {
221 221
                             echo 'Товар удален';
222 222
                         }
Please login to merge, or discard this patch.
system/modules/Migrations/objects/Parser/Object/Value.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,85 +13,85 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $dir = pathinfo($this->object->walker->migtarionLog->source, PATHINFO_DIRNAME);
75 75
         if ($this->model->{$this->param->value}) {
76 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)) {
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 79
           }
80 80
           if ($file && $notEq) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
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 89
       default:
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Option.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -13,63 +13,63 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
system/modules/Ecommerce/Ecommerce.php 2 patches
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     $name = '';
49 49
     foreach ($fields as $field) {
50 50
       if ($field->save && !empty($data[$field->id])) {
51
-        $name .= htmlspecialchars($data[$field->id]) . ' ';
51
+        $name .= htmlspecialchars($data[$field->id]).' ';
52 52
       }
53 53
     }
54 54
     $name = trim($name);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $name = '';
105 105
     foreach ($fields as $field) {
106 106
       if ($field->save && !empty($data[$field->id])) {
107
-        $name .= htmlspecialchars($data[$field->id]) . ' ';
107
+        $name .= htmlspecialchars($data[$field->id]).' ';
108 108
       }
109 109
     }
110 110
     $name = trim($name);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
       foreach ($options['sort'] as $col => $direction) {
190 190
         switch ($col) {
191 191
           case 'price':
192
-            $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
192
+            $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
193 193
             break;
194 194
           case 'name':
195 195
             $selectOptions['order'][] = ['name', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
       $selectOptions['where'][] = ['image_file_id', 0, '!='];
209 209
     }
210 210
 
211
-    $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = ' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'inner'];
211
+    $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index().' = '.Ecommerce\Item\Offer::colPrefix().Ecommerce\Item::index(), 'inner'];
212 212
 
213 213
     $selectOptions['join'][] = [Ecommerce\Item\Offer\Price::table(),
214
-        Ecommerce\Item\Offer::index() . ' = ' . Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer::index() .
215
-        (empty($this->config['show_zero_price']) ? ' and ' . Ecommerce\Item\Offer\Price::colPrefix() . 'price>0' : ''),
214
+        Ecommerce\Item\Offer::index().' = '.Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer::index().
215
+        (empty($this->config['show_zero_price']) ? ' and '.Ecommerce\Item\Offer\Price::colPrefix().'price>0' : ''),
216 216
         empty($this->config['show_without_price']) ? 'inner' : 'left'];
217 217
 
218 218
     $selectOptions['join'][] = [
219
-        Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer\Price\Type::index() . ' = ' . Ecommerce\Item\Offer\Price\Type::index()
219
+        Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer\Price\Type::index().' = '.Ecommerce\Item\Offer\Price\Type::index()
220 220
     ];
221 221
 
222 222
     $selectOptions['where'][] = [
223 223
         [Ecommerce\Item\Offer\Price\Type::index(), NULL, 'is'],
224 224
         [
225
-            [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '', '=', 'OR'],
226
-            [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '%|' . \Users\User::$cur->role_id . '|%', 'LIKE', 'OR'],
225
+            [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '', '=', 'OR'],
226
+            [Ecommerce\Item\Offer\Price\Type::colPrefix().'roles', '%|'.\Users\User::$cur->role_id.'|%', 'LIKE', 'OR'],
227 227
         ],
228 228
     ];
229 229
 
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
     if (!empty($this->config['view_filter'])) {
232 232
       if (!empty($this->config['view_filter']['options'])) {
233 233
         foreach ($this->config['view_filter']['options'] as $optionId => $optionValue) {
234
-          $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
235
-              'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
236
-              'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"',
237
-              'inner', 'option' . $optionId];
234
+          $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '.
235
+              'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '.
236
+              'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = "'.(int) $optionValue.'"',
237
+              'inner', 'option'.$optionId];
238 238
         }
239 239
       }
240 240
     }
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
         switch ($col) {
245 245
           case 'price':
246 246
             if (!empty($filter['min'])) {
247
-              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>='];
247
+              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['min'], '>='];
248 248
             }
249 249
             if (!empty($filter['max'])) {
250
-              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<='];
250
+              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['max'], '<='];
251 251
             }
252 252
             break;
253 253
           case 'options':
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
                 foreach ($optionValue as $val) {
259 259
                   $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
260 260
                 }
261
-                $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
261
+                $qstr = 'IN ('.implode(',', $optionValueArr).')';
262 262
               } else {
263
-                $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
263
+                $qstr = '= '.\App::$cur->db->connection->pdo->quote($optionValue);
264 264
               }
265
-              $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
266
-                  'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
267
-                  'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value ' . $qstr . '',
268
-                  'inner', 'option' . $optionId];
265
+              $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '.
266
+                  'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '.
267
+                  'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value '.$qstr.'',
268
+                  'inner', 'option'.$optionId];
269 269
             }
270 270
             break;
271 271
           case 'offerOptions':
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
                 foreach ($optionValue as $val) {
278 278
                   $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
279 279
                 }
280
-                $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
280
+                $qstr = 'IN ('.implode(',', $optionValueArr).')';
281 281
               } else {
282
-                $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
282
+                $qstr = '= '.\App::$cur->db->connection->pdo->quote($optionValue);
283 283
               }
284
-              $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' .
285
-                  'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' .
286
-                  'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value ' . $qstr,
287
-                  'inner', 'offerOption' . $optionId];
284
+              $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index().' = '.'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer::index().' AND '.
285
+                  'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().Ecommerce\Item\Offer\Option::index().' = "'.(int) $optionId.'" AND '.
286
+                  'offerOption'.$optionId.'.'.Ecommerce\Item\Offer\Param::colPrefix().'value '.$qstr,
287
+                  'inner', 'offerOption'.$optionId];
288 288
             }
289 289
             break;
290 290
         }
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
           continue;
300 300
         }
301 301
         $category = \Ecommerce\Category::get($categoryId);
302
-        $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR'];
302
+        $where[] = ['tree_path', $category->tree_path.(int) $categoryId.'/%', 'LIKE', $first ? 'AND' : 'OR'];
303 303
         $first = false;
304 304
       }
305 305
       $selectOptions['where'][] = $where;
306 306
     } elseif (!empty($options['parent'])) {
307 307
       $category = \Ecommerce\Category::get($options['parent']);
308
-      $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE'];
308
+      $selectOptions['where'][] = ['tree_path', $category->tree_path.(int) $options['parent'].'/%', 'LIKE'];
309 309
     }
310 310
 
311 311
     //search
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
       foreach (explode(' ', $searchStr) as $part) {
316 316
         $part = trim($part);
317 317
         if ($part && strlen($part) > 2) {
318
-          $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE'];
318
+          $searchArr[] = ['search_index', '%'.$part.'%', 'LIKE'];
319 319
         }
320 320
       }
321 321
       if (!empty($searchArr)) {
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
       }
335 335
       $selectOptions['where'][] = [
336 336
           '(
337
-          (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count`),0) 
338
-            FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Item\Offer\Warehouse::table() . ' iciw 
339
-            WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . '
340
-                ' . ($warehouseIds ? ' AND iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index() . ' IN(' . implode(',', $warehouseIds) . ')' : '') . '
337
+          (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix().'count`),0) 
338
+            FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Item\Offer\Warehouse::table().' iciw 
339
+            WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().'
340
+                ' . ($warehouseIds ? ' AND iciw.'.\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index().' IN('.implode(',', $warehouseIds).')' : '').'
341 341
             )
342 342
           -
343
-          (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0)
344
-            FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Warehouse\Block::table() . ' iewb
345
-            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 (
346
-                (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) ||
347
-                (`' . \Ecommerce\Cart::colPrefix() . \Ecommerce\Cart\Status::index() . '` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
343
+          (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix().'count) ,0)
344
+            FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Warehouse\Block::table().' iewb
345
+            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 (
346
+                (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) ||
347
+                (`' . \Ecommerce\Cart::colPrefix().\Ecommerce\Cart\Status::index().'` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
348 348
             )
349
-            WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ')
349
+            WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().')
350 350
           )',
351 351
           0,
352 352
           '>'
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     $items = Ecommerce\Item::getList($selectOptions);
375 375
     $items = Ecommerce\Item\Param::getList([
376 376
                 'where' => ['item_id', array_keys($items), 'IN'],
377
-                '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']],
377
+                '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']],
378 378
                 'distinct' => \Ecommerce\Item\Option::index()
379 379
     ]);
380 380
     return $items;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     if (is_array($counts)) {
406 406
       $sum = 0;
407 407
       foreach ($counts as $count) {
408
-        $sum +=$count['count'];
408
+        $sum += $count['count'];
409 409
       }
410 410
       return $sum;
411 411
     }
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
     if (!empty($conf['files']['aditionTemplateFiels'])) {
441 441
       foreach ($conf['files']['aditionTemplateFiels'] as $file) {
442
-        $return[$file['file']] = '- ' . $file['name'];
442
+        $return[$file['file']] = '- '.$file['name'];
443 443
       }
444 444
     }
445 445
     return $return;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
       $map[] = [
514 514
           'name' => $item->name,
515 515
           'url' => [
516
-              'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref())
516
+              'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.INJI_DOMAIN_NAME.($item->getHref())
517 517
           ],
518 518
       ];
519 519
     }
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $map[] = [
527 527
             'name' => $item->name,
528 528
             'url' => [
529
-                'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref())
529
+                'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.INJI_DOMAIN_NAME.($item->getHref())
530 530
             ],
531 531
         ];
532 532
       }
Please login to merge, or discard this patch.
Indentation   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -10,172 +10,172 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Ecommerce extends Module {
12 12
 
13
-  public function init() {
13
+    public function init() {
14 14
     App::$primary->view->customAsset('js', '/moduleAsset/Ecommerce/js/cart.js');
15
-  }
15
+    }
16 16
 
17
-  public function getPayTypeHandlers($forSelect = false) {
17
+    public function getPayTypeHandlers($forSelect = false) {
18 18
     if (!$forSelect) {
19
-      return $this->getSnippets('payTypeHandler');
19
+        return $this->getSnippets('payTypeHandler');
20 20
     }
21 21
     $handlers = ['' => 'Не выбрано'];
22 22
     foreach ($this->getSnippets('payTypeHandler') as $key => $handler) {
23
-      if (empty($handler)) {
23
+        if (empty($handler)) {
24 24
         continue;
25
-      }
26
-      $handlers[$key] = $handler['name'];
25
+        }
26
+        $handlers[$key] = $handler['name'];
27 27
     }
28 28
     return $handlers;
29
-  }
29
+    }
30 30
 
31
-  public function cartPayRecive($data) {
31
+    public function cartPayRecive($data) {
32 32
     $cart = Ecommerce\Cart::get($data['pay']->data);
33 33
     if ($cart) {
34
-      $payed = true;
35
-      foreach ($cart->pays as $pay) {
34
+        $payed = true;
35
+        foreach ($cart->pays as $pay) {
36 36
         if ($pay->pay_status_id != 2) {
37
-          $payed = false;
38
-          break;
37
+            $payed = false;
38
+            break;
39 39
         }
40
-      }
41
-      $cart->payed = $payed;
42
-      $cart->save();
40
+        }
41
+        $cart->payed = $payed;
42
+        $cart->save();
43
+    }
43 44
     }
44
-  }
45 45
 
46
-  public function parseFields($data, $cart) {
46
+    public function parseFields($data, $cart) {
47 47
     $fields = \Ecommerce\UserAdds\Field::getList();
48 48
     $name = '';
49 49
     foreach ($fields as $field) {
50
-      if ($field->save && !empty($data[$field->id])) {
50
+        if ($field->save && !empty($data[$field->id])) {
51 51
         $name .= htmlspecialchars($data[$field->id]) . ' ';
52
-      }
52
+        }
53 53
     }
54 54
     $name = trim($name);
55 55
 
56 56
     $userAdds = Ecommerce\UserAdds::get([['user_id', $cart->user->id], ['name', $name]]);
57 57
     if (!$userAdds) {
58
-      $userAdds = new Ecommerce\UserAdds();
59
-      $userAdds->user_id = $cart->user->id;
60
-      $userAdds->name = $name;
61
-      $userAdds->save();
62
-      foreach ($fields as $field) {
58
+        $userAdds = new Ecommerce\UserAdds();
59
+        $userAdds->user_id = $cart->user->id;
60
+        $userAdds->name = $name;
61
+        $userAdds->save();
62
+        foreach ($fields as $field) {
63 63
         if (!$field->save) {
64
-          continue;
64
+            continue;
65 65
         }
66 66
         $userAddsValue = new Ecommerce\UserAdds\Value();
67 67
         $userAddsValue->value = htmlspecialchars($data[$field->id]);
68 68
         $userAddsValue->useradds_field_id = $field->id;
69 69
         $userAddsValue->useradds_id = $userAdds->id;
70 70
         $userAddsValue->save();
71
-      }
71
+        }
72 72
     }
73 73
     $user = \Users\User::get($cart->user_id);
74 74
     foreach ($fields as $field) {
75
-      $info = new \Ecommerce\Cart\Info();
76
-      $info->name = $field->name;
77
-      $info->value = htmlspecialchars($data[$field->id]);
78
-      $info->useradds_field_id = $field->id;
79
-      $info->cart_id = $cart->id;
80
-      $info->save();
81
-      $relations = [];
82
-      if ($field->userfield) {
75
+        $info = new \Ecommerce\Cart\Info();
76
+        $info->name = $field->name;
77
+        $info->value = htmlspecialchars($data[$field->id]);
78
+        $info->useradds_field_id = $field->id;
79
+        $info->cart_id = $cart->id;
80
+        $info->save();
81
+        $relations = [];
82
+        if ($field->userfield) {
83 83
         if (strpos($field->userfield, ':')) {
84
-          $path = explode(':', $field->userfield);
85
-          if (!$user->{$path[0]}->{$path[1]}) {
84
+            $path = explode(':', $field->userfield);
85
+            if (!$user->{$path[0]}->{$path[1]}) {
86 86
             $user->{$path[0]}->{$path[1]} = $info->value;
87 87
             $relations[$path[0]] = $path[0];
88
-          }
88
+            }
89 89
         } else {
90
-          if (!$user->{$field->userfield}) {
90
+            if (!$user->{$field->userfield}) {
91 91
             $user->{$field->userfield} = $info->value;
92
-          }
92
+            }
93 93
         }
94
-      }
95
-      foreach ($relations as $rel) {
94
+        }
95
+        foreach ($relations as $rel) {
96 96
         $user->$rel->save();
97
-      }
98
-      $user->save();
97
+        }
98
+        $user->save();
99 99
     }
100 100
     return $userAdds;
101
-  }
101
+    }
102 102
 
103
-  public function parseDeliveryFields($data, $cart, $fields) {
103
+    public function parseDeliveryFields($data, $cart, $fields) {
104 104
     $name = '';
105 105
     foreach ($fields as $field) {
106
-      if ($field->save && !empty($data[$field->id])) {
106
+        if ($field->save && !empty($data[$field->id])) {
107 107
         $name .= htmlspecialchars($data[$field->id]) . ' ';
108
-      }
108
+        }
109 109
     }
110 110
     $name = trim($name);
111 111
 
112 112
     $save = Ecommerce\Delivery\Save::get([['user_id', $cart->user->id], ['name', $name]]);
113 113
     if (!$save) {
114
-      $save = new Ecommerce\Delivery\Save();
115
-      $save->user_id = $cart->user->id;
116
-      $save->name = $name;
117
-      $save->save();
118
-      foreach ($fields as $field) {
114
+        $save = new Ecommerce\Delivery\Save();
115
+        $save->user_id = $cart->user->id;
116
+        $save->name = $name;
117
+        $save->save();
118
+        foreach ($fields as $field) {
119 119
         if (!$field->save) {
120
-          continue;
120
+            continue;
121 121
         }
122 122
         $saveValue = new Ecommerce\Delivery\Value();
123 123
         $saveValue->value = htmlspecialchars($data[$field->id]);
124 124
         $saveValue->delivery_field_id = $field->id;
125 125
         $saveValue->delivery_save_id = $save->id;
126 126
         $saveValue->save();
127
-      }
127
+        }
128 128
     }
129 129
     $user = \Users\User::get($cart->user_id);
130 130
     foreach ($fields as $field) {
131
-      $info = new \Ecommerce\Cart\DeliveryInfo();
132
-      $info->name = $field->name;
133
-      $info->value = htmlspecialchars($data[$field->id]);
134
-      $info->delivery_field_id = $field->id;
135
-      $info->cart_id = $cart->id;
136
-      $info->save();
137
-      $relations = [];
138
-      if ($field->userfield) {
131
+        $info = new \Ecommerce\Cart\DeliveryInfo();
132
+        $info->name = $field->name;
133
+        $info->value = htmlspecialchars($data[$field->id]);
134
+        $info->delivery_field_id = $field->id;
135
+        $info->cart_id = $cart->id;
136
+        $info->save();
137
+        $relations = [];
138
+        if ($field->userfield) {
139 139
         if (strpos($field->userfield, ':')) {
140
-          $path = explode(':', $field->userfield);
141
-          if (!$user->{$path[0]}->{$path[1]}) {
140
+            $path = explode(':', $field->userfield);
141
+            if (!$user->{$path[0]}->{$path[1]}) {
142 142
             $user->{$path[0]}->{$path[1]} = $info->value;
143 143
             $relations[$path[0]] = $path[0];
144
-          }
144
+            }
145 145
         } else {
146
-          if (!$user->{$field->userfield}) {
146
+            if (!$user->{$field->userfield}) {
147 147
             $user->{$field->userfield} = $info->value;
148
-          }
148
+            }
149 149
         }
150
-      }
151
-      foreach ($relations as $rel) {
150
+        }
151
+        foreach ($relations as $rel) {
152 152
         $user->$rel->save();
153
-      }
154
-      $user->save();
153
+        }
154
+        $user->save();
155 155
     }
156 156
     return $save;
157
-  }
157
+    }
158 158
 
159
-  public function getCurCart($create = true) {
159
+    public function getCurCart($create = true) {
160 160
     $cart = false;
161 161
     if (!empty($_SESSION['cart']['cart_id'])) {
162
-      $cart = Ecommerce\Cart::get((int) $_SESSION['cart']['cart_id']);
162
+        $cart = Ecommerce\Cart::get((int) $_SESSION['cart']['cart_id']);
163 163
     }
164 164
     if (!$cart && $create) {
165
-      $cart = new Ecommerce\Cart();
166
-      $cart->cart_status_id = 1;
167
-      $cart->user_id = Users\User::$cur->id;
168
-      $userCard = \Ecommerce\Card\Item::get(\Users\User::$cur->id, 'user_id');
169
-      if ($userCard) {
165
+        $cart = new Ecommerce\Cart();
166
+        $cart->cart_status_id = 1;
167
+        $cart->user_id = Users\User::$cur->id;
168
+        $userCard = \Ecommerce\Card\Item::get(\Users\User::$cur->id, 'user_id');
169
+        if ($userCard) {
170 170
         $cart->card_item_id = $userCard->id;
171
-      }
172
-      $cart->save();
173
-      $_SESSION['cart']['cart_id'] = $cart->id;
171
+        }
172
+        $cart->save();
173
+        $_SESSION['cart']['cart_id'] = $cart->id;
174 174
     }
175 175
     return $cart;
176
-  }
176
+    }
177 177
 
178
-  public function parseOptions($options = []) {
178
+    public function parseOptions($options = []) {
179 179
     $selectOptions = [
180 180
         'where' => !empty($options['where']) ? $options['where'] : [],
181 181
         'distinct' => false,
@@ -186,29 +186,29 @@  discard block
 block discarded – undo
186 186
         'limit' => !empty($options['count']) ? (int) $options['count'] : 0,
187 187
     ];
188 188
     if (!empty($options['sort']) && is_array($options['sort'])) {
189
-      foreach ($options['sort'] as $col => $direction) {
189
+        foreach ($options['sort'] as $col => $direction) {
190 190
         switch ($col) {
191
-          case 'price':
191
+            case 'price':
192 192
             $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
193 193
             break;
194
-          case 'name':
194
+            case 'name':
195 195
             $selectOptions['order'][] = ['name', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
196 196
             break;
197
-          case 'sales':
197
+            case 'sales':
198 198
             $selectOptions['order'][] = ['sales', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
199 199
             break;
200
-          case 'weight':
200
+            case 'weight':
201 201
             $selectOptions['order'][] = ['weight', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
202 202
             break;
203
-          case 'new':
203
+            case 'new':
204 204
             $selectOptions['order'][] = ['date_create', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
205 205
             break;
206 206
         }
207
-      }
207
+        }
208 208
     }
209 209
     $selectOptions['where'][] = ['deleted', 0];
210 210
     if (empty($this->config['view_empty_image'])) {
211
-      $selectOptions['where'][] = ['image_file_id', 0, '!='];
211
+        $selectOptions['where'][] = ['image_file_id', 0, '!='];
212 212
     }
213 213
 
214 214
     $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = ' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'inner'];
@@ -232,111 +232,111 @@  discard block
 block discarded – undo
232 232
 
233 233
 
234 234
     if (!empty($this->config['view_filter'])) {
235
-      if (!empty($this->config['view_filter']['options'])) {
235
+        if (!empty($this->config['view_filter']['options'])) {
236 236
         foreach ($this->config['view_filter']['options'] as $optionId => $optionValue) {
237
-          $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
238
-              'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
239
-              'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"',
240
-              'inner', 'option' . $optionId];
237
+            $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
238
+                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
239
+                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"',
240
+                'inner', 'option' . $optionId];
241
+        }
241 242
         }
242
-      }
243 243
     }
244 244
     //filters
245 245
     if (!empty($options['filters'])) {
246
-      foreach ($options['filters'] as $col => $filter) {
246
+        foreach ($options['filters'] as $col => $filter) {
247 247
         switch ($col) {
248
-          case 'price':
248
+            case 'price':
249 249
             if (!empty($filter['min'])) {
250
-              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>='];
250
+                $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>='];
251 251
             }
252 252
             if (!empty($filter['max'])) {
253
-              $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<='];
253
+                $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<='];
254 254
             }
255 255
             break;
256
-          case 'options':
256
+            case 'options':
257 257
             foreach ($filter as $optionId => $optionValue) {
258
-              $optionId = (int) $optionId;
259
-              if (is_array($optionValue)) {
258
+                $optionId = (int) $optionId;
259
+                if (is_array($optionValue)) {
260 260
                 $optionValueArr = [];
261 261
                 foreach ($optionValue as $val) {
262
-                  $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
262
+                    $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
263 263
                 }
264 264
                 $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
265
-              } else {
265
+                } else {
266 266
                 $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
267
-              }
268
-              $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
269
-                  'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
270
-                  'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value ' . $qstr . '',
271
-                  'inner', 'option' . $optionId];
267
+                }
268
+                $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
269
+                    'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
270
+                    'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value ' . $qstr . '',
271
+                    'inner', 'option' . $optionId];
272 272
             }
273 273
             break;
274
-          case 'offerOptions':
274
+            case 'offerOptions':
275 275
             //$selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = offer.' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'left', 'offer'];
276 276
             foreach ($filter as $optionId => $optionValue) {
277
-              $optionId = (int) $optionId;
278
-              if (is_array($optionValue)) {
277
+                $optionId = (int) $optionId;
278
+                if (is_array($optionValue)) {
279 279
                 $optionValueArr = [];
280 280
                 foreach ($optionValue as $val) {
281
-                  $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
281
+                    $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
282 282
                 }
283 283
                 $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
284
-              } else {
284
+                } else {
285 285
                 $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
286
-              }
287
-              $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' .
288
-                  'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' .
289
-                  'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value ' . $qstr,
290
-                  'inner', 'offerOption' . $optionId];
286
+                }
287
+                $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' .
288
+                    'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' .
289
+                    'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value ' . $qstr,
290
+                    'inner', 'offerOption' . $optionId];
291 291
             }
292 292
             break;
293 293
         }
294
-      }
294
+        }
295 295
     }
296 296
     //parents
297 297
     if (!empty($options['parent']) && strpos($options['parent'], ',') !== false) {
298
-      $first = true;
299
-      $where = [];
300
-      foreach (explode(',', $options['parent']) as $categoryId) {
298
+        $first = true;
299
+        $where = [];
300
+        foreach (explode(',', $options['parent']) as $categoryId) {
301 301
         if (!$categoryId) {
302
-          continue;
302
+            continue;
303 303
         }
304 304
         $category = \Ecommerce\Category::get($categoryId);
305 305
         $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR'];
306 306
         $first = false;
307
-      }
308
-      $selectOptions['where'][] = $where;
307
+        }
308
+        $selectOptions['where'][] = $where;
309 309
     } elseif (!empty($options['parent'])) {
310
-      $category = \Ecommerce\Category::get($options['parent']);
311
-      $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE'];
310
+        $category = \Ecommerce\Category::get($options['parent']);
311
+        $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE'];
312 312
     }
313 313
 
314 314
     //search
315 315
     if (!empty($options['search'])) {
316
-      $searchStr = preg_replace('![^A-zА-я0-9 ]!iSu', ' ', $options['search']);
317
-      $searchArr = [];
318
-      foreach (explode(' ', $searchStr) as $part) {
316
+        $searchStr = preg_replace('![^A-zА-я0-9 ]!iSu', ' ', $options['search']);
317
+        $searchArr = [];
318
+        foreach (explode(' ', $searchStr) as $part) {
319 319
         $part = trim($part);
320 320
         if ($part && strlen($part) > 2) {
321
-          $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE'];
321
+            $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE'];
322
+        }
322 323
         }
323
-      }
324
-      if (!empty($searchArr)) {
324
+        if (!empty($searchArr)) {
325 325
         $selectOptions['where'][] = $searchArr;
326
-      }
326
+        }
327 327
     }
328 328
     if (empty($this->config['view_empty_warehouse'])) {
329
-      $warehouseIds = [];
330
-      if (App::$cur->geography && \Geography\City::$cur) {
329
+        $warehouseIds = [];
330
+        if (App::$cur->geography && \Geography\City::$cur) {
331 331
         $warehouses = \Geography\City\Data::get([['code', 'warehouses'], ['city_id', \Geography\City::$cur->id]]);
332 332
         if ($warehouses && $warehouses->data) {
333
-          foreach (explode(',', $warehouses->data) as $id) {
333
+            foreach (explode(',', $warehouses->data) as $id) {
334 334
             $warehouseIds[$id] = $id;
335
-          }
335
+            }
336
+        }
336 337
         }
337
-      }
338
-      $selectOptions['where'][] = [
339
-          '(
338
+        $selectOptions['where'][] = [
339
+            '(
340 340
           (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count`),0) 
341 341
             FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Item\Offer\Warehouse::table() . ' iciw 
342 342
             WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . '
@@ -351,28 +351,28 @@  discard block
 block discarded – undo
351 351
             )
352 352
             WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ')
353 353
           )',
354
-          0,
355
-          '>'
356
-      ];
354
+            0,
355
+            '>'
356
+        ];
357 357
     }
358 358
 
359 359
     $selectOptions['group'] = Ecommerce\Item::index();
360 360
 
361 361
     return $selectOptions;
362
-  }
363
-
364
-  /**
365
-   * Getting items params with params
366
-   * 
367
-   * @param array $params
368
-   * @return array
369
-   */
370
-  public function getItemsParams($params = []) {
362
+    }
363
+
364
+    /**
365
+     * Getting items params with params
366
+     * 
367
+     * @param array $params
368
+     * @return array
369
+     */
370
+    public function getItemsParams($params = []) {
371 371
     $selectOptions = $this->parseOptions($params);
372 372
 
373 373
     $items = Ecommerce\Item::getList($selectOptions);
374 374
     if (!$items) {
375
-      return [];
375
+        return [];
376 376
     }
377 377
     $items = Ecommerce\Item\Param::getList([
378 378
                 'where' => ['item_id', array_keys($items), 'IN'],
@@ -380,58 +380,58 @@  discard block
 block discarded – undo
380 380
                 'distinct' => \Ecommerce\Item\Option::index()
381 381
     ]);
382 382
     return $items;
383
-  }
384
-
385
-  /**
386
-   * Getting items with params
387
-   * 
388
-   * @param array $params
389
-   * @return array
390
-   */
391
-  public function getItems($params = []) {
383
+    }
384
+
385
+    /**
386
+     * Getting items with params
387
+     * 
388
+     * @param array $params
389
+     * @return array
390
+     */
391
+    public function getItems($params = []) {
392 392
     $selectOptions = $this->parseOptions($params);
393 393
     $items = Ecommerce\Item::getList($selectOptions);
394 394
     return $items;
395
-  }
396
-
397
-  /**
398
-   * Return count of items with params
399
-   * 
400
-   * @param array $params
401
-   * @return int
402
-   */
403
-  public function getItemsCount($params = []) {
395
+    }
396
+
397
+    /**
398
+     * Return count of items with params
399
+     * 
400
+     * @param array $params
401
+     * @return int
402
+     */
403
+    public function getItemsCount($params = []) {
404 404
     $selectOptions = $this->parseOptions($params);
405 405
     $selectOptions['distinct'] = \Ecommerce\Item::index();
406 406
     $counts = Ecommerce\Item::getCount($selectOptions);
407 407
     if (is_array($counts)) {
408
-      $sum = 0;
409
-      foreach ($counts as $count) {
408
+        $sum = 0;
409
+        foreach ($counts as $count) {
410 410
         $sum +=$count['count'];
411
-      }
412
-      return $sum;
411
+        }
412
+        return $sum;
413 413
     }
414 414
     return $counts;
415
-  }
415
+    }
416 416
 
417
-  public function viewsCategoryList($inherit = true) {
417
+    public function viewsCategoryList($inherit = true) {
418 418
     $return = [];
419 419
     if ($inherit) {
420
-      $return['inherit'] = 'Как у родителя';
420
+        $return['inherit'] = 'Как у родителя';
421 421
     }
422 422
     $return['itemList'] = 'Список товаров';
423 423
     $conf = App::$primary->view->template->config;
424 424
     if (!empty($conf['files']['modules']['Ecommerce'])) {
425
-      foreach ($conf['files']['modules']['Ecommerce'] as $file) {
425
+        foreach ($conf['files']['modules']['Ecommerce'] as $file) {
426 426
         if ($file['type'] == 'Category') {
427
-          $return[$file['file']] = $file['name'];
427
+            $return[$file['file']] = $file['name'];
428
+        }
428 429
         }
429
-      }
430 430
     }
431 431
     return $return;
432
-  }
432
+    }
433 433
 
434
-  public function templatesCategoryList() {
434
+    public function templatesCategoryList() {
435 435
     $return = [
436 436
         'inherit' => 'Как у родителя',
437 437
         'current' => 'Текущая тема'
@@ -440,107 +440,107 @@  discard block
 block discarded – undo
440 440
     $conf = App::$primary->view->template->config;
441 441
 
442 442
     if (!empty($conf['files']['aditionTemplateFiels'])) {
443
-      foreach ($conf['files']['aditionTemplateFiels'] as $file) {
443
+        foreach ($conf['files']['aditionTemplateFiels'] as $file) {
444 444
         $return[$file['file']] = '- ' . $file['name'];
445
-      }
445
+        }
446 446
     }
447 447
     return $return;
448
-  }
448
+    }
449 449
 
450
-  public function cartStatusDetector($event) {
450
+    public function cartStatusDetector($event) {
451 451
     $cart = $event['eventObject'];
452 452
     if (!empty($cart->_changedParams['cart_cart_status_id'])) {
453
-      $cart->date_status = date('Y-m-d H:i:s');
454
-      $event = new Ecommerce\Cart\Event(['cart_id' => $cart->id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 5, 'info' => $cart->cart_status_id]);
455
-      $event->save();
453
+        $cart->date_status = date('Y-m-d H:i:s');
454
+        $event = new Ecommerce\Cart\Event(['cart_id' => $cart->id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 5, 'info' => $cart->cart_status_id]);
455
+        $event->save();
456 456
 
457
-      $prev_status_id = $cart->_changedParams['cart_cart_status_id'];
458
-      $now_status_id = $cart->cart_status_id;
457
+        $prev_status_id = $cart->_changedParams['cart_cart_status_id'];
458
+        $now_status_id = $cart->cart_status_id;
459 459
 
460
-      $status = Ecommerce\Cart\Status::getList(['where' => ['id', implode(',', [$prev_status_id, $now_status_id]), 'IN']]);
460
+        $status = Ecommerce\Cart\Status::getList(['where' => ['id', implode(',', [$prev_status_id, $now_status_id]), 'IN']]);
461 461
 
462
-      $prefix = isset(App::$cur->ecommerce->config['orderPrefix']) ? $config = App::$cur->ecommerce->config['orderPrefix'] : '';
463
-      \App::$cur->users->AddUserActivity($cart->user_id, 3, "Статус вашего заказа номер {$prefix}{$cart->id} изменился с {$status[$prev_status_id]->name} на {$status[$now_status_id]->name}");
462
+        $prefix = isset(App::$cur->ecommerce->config['orderPrefix']) ? $config = App::$cur->ecommerce->config['orderPrefix'] : '';
463
+        \App::$cur->users->AddUserActivity($cart->user_id, 3, "Статус вашего заказа номер {$prefix}{$cart->id} изменился с {$status[$prev_status_id]->name} на {$status[$now_status_id]->name}");
464 464
 
465
-      if ($cart->cart_status_id == 5) {
465
+        if ($cart->cart_status_id == 5) {
466 466
         Inji::$inst->event('ecommerceCartClosed', $cart);
467
-      }
467
+        }
468 468
     }
469 469
     return $cart;
470
-  }
470
+    }
471 471
 
472
-  public function cardTrigger($event) {
472
+    public function cardTrigger($event) {
473 473
     $cart = $event['eventObject'];
474 474
     if ($cart->card) {
475
-      $sum = 0;
476
-      foreach ($cart->cartItems as $cartItem) {
475
+        $sum = 0;
476
+        foreach ($cart->cartItems as $cartItem) {
477 477
         $sum += $cartItem->final_price * $cartItem->count;
478
-      }
479
-      $cardItemHistory = new Ecommerce\Card\Item\History();
480
-      $cardItemHistory->amount = $sum;
481
-      $cardItemHistory->card_item_id = $cart->card_item_id;
482
-      $cardItemHistory->save();
483
-      $cart->card->sum += $sum;
484
-      $cart->card->save();
478
+        }
479
+        $cardItemHistory = new Ecommerce\Card\Item\History();
480
+        $cardItemHistory->amount = $sum;
481
+        $cardItemHistory->card_item_id = $cart->card_item_id;
482
+        $cardItemHistory->save();
483
+        $cart->card->sum += $sum;
484
+        $cart->card->save();
485 485
     }
486 486
     return $cart;
487
-  }
487
+    }
488 488
 
489
-  public function bonusTrigger($event) {
489
+    public function bonusTrigger($event) {
490 490
     $cart = $event['eventObject'];
491 491
     foreach ($cart->cartItems as $cartItem) {
492
-      foreach ($cartItem->price->offer->bonuses as $bonus) {
492
+        foreach ($cartItem->price->offer->bonuses as $bonus) {
493 493
         if ($bonus->limited && $bonus->left <= 0) {
494
-          continue;
494
+            continue;
495 495
         } elseif ($bonus->limited && $bonus->left > 0) {
496
-          $bonus->left -= 1;
497
-          $bonus->save();
496
+            $bonus->left -= 1;
497
+            $bonus->save();
498 498
         }
499 499
         switch ($bonus->type) {
500
-          case'currency':
500
+            case'currency':
501 501
             $currency = \Money\Currency::get($bonus->value);
502 502
             $wallets = App::$cur->money->getUserWallets($cart->user->id);
503 503
             $wallets[$currency->id]->diff($bonus->count, 'Бонус за покупку');
504 504
             break;
505 505
         }
506
-      }
506
+        }
507 507
     }
508 508
     return $cart;
509
-  }
509
+    }
510 510
 
511
-  function sitemap() {
511
+    function sitemap() {
512 512
     $map = [];
513 513
     $zeroItems = \Ecommerce\Item::getList(['where' => ['category_id', 0]]);
514 514
     foreach ($zeroItems as $item) {
515
-      $map[] = [
516
-          'name' => $item->name,
517
-          'url' => [
518
-              'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref())
519
-          ],
520
-      ];
515
+        $map[] = [
516
+            'name' => $item->name,
517
+            'url' => [
518
+                'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref())
519
+            ],
520
+        ];
521 521
     }
522 522
 
523 523
     $categorys = \Ecommerce\Category::getList(['where' => ['parent_id', 0]]);
524 524
     $scan = function($category, $scan) {
525
-      $map = [];
525
+        $map = [];
526 526
 
527
-      foreach ($category->items as $item) {
527
+        foreach ($category->items as $item) {
528 528
         $map[] = [
529 529
             'name' => $item->name,
530 530
             'url' => [
531 531
                 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref())
532 532
             ],
533 533
         ];
534
-      }
535
-      foreach ($category->catalogs as $child) {
534
+        }
535
+        foreach ($category->catalogs as $child) {
536 536
         $map = array_merge($map, $scan($child, $scan));
537
-      }
538
-      return $map;
537
+        }
538
+        return $map;
539 539
     };
540 540
     foreach ($categorys as $category) {
541
-      $map = array_merge($map, $scan($category, $scan));
541
+        $map = array_merge($map, $scan($category, $scan));
542 542
     }
543 543
     return $map;
544
-  }
544
+    }
545 545
 
546 546
 }
Please login to merge, or discard this patch.
system/modules/Ui/widgets/DataManager/DataManager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
     'id' => $dataManager->managerId,
4 4
     'class' => 'dataManager',
5 5
     'data-params' => $params,
6
-    'data-modelname' => ($model ? get_class($model) : $dataManager->modelName) . ($model && $model->pk() ? ':' . $model->pk() : ''),
6
+    'data-modelname' => ($model ? get_class($model) : $dataManager->modelName).($model && $model->pk() ? ':'.$model->pk() : ''),
7 7
     'data-managername' => $dataManager->managerName,
8 8
     'data-cols' => $dataManager->cols,
9 9
     'data-options' => array_merge($dataManager->managerOptions, ['actions'=>$dataManager->getActions()])
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     'style' => ''
23 23
 ];
24 24
 if (!empty($dataManager->managerOptions['categorys'])) {
25
-  $mainCol['style'].='margin-left:260px;';
25
+  $mainCol['style'] .= 'margin-left:260px;';
26 26
   echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">';
27 27
   $this->widget('Ui\DataManager/categorys', compact('dataManager'));
28 28
   echo '</div>';
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
         ], '', true);
11 11
 $buttons = $dataManager->getButtons($params, $model);
12 12
 if ($buttons) {
13
-  ?>
13
+    ?>
14 14
   <h3 class="dataManager-title"><?= $dataManager->name; ?> 
15 15
     <div class ='pull-right dataManager-managerButtons'>
16 16
       <div class="btn-group">
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
     'style' => ''
27 27
 ];
28 28
 if (!empty($dataManager->managerOptions['categorys'])) {
29
-  $mainCol['style'].='margin-left:260px;';
30
-  echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">';
31
-  $this->widget('Ui\DataManager/categorys', compact('dataManager'));
32
-  echo '</div>';
29
+    $mainCol['style'].='margin-left:260px;';
30
+    echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">';
31
+    $this->widget('Ui\DataManager/categorys', compact('dataManager'));
32
+    echo '</div>';
33 33
 }
34 34
 if (!empty($dataManager->managerOptions['filters'])) {
35
-  ?>
35
+    ?>
36 36
   <div class="modal fade" id = "<?= $dataManager->managerId; ?>_filters" >
37 37
     <div class="modal-dialog modal-lg">
38 38
       <div class="modal-content">
Please login to merge, or discard this patch.