1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* Divine CMS - Open source CMS for widespread use. |
4
|
|
|
Copyright (c) 2019 Mykola Burakov ([email protected]) |
5
|
|
|
|
6
|
|
|
See SOURCE.txt for other and additional information. |
7
|
|
|
|
8
|
|
|
This file is part of Divine CMS. |
9
|
|
|
|
10
|
|
|
This program is free software: you can redistribute it and/or modify |
11
|
|
|
it under the terms of the GNU General Public License as published by |
12
|
|
|
the Free Software Foundation, either version 3 of the License, or |
13
|
|
|
(at your option) any later version. |
14
|
|
|
|
15
|
|
|
This program is distributed in the hope that it will be useful, |
16
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
GNU General Public License for more details. |
19
|
|
|
|
20
|
|
|
You should have received a copy of the GNU General Public License |
21
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
22
|
|
|
|
23
|
|
|
class ControllerCatalogProduct extends \Divine\Engine\Core\Controller |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
private $error = array(); |
26
|
|
|
|
27
|
|
|
public function index() |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
$this->load->language('catalog/product'); |
30
|
|
|
|
31
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
32
|
|
|
|
33
|
|
|
$this->load->model('catalog/product'); |
34
|
|
|
|
35
|
|
|
$this->getList(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function add() |
39
|
|
|
{ |
40
|
|
|
$this->load->language('catalog/product'); |
41
|
|
|
|
42
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
43
|
|
|
|
44
|
|
|
$this->load->model('catalog/product'); |
45
|
|
|
|
46
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
47
|
|
|
$this->model_catalog_product->addProduct($this->request->post); |
48
|
|
|
|
49
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
50
|
|
|
|
51
|
|
|
$url = ''; |
52
|
|
|
|
53
|
|
|
if (isset($this->request->get['filter_name'])) { |
54
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if (isset($this->request->get['filter_model'])) { |
58
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
if (isset($this->request->get['filter_price'])) { |
62
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
66
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
70
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
74
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
78
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
82
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
if (isset($this->request->get['filter_status'])) { |
86
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
if (isset($this->request->get['filter_category'])) { |
90
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
91
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
92
|
|
|
$url .= '&filter_sub_category'; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
97
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
101
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
if (isset($this->request->get['sort'])) { |
105
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
if (isset($this->request->get['order'])) { |
109
|
|
|
$url .= '&order=' . $this->request->get['order']; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
if (isset($this->request->get['page'])) { |
113
|
|
|
$url .= '&page=' . $this->request->get['page']; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
$this->getForm(); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function edit() |
123
|
|
|
{ |
124
|
|
|
$this->load->language('catalog/product'); |
125
|
|
|
|
126
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
127
|
|
|
|
128
|
|
|
$this->load->model('catalog/product'); |
129
|
|
|
|
130
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
131
|
|
|
$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post); |
132
|
|
|
|
133
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
134
|
|
|
|
135
|
|
|
$url = ''; |
136
|
|
|
|
137
|
|
|
if (isset($this->request->get['filter_name'])) { |
138
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
if (isset($this->request->get['filter_model'])) { |
142
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
if (isset($this->request->get['filter_price'])) { |
146
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
150
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
154
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
158
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
162
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
166
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
if (isset($this->request->get['filter_status'])) { |
170
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
if (isset($this->request->get['filter_category'])) { |
174
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
175
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
176
|
|
|
$url .= '&filter_sub_category'; |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
181
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
185
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
if (isset($this->request->get['sort'])) { |
189
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
if (isset($this->request->get['order'])) { |
193
|
|
|
$url .= '&order=' . $this->request->get['order']; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
if (isset($this->request->get['page'])) { |
197
|
|
|
$url .= '&page=' . $this->request->get['page']; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
$this->getForm(); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
public function delete() |
207
|
|
|
{ |
208
|
|
|
$this->load->language('catalog/product'); |
209
|
|
|
|
210
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
211
|
|
|
|
212
|
|
|
$this->load->model('catalog/product'); |
213
|
|
|
|
214
|
|
|
if (isset($this->request->post['selected']) && $this->validateDelete()) { |
215
|
|
|
foreach ($this->request->post['selected'] as $product_id) { |
216
|
|
|
$this->model_catalog_product->deleteProduct($product_id); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
220
|
|
|
|
221
|
|
|
$url = ''; |
222
|
|
|
|
223
|
|
|
if (isset($this->request->get['filter_name'])) { |
224
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
if (isset($this->request->get['filter_model'])) { |
228
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
if (isset($this->request->get['filter_price'])) { |
232
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
236
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
240
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
244
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
248
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
252
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
if (isset($this->request->get['filter_status'])) { |
256
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
if (isset($this->request->get['filter_category'])) { |
260
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
261
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
262
|
|
|
$url .= '&filter_sub_category'; |
263
|
|
|
} |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
267
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
271
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
if (isset($this->request->get['sort'])) { |
275
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
if (isset($this->request->get['order'])) { |
279
|
|
|
$url .= '&order=' . $this->request->get['order']; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
if (isset($this->request->get['page'])) { |
283
|
|
|
$url .= '&page=' . $this->request->get['page']; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
$this->getList(); |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
public function copy() |
293
|
|
|
{ |
294
|
|
|
$this->load->language('catalog/product'); |
295
|
|
|
|
296
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
297
|
|
|
|
298
|
|
|
$this->load->model('catalog/product'); |
299
|
|
|
|
300
|
|
|
if (isset($this->request->post['selected']) && $this->validateCopy()) { |
301
|
|
|
foreach ($this->request->post['selected'] as $product_id) { |
302
|
|
|
$this->model_catalog_product->copyProduct($product_id); |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
306
|
|
|
|
307
|
|
|
$url = ''; |
308
|
|
|
|
309
|
|
|
if (isset($this->request->get['filter_name'])) { |
310
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
if (isset($this->request->get['filter_model'])) { |
314
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
if (isset($this->request->get['filter_price'])) { |
318
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
322
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
326
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
330
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
334
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
338
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
if (isset($this->request->get['filter_status'])) { |
342
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
if (isset($this->request->get['filter_category'])) { |
346
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
347
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
348
|
|
|
$url .= '&filter_sub_category'; |
349
|
|
|
} |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
353
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
357
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
if (isset($this->request->get['sort'])) { |
361
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
if (isset($this->request->get['order'])) { |
365
|
|
|
$url .= '&order=' . $this->request->get['order']; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
if (isset($this->request->get['page'])) { |
369
|
|
|
$url .= '&page=' . $this->request->get['page']; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
$this->getList(); |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
protected function getList() |
379
|
|
|
{ |
380
|
|
|
if (isset($this->request->get['filter_name'])) { |
381
|
|
|
$filter_name = $this->request->get['filter_name']; |
382
|
|
|
} else { |
383
|
|
|
$filter_name = null; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
if (isset($this->request->get['filter_model'])) { |
387
|
|
|
$filter_model = $this->request->get['filter_model']; |
388
|
|
|
} else { |
389
|
|
|
$filter_model = null; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
if (isset($this->request->get['filter_price'])) { |
393
|
|
|
$filter_price = $this->request->get['filter_price']; |
394
|
|
|
} else { |
395
|
|
|
$filter_price = null; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
399
|
|
|
$filter_price_min = $this->request->get['filter_price_min']; |
400
|
|
|
} else { |
401
|
|
|
$filter_price_min = null; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
405
|
|
|
$filter_price_max = $this->request->get['filter_price_max']; |
406
|
|
|
} else { |
407
|
|
|
$filter_price_max = null; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
411
|
|
|
$filter_quantity = $this->request->get['filter_quantity']; |
412
|
|
|
} else { |
413
|
|
|
$filter_quantity = null; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
417
|
|
|
$filter_quantity_min = $this->request->get['filter_quantity_min']; |
418
|
|
|
} else { |
419
|
|
|
$filter_quantity_min = null; |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
423
|
|
|
$filter_quantity_max = $this->request->get['filter_quantity_max']; |
424
|
|
|
} else { |
425
|
|
|
$filter_quantity_max = null; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
if (isset($this->request->get['filter_status'])) { |
429
|
|
|
$filter_status = $this->request->get['filter_status']; |
430
|
|
|
} else { |
431
|
|
|
$filter_status = null; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
$filter_sub_category = null; |
435
|
|
|
if (isset($this->request->get['filter_category'])) { |
436
|
|
|
$filter_category = $this->request->get['filter_category']; |
437
|
|
|
if (!empty($filter_category) && isset($this->request->get['filter_sub_category'])) { |
438
|
|
|
$filter_sub_category = true; |
439
|
|
|
} elseif (isset($this->request->get['filter_sub_category'])) { |
440
|
|
|
unset($this->request->get['filter_sub_category']); |
441
|
|
|
} |
442
|
|
|
} else { |
443
|
|
|
$filter_category = null; |
444
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
445
|
|
|
unset($this->request->get['filter_sub_category']); |
446
|
|
|
} |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
$filter_category_name = null; |
450
|
|
|
if (isset($filter_category)) { |
451
|
|
|
if ($filter_category > 0) { |
452
|
|
|
$this->load->model('catalog/category'); |
453
|
|
|
$category = $this->model_catalog_category->getCategory($filter_category); |
454
|
|
|
if ($category) { |
455
|
|
|
$filter_category_name = ($category['path']) ? $category['path'] . ' > ' . $category['name'] : $category['name']; |
456
|
|
|
} else { |
457
|
|
|
$filter_category = null; |
458
|
|
|
unset($this->request->get['filter_category']); |
459
|
|
|
$filter_sub_category = null; |
460
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
461
|
|
|
unset($this->request->get['filter_sub_category']); |
462
|
|
|
} |
463
|
|
|
} |
464
|
|
|
} else { |
465
|
|
|
$filter_category_name = $this->language->get('text_none_category'); |
466
|
|
|
} |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
470
|
|
|
$filter_manufacturer = $this->request->get['filter_manufacturer']; |
471
|
|
|
} else { |
472
|
|
|
$filter_manufacturer = null; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
$filter_manufacturer_name = null; |
476
|
|
|
if (isset($filter_manufacturer)) { |
477
|
|
|
if ($filter_manufacturer > 0) { |
478
|
|
|
$this->load->model('catalog/manufacturer'); |
479
|
|
|
$manufacturer = $this->model_catalog_manufacturer->getManufacturer($filter_manufacturer); |
480
|
|
|
if ($manufacturer) { |
481
|
|
|
$filter_manufacturer_name = $manufacturer['name']; |
482
|
|
|
} else { |
483
|
|
|
$filter_manufacturer = null; |
484
|
|
|
unset($this->request->get['filter_manufacturer']); |
485
|
|
|
} |
486
|
|
|
} elseif ($filter_manufacturer == 0) { |
487
|
|
|
$filter_manufacturer_name = $this->language->get('text_none_manufacturer'); |
488
|
|
|
} |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
if (isset($this->request->get['filter_image'])) { |
492
|
|
|
$filter_image = $this->request->get['filter_image']; |
493
|
|
|
} else { |
494
|
|
|
$filter_image = null; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
498
|
|
|
$filter_noindex = $this->request->get['filter_noindex']; |
499
|
|
|
} else { |
500
|
|
|
$filter_noindex = null; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
if (isset($this->request->get['sort'])) { |
504
|
|
|
$sort = $this->request->get['sort']; |
505
|
|
|
} else { |
506
|
|
|
$sort = 'pd.name'; |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
if (isset($this->request->get['order'])) { |
510
|
|
|
$order = $this->request->get['order']; |
511
|
|
|
} else { |
512
|
|
|
$order = 'ASC'; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
if (isset($this->request->get['page'])) { |
516
|
|
|
$page = $this->request->get['page']; |
517
|
|
|
} else { |
518
|
|
|
$page = 1; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
$url = ''; |
522
|
|
|
|
523
|
|
|
if (isset($this->request->get['filter_name'])) { |
524
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
if (isset($this->request->get['filter_model'])) { |
528
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
if (isset($this->request->get['filter_price'])) { |
532
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
536
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
540
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
544
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
548
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
552
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
if (isset($this->request->get['filter_status'])) { |
556
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
if (isset($this->request->get['filter_category'])) { |
560
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
561
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
562
|
|
|
$url .= '&filter_sub_category'; |
563
|
|
|
} |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
567
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
if (isset($this->request->get['filter_image'])) { |
571
|
|
|
$url .= '&filter_image=' . $this->request->get['filter_image']; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
575
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
if (isset($this->request->get['sort'])) { |
579
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
if (isset($this->request->get['order'])) { |
583
|
|
|
$url .= '&order=' . $this->request->get['order']; |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
if (isset($this->request->get['page'])) { |
587
|
|
|
$url .= '&page=' . $this->request->get['page']; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
$data['breadcrumbs'] = array(); |
|
|
|
|
591
|
|
|
|
592
|
|
|
$data['breadcrumbs'][] = array( |
593
|
|
|
'text' => $this->language->get('text_home'), |
594
|
|
|
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
595
|
|
|
); |
596
|
|
|
|
597
|
|
|
$data['breadcrumbs'][] = array( |
598
|
|
|
'text' => $this->language->get('heading_title'), |
599
|
|
|
'href' => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true) |
600
|
|
|
); |
601
|
|
|
|
602
|
|
|
$data['add'] = $this->url->link('catalog/product/add', 'token=' . $this->session->data['token'] . $url, true); |
603
|
|
|
$data['copy'] = $this->url->link('catalog/product/copy', 'token=' . $this->session->data['token'] . $url, true); |
604
|
|
|
$data['delete'] = $this->url->link('catalog/product/delete', 'token=' . $this->session->data['token'] . $url, true); |
605
|
|
|
$data['enabled'] = $this->url->link('catalog/product/enable', 'token=' . $this->session->data['token'] . $url, true); |
606
|
|
|
$data['disabled'] = $this->url->link('catalog/product/disable', 'token=' . $this->session->data['token'] . $url, true); |
607
|
|
|
|
608
|
|
|
|
609
|
|
|
$data['products'] = array(); |
610
|
|
|
|
611
|
|
|
$filter_data = array( |
612
|
|
|
'filter_name' => $filter_name, |
613
|
|
|
'filter_model' => $filter_model, |
614
|
|
|
'filter_price' => $filter_price, |
615
|
|
|
'filter_price_min' => $filter_price_min, |
616
|
|
|
'filter_price_max' => $filter_price_max, |
617
|
|
|
'filter_quantity' => $filter_quantity, |
618
|
|
|
'filter_quantity_min' => $filter_quantity_min, |
619
|
|
|
'filter_quantity_max' => $filter_quantity_max, |
620
|
|
|
'filter_status' => $filter_status, |
621
|
|
|
'filter_category' => $filter_category, |
622
|
|
|
'filter_sub_category' => $filter_sub_category, |
623
|
|
|
'filter_manufacturer' => $filter_manufacturer, |
624
|
|
|
'filter_noindex' => $filter_noindex, |
625
|
|
|
'filter_image' => $filter_image, |
626
|
|
|
'sort' => $sort, |
627
|
|
|
'order' => $order, |
628
|
|
|
'start' => ($page - 1) * $this->config->get('config_limit_admin'), |
629
|
|
|
'limit' => $this->config->get('config_limit_admin') |
630
|
|
|
); |
631
|
|
|
|
632
|
|
|
|
633
|
|
|
|
634
|
|
|
$product_total = $this->model_catalog_product->getTotalProducts($filter_data); |
635
|
|
|
|
636
|
|
|
$results = $this->model_catalog_product->getProducts($filter_data); |
637
|
|
|
|
638
|
|
|
foreach ($results as $result) { |
639
|
|
|
if (is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $result['image'])) { |
640
|
|
|
$image = '/public_html/assets/images/' . $result['image']; |
641
|
|
|
} else { |
642
|
|
|
$image = '/public_html/assets/images/no_image.png'; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
$special = false; |
646
|
|
|
|
647
|
|
|
$product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']); |
648
|
|
|
|
649
|
|
|
foreach ($product_specials as $product_special) { |
|
|
|
|
650
|
|
|
if (($product_special['date_start'] == '2000-01-01' || strtotime($product_special['date_start']) < time()) && ($product_special['date_end'] == '2000-01-01' || strtotime($product_special['date_end']) > time())) { |
651
|
|
|
$special = $product_special['price']; |
652
|
|
|
|
653
|
|
|
break; |
654
|
|
|
} |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
$data['products'][] = array( |
658
|
|
|
'product_id' => $result['product_id'], |
659
|
|
|
'image' => $image, |
660
|
|
|
'name' => $result['name'], |
661
|
|
|
'model' => $result['model'], |
662
|
|
|
'price' => $result['price'], |
663
|
|
|
'special' => $special, |
664
|
|
|
'quantity' => $result['quantity'], |
665
|
|
|
'status' => $result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled'), |
666
|
|
|
'noindex' => $result['noindex'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled'), |
667
|
|
|
'href_shop' => '/index.php?route=product/product&product_id=' . $result['product_id'], |
668
|
|
|
'edit' => $this->url->link('catalog/product/edit', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, true) |
669
|
|
|
); |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
$data['heading_title'] = $this->language->get('heading_title'); |
673
|
|
|
|
674
|
|
|
$data['text_list'] = $this->language->get('text_list'); |
675
|
|
|
$data['text_go_to'] = $this->language->get('text_go_to'); |
676
|
|
|
$data['text_none'] = $this->language->get('text_none'); |
677
|
|
|
$data['text_none_category'] = $this->language->get('text_none_category'); |
678
|
|
|
$data['text_none_manufacturer'] = $this->language->get('text_none_manufacturer'); |
679
|
|
|
$data['text_enabled'] = $this->language->get('text_enabled'); |
680
|
|
|
$data['text_disabled'] = $this->language->get('text_disabled'); |
681
|
|
|
$data['text_no_results'] = $this->language->get('text_no_results'); |
682
|
|
|
$data['text_confirm'] = $this->language->get('text_confirm'); |
683
|
|
|
|
684
|
|
|
$data['column_image'] = $this->language->get('column_image'); |
685
|
|
|
$data['column_name'] = $this->language->get('column_name'); |
686
|
|
|
$data['column_model'] = $this->language->get('column_model'); |
687
|
|
|
$data['column_price'] = $this->language->get('column_price'); |
688
|
|
|
$data['column_quantity'] = $this->language->get('column_quantity'); |
689
|
|
|
$data['column_status'] = $this->language->get('column_status'); |
690
|
|
|
$data['column_noindex'] = $this->language->get('column_noindex'); |
691
|
|
|
$data['column_action'] = $this->language->get('column_action'); |
692
|
|
|
|
693
|
|
|
$data['entry_name'] = $this->language->get('entry_name'); |
694
|
|
|
$data['entry_model'] = $this->language->get('entry_model'); |
695
|
|
|
$data['entry_price'] = $this->language->get('entry_price'); |
696
|
|
|
$data['entry_quantity'] = $this->language->get('entry_quantity'); |
697
|
|
|
$data['entry_status'] = $this->language->get('entry_status'); |
698
|
|
|
$data['entry_category'] = $this->language->get('entry_category'); |
699
|
|
|
$data['entry_sub_category'] = $this->language->get('entry_sub_category'); |
700
|
|
|
$data['entry_manufacturer'] = $this->language->get('entry_manufacturer'); |
701
|
|
|
$data['entry_noindex'] = $this->language->get('entry_noindex'); |
702
|
|
|
$data['entry_min'] = $this->language->get('entry_min'); |
703
|
|
|
$data['entry_max'] = $this->language->get('entry_max'); |
704
|
|
|
$data['entry_image'] = $this->language->get('entry_image'); |
705
|
|
|
|
706
|
|
|
$data['button_copy'] = $this->language->get('button_copy'); |
707
|
|
|
$data['button_add'] = $this->language->get('button_add'); |
708
|
|
|
$data['button_edit'] = $this->language->get('button_edit'); |
709
|
|
|
$data['button_shop'] = $this->language->get('button_shop'); |
710
|
|
|
$data['button_delete'] = $this->language->get('button_delete'); |
711
|
|
|
$data['button_filter'] = $this->language->get('button_filter'); |
712
|
|
|
$data['button_enable'] = $this->language->get('button_enable'); |
713
|
|
|
$data['button_disable'] = $this->language->get('button_disable'); |
714
|
|
|
$data['button_clear'] = $this->language->get('button_clear'); |
715
|
|
|
|
716
|
|
|
$data['token'] = $this->session->data['token']; |
717
|
|
|
|
718
|
|
|
if (isset($this->error['warning'])) { |
719
|
|
|
$data['error_warning'] = $this->error['warning']; |
720
|
|
|
} else { |
721
|
|
|
$data['error_warning'] = ''; |
722
|
|
|
} |
723
|
|
|
|
724
|
|
|
if (isset($this->session->data['success'])) { |
725
|
|
|
$data['success'] = $this->session->data['success']; |
726
|
|
|
|
727
|
|
|
unset($this->session->data['success']); |
728
|
|
|
} else { |
729
|
|
|
$data['success'] = ''; |
730
|
|
|
} |
731
|
|
|
|
732
|
|
|
if (isset($this->request->post['selected'])) { |
733
|
|
|
$data['selected'] = (array)$this->request->post['selected']; |
734
|
|
|
} else { |
735
|
|
|
$data['selected'] = array(); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
$url = ''; |
739
|
|
|
|
740
|
|
|
if (isset($this->request->get['filter_name'])) { |
741
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
742
|
|
|
} |
743
|
|
|
|
744
|
|
|
if (isset($this->request->get['filter_model'])) { |
745
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
746
|
|
|
} |
747
|
|
|
|
748
|
|
|
if (isset($this->request->get['filter_price'])) { |
749
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
750
|
|
|
} |
751
|
|
|
|
752
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
753
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
754
|
|
|
} |
755
|
|
|
|
756
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
757
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
758
|
|
|
} |
759
|
|
|
|
760
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
761
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
762
|
|
|
} |
763
|
|
|
|
764
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
765
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
766
|
|
|
} |
767
|
|
|
|
768
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
769
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
if (isset($this->request->get['filter_status'])) { |
773
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
774
|
|
|
} |
775
|
|
|
|
776
|
|
|
if (isset($this->request->get['filter_category'])) { |
777
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
778
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
779
|
|
|
$url .= '&filter_sub_category'; |
780
|
|
|
} |
781
|
|
|
} |
782
|
|
|
|
783
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
784
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
785
|
|
|
} |
786
|
|
|
|
787
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
788
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
789
|
|
|
} |
790
|
|
|
|
791
|
|
|
if (isset($this->request->get['filter_image'])) { |
792
|
|
|
$url .= '&filter_image=' . $this->request->get['filter_image']; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
if ($order == 'ASC') { |
796
|
|
|
$url .= '&order=DESC'; |
797
|
|
|
} else { |
798
|
|
|
$url .= '&order=ASC'; |
799
|
|
|
} |
800
|
|
|
|
801
|
|
|
if (isset($this->request->get['page'])) { |
802
|
|
|
$url .= '&page=' . $this->request->get['page']; |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
$data['sort_name'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, true); |
806
|
|
|
$data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, true); |
807
|
|
|
$data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, true); |
808
|
|
|
$data['sort_quantity'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.quantity' . $url, true); |
809
|
|
|
$data['sort_status'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.status' . $url, true); |
810
|
|
|
$data['sort_noindex'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.noindex' . $url, true); |
811
|
|
|
$data['sort_order'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sort_order' . $url, true); |
812
|
|
|
|
813
|
|
|
$url = ''; |
814
|
|
|
|
815
|
|
|
if (isset($this->request->get['filter_name'])) { |
816
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
817
|
|
|
} |
818
|
|
|
|
819
|
|
|
if (isset($this->request->get['filter_model'])) { |
820
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
821
|
|
|
} |
822
|
|
|
|
823
|
|
|
if (isset($this->request->get['filter_price'])) { |
824
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
825
|
|
|
} |
826
|
|
|
|
827
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
828
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
829
|
|
|
} |
830
|
|
|
|
831
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
832
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
833
|
|
|
} |
834
|
|
|
|
835
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
836
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
837
|
|
|
} |
838
|
|
|
|
839
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
840
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
841
|
|
|
} |
842
|
|
|
|
843
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
844
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
845
|
|
|
} |
846
|
|
|
|
847
|
|
|
if (isset($this->request->get['filter_status'])) { |
848
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
849
|
|
|
} |
850
|
|
|
|
851
|
|
|
if (isset($this->request->get['filter_category'])) { |
852
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
853
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
854
|
|
|
$url .= '&filter_sub_category'; |
855
|
|
|
} |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
859
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
860
|
|
|
} |
861
|
|
|
|
862
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
863
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
864
|
|
|
} |
865
|
|
|
|
866
|
|
|
if (isset($this->request->get['filter_image'])) { |
867
|
|
|
$url .= '&filter_image=' . $this->request->get['filter_image']; |
868
|
|
|
} |
869
|
|
|
|
870
|
|
|
if (isset($this->request->get['sort'])) { |
871
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
872
|
|
|
} |
873
|
|
|
|
874
|
|
|
if (isset($this->request->get['order'])) { |
875
|
|
|
$url .= '&order=' . $this->request->get['order']; |
876
|
|
|
} |
877
|
|
|
|
878
|
|
|
$pagination = new \Divine\Engine\Library\Pagination(); |
879
|
|
|
$pagination->total = $product_total; |
880
|
|
|
$pagination->page = $page; |
881
|
|
|
$pagination->limit = $this->config->get('config_limit_admin'); |
882
|
|
|
$pagination->url = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url . '&page={page}', true); |
883
|
|
|
|
884
|
|
|
$data['pagination'] = $pagination->render(); |
885
|
|
|
|
886
|
|
|
$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($product_total - $this->config->get('config_limit_admin'))) ? $product_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $product_total, ceil($product_total / $this->config->get('config_limit_admin'))); |
887
|
|
|
|
888
|
|
|
$data['filter_name'] = $filter_name; |
889
|
|
|
$data['filter_model'] = $filter_model; |
890
|
|
|
$data['filter_price'] = $filter_price; |
891
|
|
|
$data['filter_price_min'] = $filter_price_min; |
892
|
|
|
$data['filter_price_max'] = $filter_price_max; |
893
|
|
|
$data['filter_quantity'] = $filter_quantity; |
894
|
|
|
$data['filter_quantity_min'] = $filter_quantity_min; |
895
|
|
|
$data['filter_quantity_max'] = $filter_quantity_max; |
896
|
|
|
$data['filter_status'] = $filter_status; |
897
|
|
|
$data['filter_category_name'] = $filter_category_name; |
898
|
|
|
$data['filter_category'] = $filter_category; |
899
|
|
|
$data['filter_sub_category'] = $filter_sub_category; |
900
|
|
|
$data['filter_manufacturer_name'] = $filter_manufacturer_name; |
901
|
|
|
$data['filter_manufacturer'] = $filter_manufacturer; |
902
|
|
|
$data['filter_noindex'] = $filter_noindex; |
903
|
|
|
$data['filter_image'] = $filter_image; |
904
|
|
|
|
905
|
|
|
$data['sort'] = $sort; |
906
|
|
|
$data['order'] = $order; |
907
|
|
|
|
908
|
|
|
$data['header'] = $this->load->controller('common/header'); |
909
|
|
|
$data['column'] = $this->load->controller('common/column_left'); |
910
|
|
|
$data['footer'] = $this->load->controller('common/footer'); |
911
|
|
|
|
912
|
|
|
$this->response->setOutput($this->load->view('catalog/product_list', $data)); |
913
|
|
|
} |
914
|
|
|
|
915
|
|
|
protected function getForm() |
916
|
|
|
{ |
917
|
|
|
$data['heading_title'] = $this->language->get('heading_title'); |
|
|
|
|
918
|
|
|
|
919
|
|
|
$data['text_form'] = !isset($this->request->get['product_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); |
920
|
|
|
$data['text_enabled'] = $this->language->get('text_enabled'); |
921
|
|
|
$data['text_disabled'] = $this->language->get('text_disabled'); |
922
|
|
|
$data['text_none'] = $this->language->get('text_none'); |
923
|
|
|
$data['text_yes'] = $this->language->get('text_yes'); |
924
|
|
|
$data['text_no'] = $this->language->get('text_no'); |
925
|
|
|
$data['text_plus'] = $this->language->get('text_plus'); |
926
|
|
|
$data['text_minus'] = $this->language->get('text_minus'); |
927
|
|
|
$data['text_default'] = $this->language->get('text_default'); |
928
|
|
|
$data['text_option'] = $this->language->get('text_option'); |
929
|
|
|
$data['text_option_value'] = $this->language->get('text_option_value'); |
930
|
|
|
$data['text_select'] = $this->language->get('text_select'); |
931
|
|
|
$data['text_percent'] = $this->language->get('text_percent'); |
932
|
|
|
$data['text_amount'] = $this->language->get('text_amount'); |
933
|
|
|
$data['text_add'] = $this->language->get('text_add'); |
934
|
|
|
|
935
|
|
|
$data['entry_name'] = $this->language->get('entry_name'); |
936
|
|
|
$data['entry_description'] = $this->language->get('entry_description'); |
937
|
|
|
$data['entry_description_mini'] = $this->language->get('entry_description_mini'); |
938
|
|
|
$data['entry_meta_title'] = $this->language->get('entry_meta_title'); |
939
|
|
|
$data['entry_meta_h1'] = $this->language->get('entry_meta_h1'); |
940
|
|
|
$data['entry_meta_description'] = $this->language->get('entry_meta_description'); |
941
|
|
|
$data['entry_keyword'] = $this->language->get('entry_keyword'); |
942
|
|
|
$data['entry_model'] = $this->language->get('entry_model'); |
943
|
|
|
$data['entry_sku'] = $this->language->get('entry_sku'); |
944
|
|
|
$data['entry_upc'] = $this->language->get('entry_upc'); |
945
|
|
|
$data['entry_ean'] = $this->language->get('entry_ean'); |
946
|
|
|
$data['entry_jan'] = $this->language->get('entry_jan'); |
947
|
|
|
$data['entry_isbn'] = $this->language->get('entry_isbn'); |
948
|
|
|
$data['entry_mpn'] = $this->language->get('entry_mpn'); |
949
|
|
|
$data['entry_location'] = $this->language->get('entry_location'); |
950
|
|
|
$data['entry_minimum'] = $this->language->get('entry_minimum'); |
951
|
|
|
$data['entry_shipping'] = $this->language->get('entry_shipping'); |
952
|
|
|
$data['entry_quantity'] = $this->language->get('entry_quantity'); |
953
|
|
|
$data['entry_stock_status'] = $this->language->get('entry_stock_status'); |
954
|
|
|
$data['entry_price'] = $this->language->get('entry_price'); |
955
|
|
|
$data['entry_points'] = $this->language->get('entry_points'); |
956
|
|
|
$data['entry_option_points'] = $this->language->get('entry_option_points'); |
957
|
|
|
$data['entry_subtract'] = $this->language->get('entry_subtract'); |
958
|
|
|
$data['entry_dimension'] = $this->language->get('entry_dimension'); |
959
|
|
|
$data['entry_width'] = $this->language->get('entry_width'); |
960
|
|
|
$data['entry_height'] = $this->language->get('entry_height'); |
961
|
|
|
$data['entry_image'] = $this->language->get('entry_image'); |
962
|
|
|
$data['entry_additional_image'] = $this->language->get('entry_additional_image'); |
963
|
|
|
$data['entry_manufacturer'] = $this->language->get('entry_manufacturer'); |
964
|
|
|
$data['entry_download'] = $this->language->get('entry_download'); |
965
|
|
|
$data['entry_category'] = $this->language->get('entry_category'); |
966
|
|
|
$data['entry_main_category'] = $this->language->get('entry_main_category'); |
967
|
|
|
$data['entry_filter'] = $this->language->get('entry_filter'); |
968
|
|
|
$data['entry_related'] = $this->language->get('entry_related'); |
969
|
|
|
$data['entry_related_article'] = $this->language->get('entry_related_article'); |
970
|
|
|
$data['entry_attribute'] = $this->language->get('entry_attribute'); |
971
|
|
|
$data['entry_text'] = $this->language->get('entry_text'); |
972
|
|
|
$data['entry_option'] = $this->language->get('entry_option'); |
973
|
|
|
$data['entry_option_value'] = $this->language->get('entry_option_value'); |
974
|
|
|
$data['entry_required'] = $this->language->get('entry_required'); |
975
|
|
|
$data['entry_sort_order'] = $this->language->get('entry_sort_order'); |
976
|
|
|
$data['entry_status'] = $this->language->get('entry_status'); |
977
|
|
|
$data['entry_noindex'] = $this->language->get('entry_noindex'); |
978
|
|
|
$data['entry_date_start'] = $this->language->get('entry_date_start'); |
979
|
|
|
$data['entry_date_end'] = $this->language->get('entry_date_end'); |
980
|
|
|
$data['entry_priority'] = $this->language->get('entry_priority'); |
981
|
|
|
$data['entry_tag'] = $this->language->get('entry_tag'); |
982
|
|
|
$data['entry_customer_group'] = $this->language->get('entry_customer_group'); |
983
|
|
|
$data['entry_reward'] = $this->language->get('entry_reward'); |
984
|
|
|
$data['entry_layout'] = $this->language->get('entry_layout'); |
985
|
|
|
$data['entry_heading'] = $this->language->get('entry_heading'); |
986
|
|
|
|
987
|
|
|
$data['help_keyword'] = $this->language->get('help_keyword'); |
988
|
|
|
$data['help_sku'] = $this->language->get('help_sku'); |
989
|
|
|
$data['help_upc'] = $this->language->get('help_upc'); |
990
|
|
|
$data['help_ean'] = $this->language->get('help_ean'); |
991
|
|
|
$data['help_jan'] = $this->language->get('help_jan'); |
992
|
|
|
$data['help_isbn'] = $this->language->get('help_isbn'); |
993
|
|
|
$data['help_mpn'] = $this->language->get('help_mpn'); |
994
|
|
|
$data['help_minimum'] = $this->language->get('help_minimum'); |
995
|
|
|
$data['help_manufacturer'] = $this->language->get('help_manufacturer'); |
996
|
|
|
$data['help_stock_status'] = $this->language->get('help_stock_status'); |
997
|
|
|
$data['help_points'] = $this->language->get('help_points'); |
998
|
|
|
$data['help_category'] = $this->language->get('help_category'); |
999
|
|
|
$data['help_filter'] = $this->language->get('help_filter'); |
1000
|
|
|
$data['help_download'] = $this->language->get('help_download'); |
1001
|
|
|
$data['help_related'] = $this->language->get('help_related'); |
1002
|
|
|
$data['help_tag'] = $this->language->get('help_tag'); |
1003
|
|
|
$data['help_noindex'] = $this->language->get('help_noindex'); |
1004
|
|
|
|
1005
|
|
|
$data['button_save'] = $this->language->get('button_save'); |
1006
|
|
|
$data['button_cancel'] = $this->language->get('button_cancel'); |
1007
|
|
|
$data['button_attribute_add'] = $this->language->get('button_attribute_add'); |
1008
|
|
|
$data['button_option_add'] = $this->language->get('button_option_add'); |
1009
|
|
|
$data['button_option_value_add'] = $this->language->get('button_option_value_add'); |
1010
|
|
|
$data['button_discount_add'] = $this->language->get('button_discount_add'); |
1011
|
|
|
$data['button_special_add'] = $this->language->get('button_special_add'); |
1012
|
|
|
$data['button_image_add'] = $this->language->get('button_image_add'); |
1013
|
|
|
$data['button_remove'] = $this->language->get('button_remove'); |
1014
|
|
|
|
1015
|
|
|
$data['tab_general'] = $this->language->get('tab_general'); |
1016
|
|
|
$data['tab_data'] = $this->language->get('tab_data'); |
1017
|
|
|
$data['tab_attribute'] = $this->language->get('tab_attribute'); |
1018
|
|
|
$data['tab_option'] = $this->language->get('tab_option'); |
1019
|
|
|
$data['tab_discount'] = $this->language->get('tab_discount'); |
1020
|
|
|
$data['tab_special'] = $this->language->get('tab_special'); |
1021
|
|
|
$data['tab_image'] = $this->language->get('tab_image'); |
1022
|
|
|
$data['tab_links'] = $this->language->get('tab_links'); |
1023
|
|
|
$data['tab_reward'] = $this->language->get('tab_reward'); |
1024
|
|
|
$data['tab_design'] = $this->language->get('tab_design'); |
1025
|
|
|
$data['tab_openbay'] = $this->language->get('tab_openbay'); |
1026
|
|
|
$data['tab_extra_tab'] = $this->language->get('tab_extra_tab'); |
1027
|
|
|
$data['tab_module'] = $this->language->get('tab_module'); |
1028
|
|
|
$data['text_corner0'] = $this->language->get('text_corner0'); |
1029
|
|
|
$data['text_corner1'] = $this->language->get('text_corner1'); |
1030
|
|
|
$data['text_corner2'] = $this->language->get('text_corner2'); |
1031
|
|
|
$data['text_corner3'] = $this->language->get('text_corner3'); |
1032
|
|
|
$data['entry_sticker'] = $this->language->get('entry_sticker'); |
1033
|
|
|
$data['text_benefits'] = $this->language->get('text_benefits'); |
1034
|
|
|
|
1035
|
|
|
if (isset($this->error['warning'])) { |
1036
|
|
|
$data['error_warning'] = $this->error['warning']; |
1037
|
|
|
} else { |
1038
|
|
|
$data['error_warning'] = ''; |
1039
|
|
|
} |
1040
|
|
|
|
1041
|
|
|
if (isset($this->error['name'])) { |
1042
|
|
|
$data['error_name'] = $this->error['name']; |
1043
|
|
|
} else { |
1044
|
|
|
$data['error_name'] = array(); |
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
if (isset($this->error['meta_title'])) { |
1048
|
|
|
$data['error_meta_title'] = $this->error['meta_title']; |
1049
|
|
|
} else { |
1050
|
|
|
$data['error_meta_title'] = array(); |
1051
|
|
|
} |
1052
|
|
|
|
1053
|
|
|
if (isset($this->error['meta_h1'])) { |
1054
|
|
|
$data['error_meta_h1'] = $this->error['meta_h1']; |
1055
|
|
|
} else { |
1056
|
|
|
$data['error_meta_h1'] = array(); |
1057
|
|
|
} |
1058
|
|
|
|
1059
|
|
|
if (isset($this->error['model'])) { |
1060
|
|
|
$data['error_model'] = $this->error['model']; |
1061
|
|
|
} else { |
1062
|
|
|
$data['error_model'] = ''; |
1063
|
|
|
} |
1064
|
|
|
|
1065
|
|
|
if (isset($this->error['tab'])) { |
1066
|
|
|
$data['error_tab'] = $this->error['tab']; |
1067
|
|
|
} else { |
1068
|
|
|
$data['error_tab'] = array(); |
1069
|
|
|
} |
1070
|
|
|
|
1071
|
|
|
if (isset($this->error['keyword'])) { |
1072
|
|
|
$data['error_keyword'] = $this->error['keyword']; |
1073
|
|
|
} else { |
1074
|
|
|
$data['error_keyword'] = ''; |
1075
|
|
|
} |
1076
|
|
|
|
1077
|
|
|
$url = ''; |
1078
|
|
|
|
1079
|
|
|
if (isset($this->request->get['filter_name'])) { |
1080
|
|
|
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8')); |
1081
|
|
|
} |
1082
|
|
|
|
1083
|
|
|
if (isset($this->request->get['filter_model'])) { |
1084
|
|
|
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); |
1085
|
|
|
} |
1086
|
|
|
|
1087
|
|
|
if (isset($this->request->get['filter_price'])) { |
1088
|
|
|
$url .= '&filter_price=' . $this->request->get['filter_price']; |
1089
|
|
|
} |
1090
|
|
|
|
1091
|
|
|
if (isset($this->request->get['filter_price_min'])) { |
1092
|
|
|
$url .= '&filter_price_min=' . $this->request->get['filter_price_min']; |
1093
|
|
|
} |
1094
|
|
|
|
1095
|
|
|
if (isset($this->request->get['filter_price_max'])) { |
1096
|
|
|
$url .= '&filter_price_max=' . $this->request->get['filter_price_max']; |
1097
|
|
|
} |
1098
|
|
|
|
1099
|
|
|
if (isset($this->request->get['filter_quantity'])) { |
1100
|
|
|
$url .= '&filter_quantity=' . $this->request->get['filter_quantity']; |
1101
|
|
|
} |
1102
|
|
|
|
1103
|
|
|
if (isset($this->request->get['filter_quantity_min'])) { |
1104
|
|
|
$url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min']; |
1105
|
|
|
} |
1106
|
|
|
|
1107
|
|
|
if (isset($this->request->get['filter_quantity_max'])) { |
1108
|
|
|
$url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max']; |
1109
|
|
|
} |
1110
|
|
|
|
1111
|
|
|
if (isset($this->request->get['filter_status'])) { |
1112
|
|
|
$url .= '&filter_status=' . $this->request->get['filter_status']; |
1113
|
|
|
} |
1114
|
|
|
|
1115
|
|
|
if (isset($this->request->get['filter_category'])) { |
1116
|
|
|
$url .= '&filter_category=' . $this->request->get['filter_category']; |
1117
|
|
|
if (isset($this->request->get['filter_sub_category'])) { |
1118
|
|
|
$url .= '&filter_sub_category'; |
1119
|
|
|
} |
1120
|
|
|
} |
1121
|
|
|
|
1122
|
|
|
if (isset($this->request->get['filter_manufacturer'])) { |
1123
|
|
|
$url .= '&filter_manufacturer=' . $this->request->get['filter_manufacturer']; |
1124
|
|
|
} |
1125
|
|
|
|
1126
|
|
|
if (isset($this->request->get['filter_noindex'])) { |
1127
|
|
|
$url .= '&filter_noindex=' . $this->request->get['filter_noindex']; |
1128
|
|
|
} |
1129
|
|
|
|
1130
|
|
|
if (isset($this->request->get['sort'])) { |
1131
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
1132
|
|
|
} |
1133
|
|
|
|
1134
|
|
|
if (isset($this->request->get['order'])) { |
1135
|
|
|
$url .= '&order=' . $this->request->get['order']; |
1136
|
|
|
} |
1137
|
|
|
|
1138
|
|
|
if (isset($this->request->get['page'])) { |
1139
|
|
|
$url .= '&page=' . $this->request->get['page']; |
1140
|
|
|
} |
1141
|
|
|
|
1142
|
|
|
$data['breadcrumbs'] = array(); |
1143
|
|
|
|
1144
|
|
|
$data['breadcrumbs'][] = array( |
1145
|
|
|
'text' => $this->language->get('text_home'), |
1146
|
|
|
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
1147
|
|
|
); |
1148
|
|
|
|
1149
|
|
|
$data['breadcrumbs'][] = array( |
1150
|
|
|
'text' => $this->language->get('heading_title'), |
1151
|
|
|
'href' => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true) |
1152
|
|
|
); |
1153
|
|
|
|
1154
|
|
|
if (!isset($this->request->get['product_id'])) { |
1155
|
|
|
$data['action'] = $this->url->link('catalog/product/add', 'token=' . $this->session->data['token'] . $url, true); |
1156
|
|
|
} else { |
1157
|
|
|
$data['action'] = $this->url->link('catalog/product/edit', 'token=' . $this->session->data['token'] . '&product_id=' . $this->request->get['product_id'] . $url, true); |
1158
|
|
|
} |
1159
|
|
|
|
1160
|
|
|
$data['cancel'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true); |
1161
|
|
|
|
1162
|
|
|
if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { |
1163
|
|
|
$product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']); |
1164
|
|
|
} |
1165
|
|
|
|
1166
|
|
|
$data['token'] = $this->session->data['token']; |
1167
|
|
|
|
1168
|
|
|
$this->load->model('localisation/language'); |
1169
|
|
|
|
1170
|
|
|
$data['languages'] = $this->model_localisation_language->getLanguages(); |
1171
|
|
|
|
1172
|
|
|
if (isset($this->request->post['product_description'])) { |
1173
|
|
|
$data['product_description'] = $this->request->post['product_description']; |
1174
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1175
|
|
|
$data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']); |
1176
|
|
|
} else { |
1177
|
|
|
$data['product_description'] = array(); |
1178
|
|
|
} |
1179
|
|
|
|
1180
|
|
|
$language_id = $this->config->get('config_language_id'); |
1181
|
|
|
if (isset($data['product_description'][$language_id]['name'])) { |
1182
|
|
|
$data['heading_title'] = $data['product_description'][$language_id]['name']; |
1183
|
|
|
} |
1184
|
|
|
|
1185
|
|
|
if (isset($this->request->post['model'])) { |
1186
|
|
|
$data['model'] = $this->request->post['model']; |
1187
|
|
|
} elseif (!empty($product_info)) { |
1188
|
|
|
$data['model'] = $product_info['model']; |
1189
|
|
|
} else { |
1190
|
|
|
$data['model'] = ''; |
1191
|
|
|
} |
1192
|
|
|
|
1193
|
|
|
if (isset($this->request->post['sku'])) { |
1194
|
|
|
$data['sku'] = $this->request->post['sku']; |
1195
|
|
|
} elseif (!empty($product_info)) { |
1196
|
|
|
$data['sku'] = $product_info['sku']; |
1197
|
|
|
} else { |
1198
|
|
|
$data['sku'] = ''; |
1199
|
|
|
} |
1200
|
|
|
|
1201
|
|
|
if (isset($this->request->post['upc'])) { |
1202
|
|
|
$data['upc'] = $this->request->post['upc']; |
1203
|
|
|
} elseif (!empty($product_info)) { |
1204
|
|
|
$data['upc'] = $product_info['upc']; |
1205
|
|
|
} else { |
1206
|
|
|
$data['upc'] = ''; |
1207
|
|
|
} |
1208
|
|
|
|
1209
|
|
|
if (isset($this->request->post['ean'])) { |
1210
|
|
|
$data['ean'] = $this->request->post['ean']; |
1211
|
|
|
} elseif (!empty($product_info)) { |
1212
|
|
|
$data['ean'] = $product_info['ean']; |
1213
|
|
|
} else { |
1214
|
|
|
$data['ean'] = ''; |
1215
|
|
|
} |
1216
|
|
|
|
1217
|
|
|
if (isset($this->request->post['jan'])) { |
1218
|
|
|
$data['jan'] = $this->request->post['jan']; |
1219
|
|
|
} elseif (!empty($product_info)) { |
1220
|
|
|
$data['jan'] = $product_info['jan']; |
1221
|
|
|
} else { |
1222
|
|
|
$data['jan'] = ''; |
1223
|
|
|
} |
1224
|
|
|
|
1225
|
|
|
if (isset($this->request->post['isbn'])) { |
1226
|
|
|
$data['isbn'] = $this->request->post['isbn']; |
1227
|
|
|
} elseif (!empty($product_info)) { |
1228
|
|
|
$data['isbn'] = $product_info['isbn']; |
1229
|
|
|
} else { |
1230
|
|
|
$data['isbn'] = ''; |
1231
|
|
|
} |
1232
|
|
|
|
1233
|
|
|
if (isset($this->request->post['mpn'])) { |
1234
|
|
|
$data['mpn'] = $this->request->post['mpn']; |
1235
|
|
|
} elseif (!empty($product_info)) { |
1236
|
|
|
$data['mpn'] = $product_info['mpn']; |
1237
|
|
|
} else { |
1238
|
|
|
$data['mpn'] = ''; |
1239
|
|
|
} |
1240
|
|
|
|
1241
|
|
|
if (isset($this->request->post['location'])) { |
1242
|
|
|
$data['location'] = $this->request->post['location']; |
1243
|
|
|
} elseif (!empty($product_info)) { |
1244
|
|
|
$data['location'] = $product_info['location']; |
1245
|
|
|
} else { |
1246
|
|
|
$data['location'] = ''; |
1247
|
|
|
} |
1248
|
|
|
|
1249
|
|
|
if (isset($this->request->post['keyword'])) { |
1250
|
|
|
$data['keyword'] = $this->request->post['keyword']; |
1251
|
|
|
} elseif (!empty($product_info)) { |
1252
|
|
|
$data['keyword'] = $product_info['keyword']; |
1253
|
|
|
} else { |
1254
|
|
|
$data['keyword'] = ''; |
1255
|
|
|
} |
1256
|
|
|
|
1257
|
|
|
if (isset($this->request->post['shipping'])) { |
1258
|
|
|
$data['shipping'] = $this->request->post['shipping']; |
1259
|
|
|
} elseif (!empty($product_info)) { |
1260
|
|
|
$data['shipping'] = $product_info['shipping']; |
1261
|
|
|
} else { |
1262
|
|
|
$data['shipping'] = 1; |
1263
|
|
|
} |
1264
|
|
|
|
1265
|
|
|
if (isset($this->request->post['price'])) { |
1266
|
|
|
$data['price'] = $this->request->post['price']; |
1267
|
|
|
} elseif (!empty($product_info)) { |
1268
|
|
|
$data['price'] = $product_info['price']; |
1269
|
|
|
} else { |
1270
|
|
|
$data['price'] = ''; |
1271
|
|
|
} |
1272
|
|
|
|
1273
|
|
|
if (isset($this->request->post['quantity'])) { |
1274
|
|
|
$data['quantity'] = $this->request->post['quantity']; |
1275
|
|
|
} elseif (!empty($product_info)) { |
1276
|
|
|
$data['quantity'] = $product_info['quantity']; |
1277
|
|
|
} else { |
1278
|
|
|
$data['quantity'] = 1; |
1279
|
|
|
} |
1280
|
|
|
|
1281
|
|
|
if (isset($this->request->post['minimum'])) { |
1282
|
|
|
$data['minimum'] = $this->request->post['minimum']; |
1283
|
|
|
} elseif (!empty($product_info)) { |
1284
|
|
|
$data['minimum'] = $product_info['minimum']; |
1285
|
|
|
} else { |
1286
|
|
|
$data['minimum'] = 1; |
1287
|
|
|
} |
1288
|
|
|
|
1289
|
|
|
if (isset($this->request->post['subtract'])) { |
1290
|
|
|
$data['subtract'] = $this->request->post['subtract']; |
1291
|
|
|
} elseif (!empty($product_info)) { |
1292
|
|
|
$data['subtract'] = $product_info['subtract']; |
1293
|
|
|
} else { |
1294
|
|
|
$data['subtract'] = 1; |
1295
|
|
|
} |
1296
|
|
|
|
1297
|
|
|
if (isset($this->request->post['sort_order'])) { |
1298
|
|
|
$data['sort_order'] = $this->request->post['sort_order']; |
1299
|
|
|
} elseif (!empty($product_info)) { |
1300
|
|
|
$data['sort_order'] = $product_info['sort_order']; |
1301
|
|
|
} else { |
1302
|
|
|
$data['sort_order'] = 1; |
1303
|
|
|
} |
1304
|
|
|
|
1305
|
|
|
$this->load->model('localisation/stock_status'); |
1306
|
|
|
|
1307
|
|
|
$data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses(); |
1308
|
|
|
|
1309
|
|
|
if (isset($this->request->post['stock_status_id'])) { |
1310
|
|
|
$data['stock_status_id'] = $this->request->post['stock_status_id']; |
1311
|
|
|
} elseif (!empty($product_info)) { |
1312
|
|
|
$data['stock_status_id'] = $product_info['stock_status_id']; |
1313
|
|
|
} else { |
1314
|
|
|
$data['stock_status_id'] = 0; |
1315
|
|
|
} |
1316
|
|
|
|
1317
|
|
|
if (isset($this->request->post['status'])) { |
1318
|
|
|
$data['status'] = $this->request->post['status']; |
1319
|
|
|
} elseif (!empty($product_info)) { |
1320
|
|
|
$data['status'] = $product_info['status']; |
1321
|
|
|
} else { |
1322
|
|
|
$data['status'] = true; |
1323
|
|
|
} |
1324
|
|
|
|
1325
|
|
|
if (isset($this->request->post['noindex'])) { |
1326
|
|
|
$data['noindex'] = $this->request->post['noindex']; |
1327
|
|
|
} elseif (!empty($product_info)) { |
1328
|
|
|
$data['noindex'] = $product_info['noindex']; |
1329
|
|
|
} else { |
1330
|
|
|
$data['noindex'] = 1; |
1331
|
|
|
} |
1332
|
|
|
|
1333
|
|
|
if (isset($this->request->post['width'])) { |
1334
|
|
|
$data['width'] = $this->request->post['width']; |
1335
|
|
|
} elseif (!empty($product_info)) { |
1336
|
|
|
$data['width'] = $product_info['width']; |
1337
|
|
|
} else { |
1338
|
|
|
$data['width'] = ''; |
1339
|
|
|
} |
1340
|
|
|
|
1341
|
|
|
if (isset($this->request->post['height'])) { |
1342
|
|
|
$data['height'] = $this->request->post['height']; |
1343
|
|
|
} elseif (!empty($product_info)) { |
1344
|
|
|
$data['height'] = $product_info['height']; |
1345
|
|
|
} else { |
1346
|
|
|
$data['height'] = ''; |
1347
|
|
|
} |
1348
|
|
|
|
1349
|
|
|
$this->load->model('catalog/manufacturer'); |
1350
|
|
|
|
1351
|
|
|
if (isset($this->request->post['manufacturer_id'])) { |
1352
|
|
|
$data['manufacturer_id'] = $this->request->post['manufacturer_id']; |
1353
|
|
|
} elseif (!empty($product_info)) { |
1354
|
|
|
$data['manufacturer_id'] = $product_info['manufacturer_id']; |
1355
|
|
|
} else { |
1356
|
|
|
$data['manufacturer_id'] = 0; |
1357
|
|
|
} |
1358
|
|
|
|
1359
|
|
|
if (isset($this->request->post['manufacturer'])) { |
1360
|
|
|
$data['manufacturer'] = $this->request->post['manufacturer']; |
1361
|
|
|
} elseif (!empty($product_info)) { |
1362
|
|
|
$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']); |
1363
|
|
|
|
1364
|
|
|
if ($manufacturer_info) { |
1365
|
|
|
$data['manufacturer'] = $manufacturer_info['name']; |
1366
|
|
|
} else { |
1367
|
|
|
$data['manufacturer'] = ''; |
1368
|
|
|
} |
1369
|
|
|
} else { |
1370
|
|
|
$data['manufacturer'] = ''; |
1371
|
|
|
} |
1372
|
|
|
|
1373
|
|
|
// Categories |
1374
|
|
|
$this->load->model('catalog/category'); |
1375
|
|
|
|
1376
|
|
|
$categories = $this->model_catalog_category->getAllCategories(); |
1377
|
|
|
|
1378
|
|
|
$data['categories'] = $this->model_catalog_category->getCategories($categories); |
1379
|
|
|
|
1380
|
|
|
if (isset($this->request->post['main_category_id'])) { |
1381
|
|
|
$data['main_category_id'] = $this->request->post['main_category_id']; |
1382
|
|
|
} elseif (isset($product_info)) { |
1383
|
|
|
$data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']); |
1384
|
|
|
} else { |
1385
|
|
|
$data['main_category_id'] = 0; |
1386
|
|
|
} |
1387
|
|
|
|
1388
|
|
|
if (isset($this->request->post['product_category'])) { |
1389
|
|
|
$categories = $this->request->post['product_category']; |
1390
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1391
|
|
|
$categories = $this->model_catalog_product->getProductCategories($this->request->get['product_id']); |
1392
|
|
|
} else { |
1393
|
|
|
$categories = array(); |
1394
|
|
|
} |
1395
|
|
|
|
1396
|
|
|
$data['product_categories'] = array(); |
1397
|
|
|
|
1398
|
|
|
foreach ($categories as $category_id) { |
1399
|
|
|
$category_info = $this->model_catalog_category->getCategory($category_id); |
1400
|
|
|
|
1401
|
|
|
if ($category_info) { |
1402
|
|
|
$data['product_categories'][] = array( |
1403
|
|
|
'category_id' => $category_info['category_id'], |
1404
|
|
|
'name' => ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name'] |
1405
|
|
|
); |
1406
|
|
|
} |
1407
|
|
|
} |
1408
|
|
|
|
1409
|
|
|
// Filters |
1410
|
|
|
$this->load->model('catalog/filter'); |
1411
|
|
|
|
1412
|
|
|
if (isset($this->request->post['product_filter'])) { |
1413
|
|
|
$filters = $this->request->post['product_filter']; |
1414
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1415
|
|
|
$filters = $this->model_catalog_product->getProductFilters($this->request->get['product_id']); |
1416
|
|
|
} else { |
1417
|
|
|
$filters = array(); |
1418
|
|
|
} |
1419
|
|
|
|
1420
|
|
|
$data['product_filters'] = array(); |
1421
|
|
|
|
1422
|
|
|
foreach ($filters as $filter_id) { |
1423
|
|
|
$filter_info = $this->model_catalog_filter->getFilter($filter_id); |
1424
|
|
|
|
1425
|
|
|
if ($filter_info) { |
1426
|
|
|
$data['product_filters'][] = array( |
1427
|
|
|
'filter_id' => $filter_info['filter_id'], |
1428
|
|
|
'name' => $filter_info['group'] . ' > ' . $filter_info['name'] |
1429
|
|
|
); |
1430
|
|
|
} |
1431
|
|
|
} |
1432
|
|
|
|
1433
|
|
|
// Attributes |
1434
|
|
|
$this->load->model('catalog/attribute'); |
1435
|
|
|
|
1436
|
|
|
if (isset($this->request->post['product_attribute'])) { |
1437
|
|
|
$product_attributes = $this->request->post['product_attribute']; |
1438
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1439
|
|
|
$product_attributes = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']); |
1440
|
|
|
} else { |
1441
|
|
|
$product_attributes = array(); |
1442
|
|
|
} |
1443
|
|
|
|
1444
|
|
|
$data['product_attributes'] = array(); |
1445
|
|
|
|
1446
|
|
|
foreach ($product_attributes as $product_attribute) { |
1447
|
|
|
$attribute_info = $this->model_catalog_attribute->getAttribute($product_attribute['attribute_id']); |
1448
|
|
|
|
1449
|
|
|
if ($attribute_info) { |
1450
|
|
|
$data['product_attributes'][] = array( |
1451
|
|
|
'attribute_id' => $product_attribute['attribute_id'], |
1452
|
|
|
'name' => $attribute_info['name'], |
1453
|
|
|
'product_attribute_description' => $product_attribute['product_attribute_description'] |
1454
|
|
|
); |
1455
|
|
|
} |
1456
|
|
|
} |
1457
|
|
|
|
1458
|
|
|
// Options |
1459
|
|
|
$this->load->model('catalog/option'); |
1460
|
|
|
|
1461
|
|
|
if (isset($this->request->post['product_option'])) { |
1462
|
|
|
$product_options = $this->request->post['product_option']; |
1463
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1464
|
|
|
$product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']); |
1465
|
|
|
} else { |
1466
|
|
|
$product_options = array(); |
1467
|
|
|
} |
1468
|
|
|
|
1469
|
|
|
$data['product_options'] = array(); |
1470
|
|
|
|
1471
|
|
|
foreach ($product_options as $product_option) { |
1472
|
|
|
$product_option_value_data = array(); |
1473
|
|
|
|
1474
|
|
|
if (isset($product_option['product_option_value'])) { |
1475
|
|
|
foreach ($product_option['product_option_value'] as $product_option_value) { |
1476
|
|
|
$product_option_value_data[] = array( |
1477
|
|
|
'product_option_value_id' => $product_option_value['product_option_value_id'], |
1478
|
|
|
'option_value_id' => $product_option_value['option_value_id'], |
1479
|
|
|
'quantity' => $product_option_value['quantity'], |
1480
|
|
|
'subtract' => $product_option_value['subtract'], |
1481
|
|
|
'price' => $product_option_value['price'], |
1482
|
|
|
'price_prefix' => $product_option_value['price_prefix'], |
1483
|
|
|
'points' => $product_option_value['points'], |
1484
|
|
|
'points_prefix' => $product_option_value['points_prefix'] |
1485
|
|
|
); |
1486
|
|
|
} |
1487
|
|
|
} |
1488
|
|
|
|
1489
|
|
|
$data['product_options'][] = array( |
1490
|
|
|
'product_option_id' => $product_option['product_option_id'], |
1491
|
|
|
'product_option_value' => $product_option_value_data, |
1492
|
|
|
'option_id' => $product_option['option_id'], |
1493
|
|
|
'name' => $product_option['name'], |
1494
|
|
|
'type' => $product_option['type'], |
1495
|
|
|
'value' => isset($product_option['value']) ? $product_option['value'] : '', |
1496
|
|
|
'required' => $product_option['required'] |
1497
|
|
|
); |
1498
|
|
|
} |
1499
|
|
|
|
1500
|
|
|
$data['option_values'] = array(); |
1501
|
|
|
|
1502
|
|
|
foreach ($data['product_options'] as $product_option) { |
1503
|
|
|
if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') { |
1504
|
|
|
if (!isset($data['option_values'][$product_option['option_id']])) { |
1505
|
|
|
$data['option_values'][$product_option['option_id']] = $this->model_catalog_option->getOptionValues($product_option['option_id']); |
1506
|
|
|
} |
1507
|
|
|
} |
1508
|
|
|
} |
1509
|
|
|
|
1510
|
|
|
$this->load->model('customer/customer_group'); |
1511
|
|
|
|
1512
|
|
|
$data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); |
1513
|
|
|
|
1514
|
|
|
if (isset($this->request->post['product_discount'])) { |
1515
|
|
|
$product_discounts = $this->request->post['product_discount']; |
1516
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1517
|
|
|
$product_discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']); |
1518
|
|
|
} else { |
1519
|
|
|
$product_discounts = array(); |
1520
|
|
|
} |
1521
|
|
|
|
1522
|
|
|
$data['product_discounts'] = array(); |
1523
|
|
|
|
1524
|
|
|
foreach ($product_discounts as $product_discount) { |
1525
|
|
|
$data['product_discounts'][] = array( |
1526
|
|
|
'customer_group_id' => $product_discount['customer_group_id'], |
1527
|
|
|
'quantity' => $product_discount['quantity'], |
1528
|
|
|
'priority' => $product_discount['priority'], |
1529
|
|
|
'price' => $product_discount['price'], |
1530
|
|
|
'date_start' => ($product_discount['date_start'] != '2000-01-01') ? $product_discount['date_start'] : '', |
1531
|
|
|
'date_end' => ($product_discount['date_end'] != '2000-01-01') ? $product_discount['date_end'] : '' |
1532
|
|
|
); |
1533
|
|
|
} |
1534
|
|
|
|
1535
|
|
|
if (isset($this->request->post['product_special'])) { |
1536
|
|
|
$product_specials = $this->request->post['product_special']; |
1537
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1538
|
|
|
$product_specials = $this->model_catalog_product->getProductSpecials($this->request->get['product_id']); |
1539
|
|
|
} else { |
1540
|
|
|
$product_specials = array(); |
1541
|
|
|
} |
1542
|
|
|
|
1543
|
|
|
$data['product_specials'] = array(); |
1544
|
|
|
|
1545
|
|
|
foreach ($product_specials as $product_special) { |
1546
|
|
|
$data['product_specials'][] = array( |
1547
|
|
|
'customer_group_id' => $product_special['customer_group_id'], |
1548
|
|
|
'priority' => $product_special['priority'], |
1549
|
|
|
'price' => $product_special['price'], |
1550
|
|
|
'date_start' => ($product_special['date_start'] != '2000-01-01') ? $product_special['date_start'] : '', |
1551
|
|
|
'date_end' => ($product_special['date_end'] != '2000-01-01') ? $product_special['date_end'] : '' |
1552
|
|
|
); |
1553
|
|
|
} |
1554
|
|
|
|
1555
|
|
|
// Image |
1556
|
|
|
if (isset($this->request->post['image'])) { |
1557
|
|
|
$data['image'] = $this->request->post['image']; |
1558
|
|
|
} elseif (!empty($product_info)) { |
1559
|
|
|
$data['image'] = $product_info['image']; |
1560
|
|
|
} else { |
1561
|
|
|
$data['image'] = ''; |
1562
|
|
|
} |
1563
|
|
|
|
1564
|
|
|
|
1565
|
|
|
|
1566
|
|
|
if (isset($this->request->post['image']) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->request->post['image'])) { |
1567
|
|
|
$data['thumb'] = '/public_html/assets/images/' . $this->request->post['image']; |
1568
|
|
|
} elseif (!empty($product_info) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $product_info['image'])) { |
1569
|
|
|
$data['thumb'] = '/public_html/assets/images/' . $product_info['image']; |
1570
|
|
|
} else { |
1571
|
|
|
$data['thumb'] = '/public_html/assets/images/no_image.png'; |
1572
|
|
|
} |
1573
|
|
|
|
1574
|
|
|
$data['placeholder'] = '/public_html/assets/images/no_image.png'; |
1575
|
|
|
|
1576
|
|
|
// Images |
1577
|
|
|
if (isset($this->request->post['product_image'])) { |
1578
|
|
|
$product_images = $this->request->post['product_image']; |
1579
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1580
|
|
|
$product_images = $this->model_catalog_product->getProductImages($this->request->get['product_id']); |
1581
|
|
|
} else { |
1582
|
|
|
$product_images = array(); |
1583
|
|
|
} |
1584
|
|
|
|
1585
|
|
|
$data['product_images'] = array(); |
1586
|
|
|
|
1587
|
|
|
foreach ($product_images as $product_image) { |
1588
|
|
|
if (is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $product_image['image'])) { |
1589
|
|
|
$image = $product_image['image']; |
1590
|
|
|
$thumb = $product_image['image']; |
1591
|
|
|
} else { |
1592
|
|
|
$image = ''; |
1593
|
|
|
$thumb = 'no_image.png'; |
1594
|
|
|
} |
1595
|
|
|
|
1596
|
|
|
$data['product_images'][] = array( |
1597
|
|
|
'image' => $image, |
1598
|
|
|
'thumb' => '/public_html/assets/images/' . $thumb, |
1599
|
|
|
'sort_order' => $product_image['sort_order'] |
1600
|
|
|
); |
1601
|
|
|
} |
1602
|
|
|
|
1603
|
|
|
// Downloads |
1604
|
|
|
$this->load->model('catalog/download'); |
1605
|
|
|
|
1606
|
|
|
if (isset($this->request->post['product_download'])) { |
1607
|
|
|
$product_downloads = $this->request->post['product_download']; |
1608
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1609
|
|
|
$product_downloads = $this->model_catalog_product->getProductDownloads($this->request->get['product_id']); |
1610
|
|
|
} else { |
1611
|
|
|
$product_downloads = array(); |
1612
|
|
|
} |
1613
|
|
|
|
1614
|
|
|
$data['product_downloads'] = array(); |
1615
|
|
|
|
1616
|
|
|
foreach ($product_downloads as $download_id) { |
1617
|
|
|
$download_info = $this->model_catalog_download->getDownload($download_id); |
1618
|
|
|
|
1619
|
|
|
if ($download_info) { |
1620
|
|
|
$data['product_downloads'][] = array( |
1621
|
|
|
'download_id' => $download_info['download_id'], |
1622
|
|
|
'name' => $download_info['name'] |
1623
|
|
|
); |
1624
|
|
|
} |
1625
|
|
|
} |
1626
|
|
|
|
1627
|
|
|
if (isset($this->request->post['product_related'])) { |
1628
|
|
|
$products = $this->request->post['product_related']; |
1629
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1630
|
|
|
$products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']); |
1631
|
|
|
} else { |
1632
|
|
|
$products = array(); |
1633
|
|
|
} |
1634
|
|
|
|
1635
|
|
|
$data['product_relateds'] = array(); |
1636
|
|
|
|
1637
|
|
|
foreach ($products as $product_id) { |
1638
|
|
|
$related_info = $this->model_catalog_product->getProduct($product_id); |
1639
|
|
|
|
1640
|
|
|
if ($related_info) { |
1641
|
|
|
$data['product_relateds'][] = array( |
1642
|
|
|
'product_id' => $related_info['product_id'], |
1643
|
|
|
'name' => $related_info['name'] |
1644
|
|
|
); |
1645
|
|
|
} |
1646
|
|
|
} |
1647
|
|
|
|
1648
|
|
|
if (isset($this->request->post['product_related_article'])) { |
1649
|
|
|
$articles = $this->request->post['product_related_article']; |
1650
|
|
|
} elseif (isset($product_info)) { |
1651
|
|
|
$articles = $this->model_catalog_product->getArticleRelated($this->request->get['product_id']); |
1652
|
|
|
} else { |
1653
|
|
|
$articles = array(); |
1654
|
|
|
} |
1655
|
|
|
|
1656
|
|
|
$data['product_related_article'] = array(); |
1657
|
|
|
$this->load->model('blog/article'); |
1658
|
|
|
|
1659
|
|
|
foreach ($articles as $article_id) { |
1660
|
|
|
$article_info = $this->model_blog_article->getArticle($article_id); |
1661
|
|
|
|
1662
|
|
|
if ($article_info) { |
1663
|
|
|
$data['product_related_article'][] = array( |
1664
|
|
|
'article_id' => $article_info['article_id'], |
1665
|
|
|
'name' => $article_info['name'] |
1666
|
|
|
); |
1667
|
|
|
} |
1668
|
|
|
} |
1669
|
|
|
|
1670
|
|
|
if (isset($this->request->post['points'])) { |
1671
|
|
|
$data['points'] = $this->request->post['points']; |
1672
|
|
|
} elseif (!empty($product_info)) { |
1673
|
|
|
$data['points'] = $product_info['points']; |
1674
|
|
|
} else { |
1675
|
|
|
$data['points'] = ''; |
1676
|
|
|
} |
1677
|
|
|
|
1678
|
|
|
if (isset($this->request->post['product_reward'])) { |
1679
|
|
|
$data['product_reward'] = $this->request->post['product_reward']; |
1680
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1681
|
|
|
$data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']); |
1682
|
|
|
} else { |
1683
|
|
|
$data['product_reward'] = array(); |
1684
|
|
|
} |
1685
|
|
|
|
1686
|
|
|
if (isset($this->request->post['product_layout'])) { |
1687
|
|
|
$data['product_layout'] = $this->request->post['product_layout']; |
1688
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1689
|
|
|
$data['product_layout'] = $this->model_catalog_product->getProductLayouts($this->request->get['product_id']); |
1690
|
|
|
} else { |
1691
|
|
|
$data['product_layout'] = array(); |
1692
|
|
|
} |
1693
|
|
|
|
1694
|
|
|
if (isset($this->request->post['product_tab'])) { |
1695
|
|
|
$data['product_tabs'] = $this->request->post['product_tab']; |
1696
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1697
|
|
|
$data['product_tabs'] = $this->model_catalog_product->getProductTabbyProductID($this->request->get['product_id']); |
1698
|
|
|
} else { |
1699
|
|
|
$data['product_tabs'] = array(); |
1700
|
|
|
} |
1701
|
|
|
|
1702
|
|
|
$this->load->model('design/layout'); |
1703
|
|
|
|
1704
|
|
|
$data['layouts'] = $this->model_design_layout->getLayouts(); |
1705
|
|
|
|
1706
|
|
|
$this->load->model('design/sticker'); |
1707
|
|
|
$data['stickers'] = $this->model_design_sticker->getStickersProduct(); |
1708
|
|
|
|
1709
|
|
|
|
1710
|
|
|
$this->load->model('design/benefit'); |
1711
|
|
|
$productbenefits = $this->model_design_benefit->getBenefits(); |
1712
|
|
|
|
1713
|
|
|
$data['benefits'] = array(); |
1714
|
|
|
|
1715
|
|
|
foreach ($productbenefits as $benefit) { |
1716
|
|
|
if ($benefit['image'] && file_exists($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $benefit['image'])) { |
1717
|
|
|
$image = '/public_html/assets/images/' . $benefit['image']; |
1718
|
|
|
} else { |
1719
|
|
|
$image = '/public_html/assets/images/no_image.png'; |
1720
|
|
|
} |
1721
|
|
|
$data['benefits'][] = array( |
1722
|
|
|
'benefit_id' => $benefit['benefit_id'], |
1723
|
|
|
'name' => $benefit['name'], |
1724
|
|
|
'thumb' => $image |
1725
|
|
|
); |
1726
|
|
|
} |
1727
|
|
|
|
1728
|
|
|
|
1729
|
|
|
if (isset($this->request->post['product_benefits'])) { |
1730
|
|
|
$data['product_benefits'] = $this->request->post['product_benefits']; |
1731
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1732
|
|
|
$data['product_benefits'] = $this->model_catalog_product->getBenefits($this->request->get['product_id']); |
1733
|
|
|
} else { |
1734
|
|
|
$data['product_benefits'] = array(); |
1735
|
|
|
} |
1736
|
|
|
|
1737
|
|
|
|
1738
|
|
|
if (isset($this->request->post['product_stickers'])) { |
1739
|
|
|
$data['product_stickers'] = $this->request->post['product_stickers']; |
1740
|
|
|
} elseif (isset($this->request->get['product_id'])) { |
1741
|
|
|
$data['product_stickers'] = $this->model_design_sticker->getProductSticker($this->request->get['product_id']); |
1742
|
|
|
} else { |
1743
|
|
|
$data['product_stickers'] = array(); |
1744
|
|
|
} |
1745
|
|
|
|
1746
|
|
|
$data['header'] = $this->load->controller('common/header'); |
1747
|
|
|
$data['column'] = $this->load->controller('common/column_left'); |
1748
|
|
|
$data['footer'] = $this->load->controller('common/footer'); |
1749
|
|
|
|
1750
|
|
|
$this->response->setOutput($this->load->view('catalog/product_form', $data)); |
1751
|
|
|
} |
1752
|
|
|
|
1753
|
|
|
protected function validateForm() |
1754
|
|
|
{ |
1755
|
|
|
if (!$this->user->hasPermission('modify', 'catalog/product')) { |
1756
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
1757
|
|
|
} |
1758
|
|
|
|
1759
|
|
|
if (isset($this->request->post['product_tab'])) { |
1760
|
|
|
foreach ($this->request->post['product_tab'] as $key => $tab) { |
1761
|
|
|
if ($tab) { |
1762
|
|
|
foreach ($tab['description'] as $language_id => $value) { |
1763
|
|
|
if (empty($value['heading'])) { |
1764
|
|
|
$this->error['tab'][$key][$language_id] = $this->language->get('error_tab'); |
1765
|
|
|
} |
1766
|
|
|
} |
1767
|
|
|
} |
1768
|
|
|
} |
1769
|
|
|
} |
1770
|
|
|
|
1771
|
|
|
foreach ($this->request->post['product_description'] as $language_id => $value) { |
1772
|
|
|
if ((\voku\helper\UTF8::strlen($value['name']) < 3) || (\voku\helper\UTF8::strlen($value['name']) > 255)) { |
1773
|
|
|
$this->error['name'][$language_id] = $this->language->get('error_name'); |
1774
|
|
|
} |
1775
|
|
|
|
1776
|
|
|
if ((\voku\helper\UTF8::strlen($value['meta_title']) < 0) || (\voku\helper\UTF8::strlen($value['meta_title']) > 255)) { |
1777
|
|
|
$this->error['meta_title'][$language_id] = $this->language->get('error_meta_title'); |
1778
|
|
|
} |
1779
|
|
|
|
1780
|
|
|
if ((\voku\helper\UTF8::strlen($value['meta_h1']) < 0) || (\voku\helper\UTF8::strlen($value['meta_h1']) > 255)) { |
1781
|
|
|
$this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1'); |
1782
|
|
|
} |
1783
|
|
|
} |
1784
|
|
|
|
1785
|
|
|
if ((\voku\helper\UTF8::strlen($this->request->post['model']) < 1) || (\voku\helper\UTF8::strlen($this->request->post['model']) > 64)) { |
1786
|
|
|
$this->error['model'] = $this->language->get('error_model'); |
1787
|
|
|
} |
1788
|
|
|
|
1789
|
|
|
if (\voku\helper\UTF8::strlen($this->request->post['keyword']) > 0) { |
1790
|
|
|
$this->load->model('catalog/url_alias'); |
1791
|
|
|
|
1792
|
|
|
$url_alias_info = $this->model_catalog_url_alias->getUrlAlias($this->request->post['keyword']); |
1793
|
|
|
|
1794
|
|
|
if ($url_alias_info && isset($this->request->get['product_id']) && $url_alias_info['query'] != 'product_id=' . $this->request->get['product_id']) { |
1795
|
|
|
$this->error['keyword'] = sprintf($this->language->get('error_keyword')); |
1796
|
|
|
} |
1797
|
|
|
|
1798
|
|
|
if ($url_alias_info && !isset($this->request->get['product_id'])) { |
1799
|
|
|
$this->error['keyword'] = sprintf($this->language->get('error_keyword')); |
1800
|
|
|
} |
1801
|
|
|
} |
1802
|
|
|
|
1803
|
|
|
if ($this->error && !isset($this->error['warning'])) { |
|
|
|
|
1804
|
|
|
$this->error['warning'] = $this->language->get('error_warning'); |
1805
|
|
|
} |
1806
|
|
|
|
1807
|
|
|
return !$this->error; |
1808
|
|
|
} |
1809
|
|
|
|
1810
|
|
|
public function enable() |
1811
|
|
|
{ |
1812
|
|
|
$this->load->language('catalog/product'); |
1813
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
1814
|
|
|
$this->load->model('catalog/product'); |
1815
|
|
|
if (isset($this->request->post['selected'])) { |
1816
|
|
|
foreach ($this->request->post['selected'] as $product_id) { |
1817
|
|
|
$this->model_catalog_product->editProductStatus($product_id, 1); |
1818
|
|
|
} |
1819
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
1820
|
|
|
$url = ''; |
1821
|
|
|
if (isset($this->request->get['page'])) { |
1822
|
|
|
$url .= '&page=' . $this->request->get['page']; |
1823
|
|
|
} |
1824
|
|
|
if (isset($this->request->get['sort'])) { |
1825
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
1826
|
|
|
} |
1827
|
|
|
if (isset($this->request->get['order'])) { |
1828
|
|
|
$url .= '&order=' . $this->request->get['order']; |
1829
|
|
|
} |
1830
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
1831
|
|
|
} |
1832
|
|
|
$this->getList(); |
1833
|
|
|
} |
1834
|
|
|
public function disable() |
1835
|
|
|
{ |
1836
|
|
|
$this->load->language('catalog/product'); |
1837
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
1838
|
|
|
$this->load->model('catalog/product'); |
1839
|
|
|
if (isset($this->request->post['selected'])) { |
1840
|
|
|
foreach ($this->request->post['selected'] as $product_id) { |
1841
|
|
|
$this->model_catalog_product->editProductStatus($product_id, 0); |
1842
|
|
|
} |
1843
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
1844
|
|
|
$url = ''; |
1845
|
|
|
if (isset($this->request->get['page'])) { |
1846
|
|
|
$url .= '&page=' . $this->request->get['page']; |
1847
|
|
|
} |
1848
|
|
|
if (isset($this->request->get['sort'])) { |
1849
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
1850
|
|
|
} |
1851
|
|
|
if (isset($this->request->get['order'])) { |
1852
|
|
|
$url .= '&order=' . $this->request->get['order']; |
1853
|
|
|
} |
1854
|
|
|
$this->response->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, true)); |
1855
|
|
|
} |
1856
|
|
|
$this->getList(); |
1857
|
|
|
} |
1858
|
|
|
|
1859
|
|
|
protected function validateDelete() |
1860
|
|
|
{ |
1861
|
|
|
if (!$this->user->hasPermission('modify', 'catalog/product')) { |
1862
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
1863
|
|
|
} |
1864
|
|
|
|
1865
|
|
|
return !$this->error; |
1866
|
|
|
} |
1867
|
|
|
|
1868
|
|
|
protected function validateCopy() |
1869
|
|
|
{ |
1870
|
|
|
if (!$this->user->hasPermission('modify', 'catalog/product')) { |
1871
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
1872
|
|
|
} |
1873
|
|
|
|
1874
|
|
|
return !$this->error; |
1875
|
|
|
} |
1876
|
|
|
|
1877
|
|
|
public function autocomplete() |
1878
|
|
|
{ |
1879
|
|
|
$json = array(); |
1880
|
|
|
|
1881
|
|
|
if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model'])) { |
1882
|
|
|
$this->load->model('catalog/product'); |
1883
|
|
|
$this->load->model('catalog/option'); |
1884
|
|
|
|
1885
|
|
|
if (isset($this->request->get['filter_name'])) { |
1886
|
|
|
$filter_name = $this->request->get['filter_name']; |
1887
|
|
|
} else { |
1888
|
|
|
$filter_name = ''; |
1889
|
|
|
} |
1890
|
|
|
|
1891
|
|
|
if (isset($this->request->get['filter_model'])) { |
1892
|
|
|
$filter_model = $this->request->get['filter_model']; |
1893
|
|
|
} else { |
1894
|
|
|
$filter_model = ''; |
1895
|
|
|
} |
1896
|
|
|
|
1897
|
|
|
if (isset($this->request->get['limit'])) { |
1898
|
|
|
$limit = $this->request->get['limit']; |
1899
|
|
|
} else { |
1900
|
|
|
$limit = 5; |
1901
|
|
|
} |
1902
|
|
|
|
1903
|
|
|
$filter_data = array( |
1904
|
|
|
'filter_name' => $filter_name, |
1905
|
|
|
'filter_model' => $filter_model, |
1906
|
|
|
'start' => 0, |
1907
|
|
|
'limit' => $limit |
1908
|
|
|
); |
1909
|
|
|
|
1910
|
|
|
$results = $this->model_catalog_product->getProducts($filter_data); |
1911
|
|
|
|
1912
|
|
|
foreach ($results as $result) { |
1913
|
|
|
$option_data = array(); |
1914
|
|
|
|
1915
|
|
|
$product_options = $this->model_catalog_product->getProductOptions($result['product_id']); |
1916
|
|
|
|
1917
|
|
|
foreach ($product_options as $product_option) { |
1918
|
|
|
$option_info = $this->model_catalog_option->getOption($product_option['option_id']); |
1919
|
|
|
|
1920
|
|
|
if ($option_info) { |
1921
|
|
|
$product_option_value_data = array(); |
1922
|
|
|
|
1923
|
|
|
foreach ($product_option['product_option_value'] as $product_option_value) { |
1924
|
|
|
$option_value_info = $this->model_catalog_option->getOptionValue($product_option_value['option_value_id']); |
1925
|
|
|
|
1926
|
|
|
if ($option_value_info) { |
1927
|
|
|
$product_option_value_data[] = array( |
1928
|
|
|
'product_option_value_id' => $product_option_value['product_option_value_id'], |
1929
|
|
|
'option_value_id' => $product_option_value['option_value_id'], |
1930
|
|
|
'name' => $option_value_info['name'], |
1931
|
|
|
'price' => (float)$product_option_value['price'] ? $this->currency->format($product_option_value['price'], $this->config->get('config_currency')) : false, |
1932
|
|
|
'price_prefix' => $product_option_value['price_prefix'] |
1933
|
|
|
); |
1934
|
|
|
} |
1935
|
|
|
} |
1936
|
|
|
|
1937
|
|
|
$option_data[] = array( |
1938
|
|
|
'product_option_id' => $product_option['product_option_id'], |
1939
|
|
|
'product_option_value' => $product_option_value_data, |
1940
|
|
|
'option_id' => $product_option['option_id'], |
1941
|
|
|
'name' => $option_info['name'], |
1942
|
|
|
'type' => $option_info['type'], |
1943
|
|
|
'value' => $product_option['value'], |
1944
|
|
|
'required' => $product_option['required'] |
1945
|
|
|
); |
1946
|
|
|
} |
1947
|
|
|
} |
1948
|
|
|
|
1949
|
|
|
$json[] = array( |
1950
|
|
|
'product_id' => $result['product_id'], |
1951
|
|
|
'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')), |
1952
|
|
|
'model' => $result['model'], |
1953
|
|
|
'option' => $option_data, |
1954
|
|
|
'price' => $result['price'] |
1955
|
|
|
); |
1956
|
|
|
} |
1957
|
|
|
} |
1958
|
|
|
|
1959
|
|
|
$this->response->addHeader('Content-Type: application/json'); |
1960
|
|
|
$this->response->setOutput(json_encode($json)); |
1961
|
|
|
} |
1962
|
|
|
} |
1963
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.