Projekt

Allgemein

Profil

GX-Bug #62990 » AdminSearchFix1.patch

Till Tepelmann, 26.06.2019 18:57

Unterschiede anzeigen:

src/admin/includes/modules/categories_view.php (date 1561568084000)
1 1
<?php
2 2
/* --------------------------------------------------------------
3
   categories_view.php 2018-06-15
3
   categories_view.php 2019-06-26
4 4
   Gambio GmbH
5 5
   http://www.gambio.de
6
   Copyright (c) 2018 Gambio GmbH
6
   Copyright (c) 2019 Gambio GmbH
7 7
   Released under the GNU General Public License (Version 2)
8 8
   [http://www.gnu.org/licenses/gpl-2.0.html]
9 9
   --------------------------------------------------------------
......
24 24

  
25 25
   Released under the GNU General Public License
26 26
   --------------------------------------------------------------*/
27
 defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
27
defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
28 28

  
29 29
require_once(DIR_FS_INC . 'xtc_get_parent_categories.inc.php');
30 30
require_once(DIR_FS_INC . 'xtc_get_category_path.inc.php');
31 31

  
32
 $t_page_token = $_SESSION['coo_page_token']->generate_token();
32
$t_page_token = $_SESSION['coo_page_token']->generate_token();
33 33

  
34 34
$coo_admin_categories_overview_extender = MainFactory::create_object('AdminCategoriesOverviewExtenderComponent');
35 35
$coo_admin_categories_overview_extender->set_data('GET', $_GET);
36 36
$coo_admin_categories_overview_extender->set_data('POST', $_POST);
37 37
$coo_admin_categories_overview_extender->proceed();
38 38

  
39
    // get sorting option and switch accordingly
40
    if ($_GET['sorting']) {
39
// get sorting option and switch accordingly
40
if ($_GET['sorting']) {
41 41
    switch ($_GET['sorting']){
42 42
        case 'sort'         :
43 43
            $catsort    = 'c.sort_order ASC';
......
46 46
        case 'sort-desc'    :
47 47
            $catsort    = 'c.sort_order DESC';
48 48
            $prodsort   = 'p.products_sort DESC';
49
	        break;
49
            break;
50 50
        case 'name'         :
51 51
            $catsort    = 'cd.categories_name ASC';
52
            $prodsort   = 'pd.products_name ASC';
52
            $prodsort   = 'p.products_name ASC';
53 53
            break;
54 54
        case 'name-desc'    :
55 55
            $catsort    = 'cd.categories_name DESC';
56
            $prodsort   = 'pd.products_name DESC';
56
            $prodsort   = 'p.products_name DESC';
57 57
            break;
58 58
        case 'status'       :
59 59
            $catsort    = 'c.categories_status ASC';
......
63 63
            $catsort    = 'c.categories_status DESC';
64 64
            $prodsort   = 'p.products_status DESC';
65 65
            break;
66
	    case 'startpage'       :
67
		    $catsort    = 'c.sort_order ASC'; //default
68
		    $prodsort   = 'p.products_startpage ASC';
69
		    break;
70
	    case 'startpage-desc'  :
71
		    $catsort    = 'c.sort_order DESC'; //default
72
		    $prodsort   = 'p.products_startpage DESC';
73
		    break;
66
        case 'startpage'       :
67
            $catsort    = 'c.sort_order ASC'; //default
68
            $prodsort   = 'p.products_startpage ASC';
69
            break;
70
        case 'startpage-desc'  :
71
            $catsort    = 'c.sort_order DESC'; //default
72
            $prodsort   = 'p.products_startpage DESC';
73
            break;
74 74
        case 'price'        :
75 75
            $catsort    = 'c.sort_order ASC'; //default
76 76
            $prodsort   = 'p.products_price ASC';
......
105 105
            break;
106 106
        default             :
107 107
            $catsort    = 'cd.categories_name ASC';
108
            $prodsort   = 'pd.products_name ASC';
108
            $prodsort   = 'p.products_name ASC';
109 109
            break;
110 110
    }
111
    } else {
112
            $catsort    = 'c.sort_order, cd.categories_name ASC';
113
            $prodsort   = 'p.products_sort, pd.products_name ASC';
114
    }
111
} else {
112
    $catsort    = 'c.sort_order, cd.categories_name ASC';
113
    $prodsort   = 'p.products_sort, p.products_name ASC';
114
}
115 115

  
116 116
/**
117 117
 * Sets default configuration value of product and category dropdown button.
......
119 119
$userConfigurationService         = StaticGXCoreLoader::getService('UserConfiguration');
120 120
$userId                           = new IdType((int)$_SESSION['customer_id']);
121 121
$productOverviewDropdownBtn       = $userConfigurationService->getUserConfiguration($userId,
122
                                                                                    'productOverviewDropdownBtn');
122
    'productOverviewDropdownBtn');
123 123
$categoryOverviewDropdownBtn      = $userConfigurationService->getUserConfiguration($userId,
124
                                                                                    'categoryOverviewDropdownBtn');
124
    'categoryOverviewDropdownBtn');
125 125
$multiCategoryOverviewDropdownBtn = $userConfigurationService->getUserConfiguration($userId,
126
                                                                                    'multiCategoryOverviewDropdownBtn');
126
    'multiCategoryOverviewDropdownBtn');
127 127

  
128 128
/**
129 129
 * Get Caret
......
139 139
 */
140 140
function _getCaret($elementName)
141 141
{
142
	$caretInformation = array();
143
	$caretInformation['activeCaret'] = 'false';
144
	$caretInformation['sortingDirection'] = 'asc';
145

  
146
	// By default the table is sorted by the sort column
147
	if($elementName === 'sort' && !isset($_GET['sorting']))
148
	{
149
		$caretInformation['activeCaret'] = 'true';
150
	}
151
	else if($_GET['sorting'] === $elementName . '-desc')
152
	{
153
		$caretInformation['sortingDirection'] = 'desc';
154
		$caretInformation['activeCaret'] = 'true';
155
	}
156
	else if($_GET['sorting'] === $elementName)
157
	{
158
		$caretInformation['activeCaret'] = 'true';
159
	}
160

  
161
	return $caretInformation;
142
    $caretInformation = array();
143
    $caretInformation['activeCaret'] = 'false';
144
    $caretInformation['sortingDirection'] = 'asc';
145
    
146
    // By default the table is sorted by the sort column
147
    if($elementName === 'sort' && !isset($_GET['sorting']))
148
    {
149
        $caretInformation['activeCaret'] = 'true';
150
    }
151
    else if($_GET['sorting'] === $elementName . '-desc')
152
    {
153
        $caretInformation['sortingDirection'] = 'desc';
154
        $caretInformation['activeCaret'] = 'true';
155
    }
156
    else if($_GET['sorting'] === $elementName)
157
    {
158
        $caretInformation['activeCaret'] = 'true';
159
    }
160
    
161
    return $caretInformation;
162 162
}
163 163

  
164 164
/**
......
168 168
    isset($_POST['number_of_products_per_page'])
169 169
    && is_numeric($_POST['number_of_products_per_page'])
170 170
) {
171
	gm_set_conf('NUMBER_OF_PRODUCTS_PER_PAGE', $_POST['number_of_products_per_page']);
171
    gm_set_conf('NUMBER_OF_PRODUCTS_PER_PAGE', $_POST['number_of_products_per_page']);
172 172
}
173 173
?>
174 174

  
175
    <!-- categories_view HTML part begin -->
175
<!-- categories_view HTML part begin -->
176 176
<!--[if lte IE 8]>
177
	<style type="text/css">
178
		.lightbox_package{
179
			position: absolute;
180
			width: 100%;
181
			height: 100%;
182
		}
183

  
184
		.lightbox_shadow{
185
			position: absolute;
186
			width: 100%;
187
			height: 100%;
188
		}
189

  
190
		.lightbox_package .lightbox_border_top,
191
		.lightbox_package .lightbox_border_bottom{
192
			display: none;
193
		}
194

  
195
		.lightbox_package .google_category_save{
196
			height: 32px;
197
		}
198
	</style>
177
<style type="text/css">
178
	.lightbox_package{
179
		position: absolute;
180
		width: 100%;
181
		height: 100%;
182
	}
183
	
184
	.lightbox_shadow{
185
		position: absolute;
186
		width: 100%;
187
		height: 100%;
188
	}
189
	
190
	.lightbox_package .lightbox_border_top,
191
	.lightbox_package .lightbox_border_bottom{
192
		display: none;
193
	}
194
	
195
	.lightbox_package .google_category_save{
196
		height: 32px;
197
	}
198
</style>
199 199
<![endif]-->
200 200

  
201 201
<table width="100%" cellspacing="0" cellpadding="0" class="gx-categories breakpoint-large"
202 202
       data-gx-widget="button_dropdown"
203 203
       data-button_dropdown-user_id="<?php echo (int)$_SESSION['customer_id']; ?>"
204 204
>
205
    <tr>
206
     <td>
207
		<div class="pageHeading" style="float:left; background-image:url(html/assets/images/legacy/gm_icons/artkatalog.png)">
208
			<?php
209
				echo HEADING_TITLE;
210

  
211
				if(isset($_GET['cPath']))
212
				{
213
					/** @var CategoryReadService $categoryReadService */
214
					$categoryReadService = StaticGXCoreLoader::getService('CategoryRead');
215
					$categoryIds         = explode('_', $_GET['cPath']);
216
					$categoryNames       = array();
217

  
218
					foreach($categoryIds as $categoryId)
219
					{
220
						try
221
						{
222
							$category        = $categoryReadService->getCategoryById(new IdType((int)$categoryId));
223
							$categoryNames[] = $category->getName(new LanguageCode(new NonEmptyStringType($_SESSION['language_code'])));
224
						}
225
						catch(Exception $e)
226
						{
227
							// ignore
228
						}
229
					}
230

  
231
					if(count($categoryNames))
232
					{
233
						echo ': ' . implode(' > ', $categoryNames);
234
					}
235
				}
236

  
237
			?>
238
		</div>
239

  
240
	     <div class="gx-container create-new-wrapper">
241
		     <div class="create-new-container pull-right">
242
			     <div
243
				     data-use-button_dropdown="true"
244
				     data-custom_caret_btn_class="btn-success"
245
			     >
246
				     <button data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_product') ?>" class="btn btn-success"><i class="fa fa-plus btn-icon"></i>
247
					     <?php echo $GLOBALS['languageTextManager']->get_text('create', 'buttons'); ?>
248
				     </button>
249
				     <ul>
250
					     <li><span data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_product') ?>"><?php echo HEADING_NAME; ?></span></li>
251
					     <li><span data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_category') ?>"><?php echo HEADING_CATEGORY; ?></span></li>
252
				     </ul>
253
			     </div>
254
		     </div>
255
	     </div>
256
     </td>
257
    </tr>
258
    <tr>
259
     <td>
260
        <table data-gx-widget="table_sorting" border="0" width="100%" cellspacing="0" cellpadding="0">
261
        <tr>
262
         <!-- categories & products column STARTS -->
263
         <td valign="top">
264
            <!-- categories and products table -->
265
	         <table border="0"
266
	                width="100%"
267
	                cellspacing="0"
268
	                cellpadding="0"
269
	                class="gx-compatibility-table gx-categories-table"
270
	                data-gx-compatibility="categories/categories_table_controller row_selection"
271
	                data-gx-extension="toolbar_icons visibility_switcher"
272
	                data-toolbar_icons-large="true"
273
	                data-toolbar_icons-fixedwidth="true"
274
	                data-visibility_switcher-selections="div.action-list">
275
	         <tr class="dataTableHeadingRow">
276
             <td class="dataTableHeadingContent" align="center" style="width: 13px">
277
                 <input type="checkbox" id="gm_check" />
278
             </td>
279

  
280
			 <?php
281
			 $sortCaret = _getCaret('sort');
282
			 ?>
283
             <td class="dataTableHeadingContent cursor-pointer"
284
                 data-use-table_sorting="true"
285
                 data-section="categories"
286
                 data-column="sort"
287
                 data-direction="<?php echo $sortCaret['sortingDirection']; ?>"
288
                 data-active-caret="<?php echo $sortCaret['activeCaret']; ?>"
289
                 align="center" style="width: 125px">
290
                <?php
291
                echo TABLE_HEADING_SORT;
292
                ?>
293
             </td>
294

  
295
			 <?php
296
			 $nameCaret = _getCaret('name');
297
			 ?>
298
             <td class="dataTableHeadingContent cursor-pointer"
299
                 data-use-table_sorting="true"
300
                 data-section="categories"
301
                 data-column="name"
302
                 data-direction="<?php echo $nameCaret['sortingDirection']; ?>"
303
                 data-active-caret="<?php echo $nameCaret['activeCaret']; ?>"
304
                 align="center"
305
                 style="width: 300px">
306
                <?php
307
                echo TABLE_HEADING_CATEGORIES_PRODUCTS;
308
                ?>
309
             </td>
310

  
311
			 <?php
312
			 $modelCaret = _getCaret('model');
313
			 ?>
314
             <td class="dataTableHeadingContent cursor-pointer"
315
                 data-use-table_sorting="true"
316
                 data-section="categories"
317
                 data-column="model"
318
                 data-direction="<?php echo $modelCaret['sortingDirection']; ?>"
319
                 data-active-caret="<?php echo $modelCaret['activeCaret']; ?>"
320
				 align="center"
321
				 style="width: 150px">
322
                <?php
323
                echo TABLE_HEADING_PRODUCTS_MODEL;
324
                ?>
325
             </td>
326

  
327
             <?php
328
             $stockCaret = _getCaret('stock');
329

  
330
             // check Produkt and attributes stock
331
             if (STOCK_CHECK == 'true') {
332
                 echo '<td class="dataTableHeadingContent cursor-pointer"
205
	<tr>
206
		<td>
207
			<div class="pageHeading" style="float:left; background-image:url(html/assets/images/legacy/gm_icons/artkatalog.png)">
208
                <?php
209
                echo HEADING_TITLE;
210
                
211
                if(isset($_GET['cPath']))
212
                {
213
                    /** @var CategoryReadService $categoryReadService */
214
                    $categoryReadService = StaticGXCoreLoader::getService('CategoryRead');
215
                    $categoryIds         = explode('_', $_GET['cPath']);
216
                    $categoryNames       = array();
217
                    
218
                    foreach($categoryIds as $categoryId)
219
                    {
220
                        try
221
                        {
222
                            $category        = $categoryReadService->getCategoryById(new IdType((int)$categoryId));
223
                            $categoryNames[] = $category->getName(new LanguageCode(new NonEmptyStringType($_SESSION['language_code'])));
224
                        }
225
                        catch(Exception $e)
226
                        {
227
                            // ignore
228
                        }
229
                    }
230
                    
231
                    if(count($categoryNames))
232
                    {
233
                        echo ': ' . implode(' > ', $categoryNames);
234
                    }
235
                }
236
                
237
                ?>
238
			</div>
239
			
240
			<div class="gx-container create-new-wrapper">
241
				<div class="create-new-container pull-right">
242
					<div
243
						data-use-button_dropdown="true"
244
						data-custom_caret_btn_class="btn-success"
245
					>
246
						<button data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_product') ?>" class="btn btn-success"><i class="fa fa-plus btn-icon"></i>
247
                            <?php echo $GLOBALS['languageTextManager']->get_text('create', 'buttons'); ?>
248
						</button>
249
						<ul>
250
							<li><span data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_product') ?>"><?php echo HEADING_NAME; ?></span></li>
251
							<li><span data-gx-extension="link" data-link-url="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&action=new_category') ?>"><?php echo HEADING_CATEGORY; ?></span></li>
252
						</ul>
253
					</div>
254
				</div>
255
			</div>
256
		</td>
257
	</tr>
258
	<tr>
259
		<td>
260
			<table data-gx-widget="table_sorting" border="0" width="100%" cellspacing="0" cellpadding="0">
261
				<tr>
262
					<!-- categories & products column STARTS -->
263
					<td valign="top">
264
						<!-- categories and products table -->
265
						<table border="0"
266
						       width="100%"
267
						       cellspacing="0"
268
						       cellpadding="0"
269
						       class="gx-compatibility-table gx-categories-table"
270
						       data-gx-compatibility="categories/categories_table_controller row_selection"
271
						       data-gx-extension="toolbar_icons visibility_switcher"
272
						       data-toolbar_icons-large="true"
273
						       data-toolbar_icons-fixedwidth="true"
274
						       data-visibility_switcher-selections="div.action-list">
275
							<tr class="dataTableHeadingRow">
276
								<td class="dataTableHeadingContent" align="center" style="width: 13px">
277
									<input type="checkbox" id="gm_check" />
278
								</td>
279
                                
280
                                <?php
281
                                $sortCaret = _getCaret('sort');
282
                                ?>
283
								<td class="dataTableHeadingContent cursor-pointer"
284
								    data-use-table_sorting="true"
285
								    data-section="categories"
286
								    data-column="sort"
287
								    data-direction="<?php echo $sortCaret['sortingDirection']; ?>"
288
								    data-active-caret="<?php echo $sortCaret['activeCaret']; ?>"
289
								    align="center" style="width: 125px">
290
                                    <?php
291
                                    echo TABLE_HEADING_SORT;
292
                                    ?>
293
								</td>
294
                                
295
                                <?php
296
                                $nameCaret = _getCaret('name');
297
                                ?>
298
								<td class="dataTableHeadingContent cursor-pointer"
299
								    data-use-table_sorting="true"
300
								    data-section="categories"
301
								    data-column="name"
302
								    data-direction="<?php echo $nameCaret['sortingDirection']; ?>"
303
								    data-active-caret="<?php echo $nameCaret['activeCaret']; ?>"
304
								    align="center"
305
								    style="width: 300px">
306
                                    <?php
307
                                    echo TABLE_HEADING_CATEGORIES_PRODUCTS;
308
                                    ?>
309
								</td>
310
                                
311
                                <?php
312
                                $modelCaret = _getCaret('model');
313
                                ?>
314
								<td class="dataTableHeadingContent cursor-pointer"
315
								    data-use-table_sorting="true"
316
								    data-section="categories"
317
								    data-column="model"
318
								    data-direction="<?php echo $modelCaret['sortingDirection']; ?>"
319
								    data-active-caret="<?php echo $modelCaret['activeCaret']; ?>"
320
								    align="center"
321
								    style="width: 150px">
322
                                    <?php
323
                                    echo TABLE_HEADING_PRODUCTS_MODEL;
324
                                    ?>
325
								</td>
326
                                
327
                                <?php
328
                                $stockCaret = _getCaret('stock');
329
                                
330
                                // check Produkt and attributes stock
331
                                if (STOCK_CHECK == 'true') {
332
                                    echo '<td class="dataTableHeadingContent cursor-pointer"
333 333
                 data-use-table_sorting="true"
334 334
                 data-section="categories"
335 335
                 data-column="stock"
336 336
                 data-direction="' . $stockCaret['sortingDirection'] . '"
337 337
                 data-active-caret="' . $stockCaret['activeCaret'] . '"
338 338
                 align="center" style="width: 85px">' . TEXT_STOCK . '</td>';
339
             }
340
             ?>
341

  
342
			 <?php
343
			 $statusCaret = _getCaret('status');
344
			 ?>
345
             <td class="dataTableHeadingContent cursor-pointer"
346
                 data-use-table_sorting="true"
347
                 data-section="categories"
348
                 data-column="status"
349
                 data-direction="<?php echo $statusCaret['sortingDirection']; ?>"
350
                 data-active-caret="<?php echo $statusCaret['activeCaret']; ?>"
351
				 align="center"
352
		         style="width: 60px">
353
                <?php
354
                echo TABLE_HEADING_STATUS;
355
                ?>
356
             </td>
357

  
358
			 <?php
359
			 $startPageCaret = _getCaret('startpage');
360
			 ?>
361
             <td class="dataTableHeadingContent cursor-pointer"
362
                 data-use-table_sorting="true"
363
                 data-section="categories"
364
                 data-column="startpage"
365
                 data-direction="<?php echo $startPageCaret['sortingDirection']; ?>"
366
                 data-active-caret="<?php echo $startPageCaret['activeCaret']; ?>"
367
                 align="center"
368
                 style="width: 75px">
369
                <?php echo
370
                TABLE_HEADING_STARTPAGE;
371
                ?>
372
             </td>
373

  
374
			 <?php
375
			 $priceCaret = _getCaret('price');
376
			 ?>
377
             <td class="dataTableHeadingContent cursor-pointer"
378
                 data-use-table_sorting="true"
379
                 data-section="categories"
380
                 data-column="price"
381
                 data-direction="<?php echo $priceCaret['sortingDirection']; ?>"
382
                 data-active-caret="<?php echo $priceCaret['activeCaret']; ?>"
383
				 align="center"
384
				 style="width: 120px">
385
                <?php
386
                echo TABLE_HEADING_PRICE;
387
                ?>
388
             </td>
389

  
390
			 <?php
391
			 $discountCaret = _getCaret('discount');
392
			 ?>
393
             <td class="dataTableHeadingContent cursor-pointer"
394
                 data-use-table_sorting="true"
395
                 data-section="categories"
396
                 data-column="discount"
397
                 data-direction="<?php echo $discountCaret['sortingDirection']; ?>"
398
                 data-active-caret="<?php echo $discountCaret['activeCaret']; ?>"
399
                 align="center"
400
                 style="width: 65px">
401
                <?php
402
                echo TABLE_HEADING_MAX;
403
                ?>
404
             </td>
405
             <td class="dataTableHeadingContent" align="center" style="min-width: 215px">
406
               &nbsp;
407
             </td>
408
            </tr>
409

  
410
            <tr class="dataTableHeadingRow_sortbar">
411
             <td class="dataTableHeadingContent_sortbar" width="5%" align="center">
412
                <input type="checkbox" onClick="javascript:CheckAll(this.checked);">
413
             </td>
414
             <td class="dataTableHeadingContent_sortbar" align="center" width="7%">
415
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'sort'); ?>
416
             </td>
417
             <td class="dataTableHeadingContent_sortbar" align="center" width="25%">
418
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'name'); ?>
419
             </td>
420
             <td class="dataTableHeadingContent_sortbar" align="center" width="10%">
421
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'model'); ?>
422
             </td>
423
             <?php
424
             // check Produkt and attributes stock
425
             if (STOCK_CHECK == 'true') {
426
                    echo '<td class="dataTableHeadingContent_sortbar" align="center" width="15%">' . xtc_sorting(FILENAME_CATEGORIES,'stock') . '</td>';
427
             }
428
             ?>
429
             <td class="dataTableHeadingContent_sortbar" align="center" width="7%">
430
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'status'); ?>
431
             </td>
432
             <td class="dataTableHeadingContent_sortbar" align="center" width="7%">
433
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'startpage'); ?>
434
             </td>
435
             <td class="dataTableHeadingContent_sortbar" align="center" width="10%">
436
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'price'); ?>
437
             </td>
438
             <td class="dataTableHeadingContent_sortbar" align="center" width="7%">
439
                <?php echo xtc_sorting(FILENAME_CATEGORIES,'discount'); ?>
440
             </td>
441
             <td class="dataTableHeadingContent_sortbar" align="center" width="13%"></td>
442
            </tr>
443

  
444
    <?php
445

  
446
    //multi-actions form STARTS
447
    if (xtc_not_null($_POST['multi_categories']) || xtc_not_null($_POST['multi_products'])) {
448
        $action = "action=multi_action_confirm&" . xtc_get_all_get_params(array('cPath', 'action')) . 'cPath=' . $cPath;
449
    } else {
450
        $action = "action=multi_action&" . xtc_get_all_get_params(array('cPath', 'action')) . 'cPath=' . $cPath;
451
    }
452
    // echo xtc_draw_form('multi_action_form', FILENAME_CATEGORIES, $action, 'post', 'onsubmit="javascript:return CheckMultiForm()"');
453
    //add current category id in $_POST
454
    echo '<input type="hidden" id="cPath" name="cPath" value="' . $cPath . '">';
455

  
456
// ----------------------------------------------------------------------------------------------------- //
457
// WHILE loop to display categories STARTS
458
// ----------------------------------------------------------------------------------------------------- //
459

  
460
    $categories_count = 0;
461
    $rows = 0;
462
    if ($_GET['search']) {
463
      $keyword = trim(str_replace('*', '%', $_GET['search']));
464
      $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and cd.categories_name like '" . xtc_db_input($keyword) . "' order by " . $catsort);
465
	
466
	    // check of num rows = 0, if so, then start another search with: cd.categories_name like '%" . xtc_db_input($keyword) . "%'
467
	    if(xtc_db_num_rows($categories_query) === 0)
468
	    {
469
		    $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and cd.categories_name like '%" . xtc_db_input($keyword) . "%' order by " . $catsort);
470
	    }
471
	    
472
    } else {
473
      $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by " . $catsort);
474
    }
475

  
476
	$tmp_c_path = false;
477

  
478
    while ($categories = xtc_db_fetch_array($categories_query)) {
479

  
480
        $categories_count++;
481
        $rows++;
482

  
483
        if ($_GET['search'])
484
		{
485
			$cPath = xtc_get_category_path($categories['parent_id']);
486
			if($tmp_c_path === false)
487
			{
488
				$tmp_c_path = $cPath;
489
			}
490
		}
491
        if ( ((!$_GET['cID']) && (!$_GET['pID']) || (@$_GET['cID'] == $categories['categories_id'])) && (!$cInfo) && (substr($_GET['action'], 0, 4) != 'new_') ) {
492
            $cInfo = new objectInfo($categories);
493
        }
494
    ?>
495
        <tr class="dataTableRow visibility_switcher row_selection"
496
            data-id="<?php echo $categories['categories_id'] ?>"
497
            data-cpath="<?php echo $cPath ?>"
498
            data-is-product="false"
499
        >
500
             <td class="categories_view_data"><input type="checkbox" class="checkbox" name="multi_categories[]" value="<?php echo $categories['categories_id'] . '" '; if (is_array($_POST['multi_categories'])) { if (in_array($categories['categories_id'], $_POST['multi_categories'])) { echo 'checked="checked"'; } } ?>></td>
339
                                }
340
                                ?>
341
                                
342
                                <?php
343
                                $statusCaret = _getCaret('status');
344
                                ?>
345
								<td class="dataTableHeadingContent cursor-pointer"
346
								    data-use-table_sorting="true"
347
								    data-section="categories"
348
								    data-column="status"
349
								    data-direction="<?php echo $statusCaret['sortingDirection']; ?>"
350
								    data-active-caret="<?php echo $statusCaret['activeCaret']; ?>"
351
								    align="center"
352
								    style="width: 60px">
353
                                    <?php
354
                                    echo TABLE_HEADING_STATUS;
355
                                    ?>
356
								</td>
357
                                
358
                                <?php
359
                                $startPageCaret = _getCaret('startpage');
360
                                ?>
361
								<td class="dataTableHeadingContent cursor-pointer"
362
								    data-use-table_sorting="true"
363
								    data-section="categories"
364
								    data-column="startpage"
365
								    data-direction="<?php echo $startPageCaret['sortingDirection']; ?>"
366
								    data-active-caret="<?php echo $startPageCaret['activeCaret']; ?>"
367
								    align="center"
368
								    style="width: 75px">
369
                                    <?php echo
370
                                    TABLE_HEADING_STARTPAGE;
371
                                    ?>
372
								</td>
373
                                
374
                                <?php
375
                                $priceCaret = _getCaret('price');
376
                                ?>
377
								<td class="dataTableHeadingContent cursor-pointer"
378
								    data-use-table_sorting="true"
379
								    data-section="categories"
380
								    data-column="price"
381
								    data-direction="<?php echo $priceCaret['sortingDirection']; ?>"
382
								    data-active-caret="<?php echo $priceCaret['activeCaret']; ?>"
383
								    align="center"
384
								    style="width: 120px">
385
                                    <?php
386
                                    echo TABLE_HEADING_PRICE;
387
                                    ?>
388
								</td>
389
                                
390
                                <?php
391
                                $discountCaret = _getCaret('discount');
392
                                ?>
393
								<td class="dataTableHeadingContent cursor-pointer"
394
								    data-use-table_sorting="true"
395
								    data-section="categories"
396
								    data-column="discount"
397
								    data-direction="<?php echo $discountCaret['sortingDirection']; ?>"
398
								    data-active-caret="<?php echo $discountCaret['activeCaret']; ?>"
399
								    align="center"
400
								    style="width: 65px">
401
                                    <?php
402
                                    echo TABLE_HEADING_MAX;
403
                                    ?>
404
								</td>
405
								<td class="dataTableHeadingContent" align="center" style="min-width: 215px">
406
									&nbsp;
407
								</td>
408
							</tr>
409
							
410
							<tr class="dataTableHeadingRow_sortbar">
411
								<td class="dataTableHeadingContent_sortbar" width="5%" align="center">
412
									<input type="checkbox" onClick="javascript:CheckAll(this.checked);">
413
								</td>
414
								<td class="dataTableHeadingContent_sortbar" align="center" width="7%">
415
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'sort'); ?>
416
								</td>
417
								<td class="dataTableHeadingContent_sortbar" align="center" width="25%">
418
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'name'); ?>
419
								</td>
420
								<td class="dataTableHeadingContent_sortbar" align="center" width="10%">
421
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'model'); ?>
422
								</td>
423
                                <?php
424
                                // check Produkt and attributes stock
425
                                if (STOCK_CHECK == 'true') {
426
                                    echo '<td class="dataTableHeadingContent_sortbar" align="center" width="15%">' . xtc_sorting(FILENAME_CATEGORIES,'stock') . '</td>';
427
                                }
428
                                ?>
429
								<td class="dataTableHeadingContent_sortbar" align="center" width="7%">
430
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'status'); ?>
431
								</td>
432
								<td class="dataTableHeadingContent_sortbar" align="center" width="7%">
433
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'startpage'); ?>
434
								</td>
435
								<td class="dataTableHeadingContent_sortbar" align="center" width="10%">
436
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'price'); ?>
437
								</td>
438
								<td class="dataTableHeadingContent_sortbar" align="center" width="7%">
439
                                    <?php echo xtc_sorting(FILENAME_CATEGORIES,'discount'); ?>
440
								</td>
441
								<td class="dataTableHeadingContent_sortbar" align="center" width="13%"></td>
442
							</tr>
443
                            
444
                            <?php
445
                            
446
                            //multi-actions form STARTS
447
                            if (xtc_not_null($_POST['multi_categories']) || xtc_not_null($_POST['multi_products'])) {
448
                                $action = "action=multi_action_confirm&" . xtc_get_all_get_params(array('cPath', 'action')) . 'cPath=' . $cPath;
449
                            } else {
450
                                $action = "action=multi_action&" . xtc_get_all_get_params(array('cPath', 'action')) . 'cPath=' . $cPath;
451
                            }
452
                            // echo xtc_draw_form('multi_action_form', FILENAME_CATEGORIES, $action, 'post', 'onsubmit="javascript:return CheckMultiForm()"');
453
                            //add current category id in $_POST
454
                            echo '<input type="hidden" id="cPath" name="cPath" value="' . $cPath . '">';
455
                            
456
                            // ----------------------------------------------------------------------------------------------------- //
457
                            // WHILE loop to display categories STARTS
458
                            // ----------------------------------------------------------------------------------------------------- //
459
                            
460
                            $categories_count = 0;
461
                            $rows = 0;
462
                            if ($_GET['search']) {
463
                                $keyword = trim(str_replace('*', '%', $_GET['search']));
464
                                $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and cd.categories_name like '" . xtc_db_input($keyword) . "' order by " . $catsort);
465
                                
466
                                // check of num rows = 0, if so, then start another search with: cd.categories_name like '%" . xtc_db_input($keyword) . "%'
467
                                if(xtc_db_num_rows($categories_query) === 0)
468
                                {
469
                                    $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and cd.categories_name like '%" . xtc_db_input($keyword) . "%' order by " . $catsort);
470
                                }
471
                                
472
                            } else {
473
                                $categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by " . $catsort);
474
                            }
475
                            
476
                            $tmp_c_path = false;
477
                            
478
                            while ($categories = xtc_db_fetch_array($categories_query)) {
479
                                
480
                                $categories_count++;
481
                                $rows++;
482
                                
483
                                if ($_GET['search'])
484
                                {
485
                                    $cPath = xtc_get_category_path($categories['parent_id']);
486
                                    if($tmp_c_path === false)
487
                                    {
488
                                        $tmp_c_path = $cPath;
489
                                    }
490
                                }
491
                                if ( ((!$_GET['cID']) && (!$_GET['pID']) || (@$_GET['cID'] == $categories['categories_id'])) && (!$cInfo) && (substr($_GET['action'], 0, 4) != 'new_') ) {
492
                                    $cInfo = new objectInfo($categories);
493
                                }
494
                                ?>
495
								<tr class="dataTableRow visibility_switcher row_selection"
496
								    data-id="<?php echo $categories['categories_id'] ?>"
497
								    data-cpath="<?php echo $cPath ?>"
498
								    data-is-product="false"
499
								>
500
									<td class="categories_view_data"><input type="checkbox" class="checkbox" name="multi_categories[]" value="<?php echo $categories['categories_id'] . '" '; if (is_array($_POST['multi_categories'])) { if (in_array($categories['categories_id'], $_POST['multi_categories'])) { echo 'checked="checked"'; } } ?>></td>
501 501
             <td class="categories_view_data"><?php echo $categories['sort_order']; ?></td>
502
             <td class="categories_view_data" style="text-align: left; padding-left: 8px;">
503
             <?php
504
				// BOF GM_MOD:
505
                $categoryHref = xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID', 'search')) . xtc_get_path($categories['categories_id']));
506
                echo '<a class="btn-folder" href="' . $categoryHref . '"></a>
502
									<td class="categories_view_data" style="text-align: left; padding-left: 8px;">
503
                                        <?php
504
                                        // BOF GM_MOD:
505
                                        $categoryHref = xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID', 'search')) . xtc_get_path($categories['categories_id']));
506
                                        echo '<a class="btn-folder" href="' . $categoryHref . '"></a>
507 507
                      &nbsp;
508 508
                      <b><a href="'. $categoryHref . '">' . htmlspecialchars_wrapper($categories['categories_name']) . '</a></b>';
509
             ?>
510
             </td>
511

  
512
             <td class="categories_view_data"></td>
513

  
514
             <?php
515
             // check product and attributes stock
516
             if (STOCK_CHECK == 'true') {
517
                     echo '<td class="categories_view_data"></td>';
518
             }
519
             ?>
520

  
521
             <td class="categories_view_data">
522
             <?php
523
             //show status icon
524
             echo '<div data-gx-widget="checkbox"
509
                                        ?>
510
									</td>
511
									
512
									<td class="categories_view_data"></td>
513
                                    
514
                                    <?php
515
                                    // check product and attributes stock
516
                                    if (STOCK_CHECK == 'true') {
517
                                        echo '<td class="categories_view_data"></td>';
518
                                    }
519
                                    ?>
520
									
521
									<td class="categories_view_data">
522
                                        <?php
523
                                        //show status icon
524
                                        echo '<div data-gx-widget="checkbox"
525 525
                        data-checkbox-checked="' . (($categories['categories_status'] == '1') ? 'true' : 'false') . '"
526 526
                        data-checkbox-on_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
527 527
                                                                                     . 'action=setcflag&flag=1&cID=' . $categories['categories_id']
528 528
                                                                                     . '&cPath=' . $cPath
529 529
                                                                                     . '&page_token=' . $t_page_token) . '"
530 530
                        data-checkbox-off_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
531
                                                                                     . 'action=setcflag&flag=0&cID=' . $categories['categories_id']
532
                                                                                     . '&cPath=' . $cPath
533
                                                                                     . '&page_token=' . $t_page_token) . '"></div>';
534
             ?>
535
             </td>
536
             <td class="categories_view_data"></td>
537
             <td class="categories_view_data"></td>
538
             <td class="categories_view_data"></td>
539
             <td class="categories_view_data">
540
                <div class="action-list pull-right">
541
                    <!-- ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
542
	                <a class="action-icon"
543
                       title="<?php echo BUTTON_OPEN ?>"
544
	                   href="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array(
545
			                                                                                              'cPath',
546
			                                                                                              'action',
547
			                                                                                              'pID',
548
			                                                                                              'cID',
549
			                                                                                              'search'
550
	                                                                                              ))
551
	                                                                       . xtc_get_path($categories['categories_id'])); ?>">
552
		                <i class="fa fa-folder-open-o"></i>
553
	                </a>
554

  
555
	                <a class="action-icon" href="#" title="<?php echo BUTTON_DELETE ?>">
556
                        <i class="fa fa-trash-o"></i>
557
                    </a>
558

  
559
	                <div class="category-dropdown-button"
560
	                     data-use-button_dropdown="true"
561
	                     data-config_key="categoryOverviewDropdownBtn"
562
	                     data-config_value="<?php echo $categoryOverviewDropdownBtn; ?>"
563
	                >
564
		                <button></button>
565
		                <ul></ul>
566
	                </div>
567
                </div>
568
             </td>
569
            </tr>
570

  
571
    <?php
572

  
573
// ----------------------------------------------------------------------------------------------------- //
574
    } // WHILE loop to display categories ENDS
575
// ----------------------------------------------------------------------------------------------------- //
576

  
577
    // Set query string
578
    $products_count = 0;
579
    if ($_GET['search']) {
580
    	$keyword = trim(str_replace('*', '%', $_GET['search'])); 
581
        $products_query_raw = "
582
        SELECT
531
                                                                                      . 'action=setcflag&flag=0&cID=' . $categories['categories_id']
532
                                                                                      . '&cPath=' . $cPath
533
                                                                                      . '&page_token=' . $t_page_token) . '"></div>';
534
                                        ?>
535
									</td>
536
									<td class="categories_view_data"></td>
537
									<td class="categories_view_data"></td>
538
									<td class="categories_view_data"></td>
539
									<td class="categories_view_data">
540
										<div class="action-list pull-right">
541
											<!-- ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
542
											<a class="action-icon"
543
											   title="<?php echo BUTTON_OPEN ?>"
544
											   href="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array(
545
                                                       'cPath',
546
                                                       'action',
547
                                                       'pID',
548
                                                       'cID',
549
                                                       'search'
550
                                                   ))
551
                                                                                                   . xtc_get_path($categories['categories_id'])); ?>">
552
												<i class="fa fa-folder-open-o"></i>
553
											</a>
554
											
555
											<a class="action-icon" href="#" title="<?php echo BUTTON_DELETE ?>">
556
												<i class="fa fa-trash-o"></i>
557
											</a>
558
											
559
											<div class="category-dropdown-button"
560
											     data-use-button_dropdown="true"
561
											     data-config_key="categoryOverviewDropdownBtn"
562
											     data-config_value="<?php echo $categoryOverviewDropdownBtn; ?>"
563
											>
564
												<button></button>
565
												<ul></ul>
566
											</div>
567
										</div>
568
									</td>
569
								</tr>
570
                                
571
                                <?php
572
                                
573
                                // ----------------------------------------------------------------------------------------------------- //
574
                            } // WHILE loop to display categories ENDS
575
                            // ----------------------------------------------------------------------------------------------------- //
576
                            $products_temp_sql = <<<SQL
577
CREATE TEMPORARY TABLE %s
578
 SELECT
583 579
        p.products_tax_class_id,
584 580
        p.products_id,
585 581
        p.products_model,
......
594 590
        p.products_date_available,
595 591
        p.products_status,
596 592
        p.products_startpage,
597
        p.products_startpage_sort,
598
        p2c.categories_id FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
599
        WHERE p.products_id = pd.products_id AND pd.language_id = '" . $_SESSION['languages_id'] . "' AND
600
        p.products_id = p2c.products_id AND (pd.products_name like '" . xtc_db_input($keyword) . "' OR
601
        p.products_model LIKE '" . xtc_db_input($keyword) . "') ORDER BY " . $prodsort;
602
    } else {
603
        $products_query_raw = "
593
        p.products_startpage_sort
594

  
595
FROM  %s p
596
inner join %s pd
597
on p.products_id = pd.products_id
598
and pd.language_id = '%s'
599
WHERE pd.products_name like '%s' OR p.products_model LIKE '%s'
600
SQL;
601
                            // Set query string
602
                            $products_count = 0;
603
                            if ($_GET['search']) {
604
                                $keyword = trim(str_replace('*', '%', $_GET['search']));
605
                                $products_temp_query_raw = sprintf(
606
                                    $products_temp_sql,
607
                                    'tempProducts',
608
                                    TABLE_PRODUCTS,
609
                                    TABLE_PRODUCTS_DESCRIPTION,
610
                                    $_SESSION['languages_id'],
611
                                    xtc_db_input($keyword),
612
                                    xtc_db_input($keyword)
613
                                );
614
                                
615
                                $products_temp_query = xtc_db_query($products_temp_query_raw);
616
                                
617
                                $products_query_raw = " select p.*, p2c.categories_id from tempProducts p , products_to_categories p2c where p.products_id = p2c.products_id  ORDER BY ".$prodsort;
618
                                
619
                            } else {
620
                                $products_query_raw = "
604 621
        SELECT
605 622
        p.products_tax_class_id,
606 623
        p.products_sort,
607 624
        p.products_id,
608 625
        p.products_model,
609
        pd.products_name,
626
        p.products_name,
610 627
        p.products_quantity,
611 628
        p.products_image,
612 629
        p.products_price,
......
616 633
        p.products_date_available,
617 634
        p.products_status,
618 635
        p.products_startpage,
619
        p.products_startpage_sort FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
620
        WHERE p.products_id = pd.products_id AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "' AND
621
        p.products_id = p2c.products_id AND p2c.categories_id = '" . $current_category_id . "' ORDER BY " . $prodsort;
622
    }
623

  
624
    // Do the DB query
625
    $products_query = xtc_db_query($products_query_raw);
626

  
627
    // check if for search num rows = 0, if so, then start another search
628
    if(isset($_GET['search']) && xtc_db_num_rows($products_query) === 0)
629
    {
630
	    $products_query_raw = "
631
        SELECT
632
        p.products_tax_class_id,
633
        p.products_id,
634
        p.products_model,
635
        pd.products_name,
636
        p.products_sort,
637
        p.products_quantity,
638
        p.products_image, 
639
        p.products_price,
640
        p.products_discount_allowed,
641
        p.products_date_added,
642
        p.products_last_modified,
643
        p.products_date_available,
644
        p.products_status,
645
        p.products_startpage,
646
        p.products_startpage_sort,
647
        p2c.categories_id FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
648
	                          . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
649
        WHERE p.products_id = pd.products_id AND pd.language_id = '" . $_SESSION['languages_id'] . "' AND
650
        p.products_id = p2c.products_id AND (pd.products_name like '%" . xtc_db_input($keyword) . "%' OR
651
        p.products_model LIKE '%" . xtc_db_input($keyword) . "%') ORDER BY " . $prodsort;
652
	}
653

  
654
    // Splitting fetched products result into pages
655
    $products_split = new splitPageResults($_GET['page'], gm_get_conf('NUMBER_OF_PRODUCTS_PER_PAGE', 'ASSOC', true), $products_query_raw, $products_query_numrows);
656

  
657
    // Do the DB query
658
    $products_query = xtc_db_query($products_query_raw);
659

  
660
    $productattributesInstalled = (boolean)gm_get_conf('MODULE_CENTER_PRODUCTATTRIBUTES_INSTALLED') ? 'true' : 'false';
661
// ----------------------------------------------------------------------------------------------------- //
662
// WHILE loop to display products STARTS
663
// ----------------------------------------------------------------------------------------------------- //
664

  
665
    while ($products = xtc_db_fetch_array($products_query)) {
666
      $products_count++;
667
      $rows++;
668

  
669
      // Get categories_id for product if search
670
      if ($_GET['search'])
671
	  {
672
		  $cPath = xtc_get_category_path($products['categories_id']);
673
		  if($tmp_c_path === false)
674
		  {
675
			  $tmp_c_path = $cPath;
676
		  }
677
	  }
678

  
679
      if ( ((!$_GET['pID']) && (!$_GET['cID']) || (@$_GET['pID'] == $products['products_id'])) && (!$pInfo) && (!$cInfo) && (substr($_GET['action'], 0, 4) != 'new_') ) {
680
        // find out the rating average from customer reviews
681
        $reviews_query = xtc_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . $products['products_id'] . "'");
682
        $reviews = xtc_db_fetch_array($reviews_query);
683
        $pInfo_array = xtc_array_merge($products, $reviews);
684
        $pInfo = new objectInfo($pInfo_array);
685
      }
686
	
687
	  // check if there is a special offer for the product
688
	  $query = 'SELECT specials_id FROM specials WHERE products_id = ' . (int)$products['products_id'];
689
	  $result = xtc_db_query($query);
690
	  $specialId = null;
691
	  if(xtc_db_num_rows($result))
692
	  {
693
	    $row = xtc_db_fetch_array($result);
694
		$specialId = (int)$row['specials_id'];
695
	  }  
696
      ?>
697

  
698
      <?php
699
      //checkbox again after submit and before final submit
700
      unset($is_checked);
701
      if (is_array($_POST['multi_products'])) {
702
        if (in_array($products['categories_id'] . '_' . $products['products_id'], $_POST['multi_products'])) {
703
            $is_checked = ' checked="checked"';
704
        }
705
      }
706
      ?>
707
    <tr class="dataTableRow visibility_switcher row_selection"
708
        data-gx-compatibility="row_selection"
709
        data-id="<?php echo $products['products_id']; ?>"
710
        data-cpath="<?php echo $cPath ?>"
711
        data-is-product="true"
712
        <?php echo isset($specialId) ? 'data-special-id="' . $specialId  . '"' : ''; ?>
713
    >
714
      <td class="categories_view_data">
715
        <input type="checkbox" class="checkbox" name="multi_products[]" value="<?php echo $products['categories_id'] . '_' . $products['products_id']; ?>" <?php echo $is_checked; ?>>
716
      </td>
717
      <td class="categories_view_data">
718
        <?php
719
        if ($current_category_id == 0){
720
        echo $products['products_startpage_sort'];
721
        } else {
722
        echo $products['products_sort'];
723
        }
724
         ?>
725
      </td>
726
      <td
727
	      class="categories_view_data"
728
	      style="text-align: left; padding-left: 8px;"
729
	      data-gx-controller="product/product_tooltip"
730
          data-product_tooltip-image-url="<?php echo DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image']; ?>"
731
          data-product_tooltip-description="<?php echo TEXT_DATE_ADDED.' '.xtc_date_short($products['products_date_added']).'<br />' .
732
                                                        TEXT_LAST_MODIFIED.' '.xtc_date_short($products['products_last_modified']).'<br /><br />'.
733
                                                        TEXT_PRODUCT_LINKED_TO . '<br />' . htmlspecialchars_wrapper(xtc_output_generated_category_path($products['products_id'], 'product')); ?>"
734
      >
735
	      <a data-tooltip-trigger href="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '&action=new_product'; ?>">
736
		      <?php echo $products['products_name']; ?>
737
	      </a>
738
      </td>
739

  
740
      <td class="categories_view_data">
741
      <?php
742
        echo $products['products_model'];
743
      ?>
744
      </td>
745

  
746
      <?php
747
      // check product and attributes stock
748
      if (STOCK_CHECK == 'true') { ?>
749
        <td class="categories_view_data">
750
        <?php echo check_stock($products['products_id']); ?>
751
        </td>
752
      <?php } ?>
753
      <td class="categories_view_data">
754
      <?php
755
            echo '<div data-gx-widget="checkbox"
636
        p.products_startpage_sort
637
        FROM (select p.products_tax_class_id,
638
                     p.products_sort,
639
                     p.products_id,
640
                     p.products_model,
641
                     pd.products_name,
642
                     p.products_quantity,
643
                     p.products_image,
644
                     p.products_price,
645
                     p.products_discount_allowed,
646
                     p.products_date_added,
647
                     p.products_last_modified,
648
                     p.products_date_available,
649
                     p.products_status,
650
                     p.products_startpage,
651
                     p.products_startpage_sort
652
                     from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
653
                     WHERE p.products_id = pd.products_id
654
                     AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
655
                     AND p.products_id = p2c.products_id
656
                     AND p2c.categories_id = '" . $current_category_id . "'
657
        ) p ORDER BY " . $prodsort;
658
                            }
659
                            
660
                            // Do the DB query
661
                            $products_query = xtc_db_query($products_query_raw);
662
                            
663
                            // check if for search num rows = 0, if so, then start another search
664
                            if(isset($_GET['search']) && xtc_db_num_rows($products_query) === 0)
665
                            {
666
                                $products_temp_query_raw = sprintf(
667
                                    $products_temp_sql,
668
                                    'tempProducts2',
669
                                    TABLE_PRODUCTS,
670
                                    TABLE_PRODUCTS_DESCRIPTION,
671
                                    $_SESSION['languages_id'],
672
                                    '%'.xtc_db_input($keyword).'%',
673
                                    '%'.xtc_db_input($keyword).'%'
674
                                );
675
                                
676
                                $products_temp_query = xtc_db_query($products_temp_query_raw);
677
                                
678
                                $products_query_raw = "select p.*, p2c.categories_id from tempProducts2 p , products_to_categories p2c where p.products_id = p2c.products_id  ORDER BY ".$prodsort;
679
                            }
680
                            
681
                            // Splitting fetched products result into pages
682
                            $products_split = new splitPageResults($_GET['page'], gm_get_conf('NUMBER_OF_PRODUCTS_PER_PAGE', 'ASSOC', true), $products_query_raw, $products_query_numrows);
683
                            
684
                            // Do the DB query
685
                            $products_query = xtc_db_query($products_query_raw);
686
                            
687
                            $productattributesInstalled = (boolean)gm_get_conf('MODULE_CENTER_PRODUCTATTRIBUTES_INSTALLED') ? 'true' : 'false';
688
                            // ----------------------------------------------------------------------------------------------------- //
689
                            // WHILE loop to display products STARTS
690
                            // ----------------------------------------------------------------------------------------------------- //
691
                            
692
                            while ($products = xtc_db_fetch_array($products_query)) {
693
                                $products_count++;
694
                                $rows++;
695
                                
696
                                // Get categories_id for product if search
697
                                if ($_GET['search'])
698
                                {
699
                                    $cPath = xtc_get_category_path($products['categories_id']);
700
                                    if($tmp_c_path === false)
701
                                    {
702
                                        $tmp_c_path = $cPath;
703
                                    }
704
                                }
705
                                
706
                                if ( ((!$_GET['pID']) && (!$_GET['cID']) || (@$_GET['pID'] == $products['products_id'])) && (!$pInfo) && (!$cInfo) && (substr($_GET['action'], 0, 4) != 'new_') ) {
707
                                    // find out the rating average from customer reviews
708
                                    $reviews_query = xtc_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . $products['products_id'] . "'");
709
                                    $reviews = xtc_db_fetch_array($reviews_query);
710
                                    $pInfo_array = xtc_array_merge($products, $reviews);
711
                                    $pInfo = new objectInfo($pInfo_array);
712
                                }
713
                                
714
                                // check if there is a special offer for the product
715
                                $query = 'SELECT specials_id FROM specials WHERE products_id = ' . (int)$products['products_id'];
716
                                $result = xtc_db_query($query);
717
                                $specialId = null;
718
                                if(xtc_db_num_rows($result))
719
                                {
720
                                    $row = xtc_db_fetch_array($result);
721
                                    $specialId = (int)$row['specials_id'];
722
                                }
723
                                ?>
724
                                
725
                                <?php
726
                                //checkbox again after submit and before final submit
727
                                unset($is_checked);
728
                                if (is_array($_POST['multi_products'])) {
729
                                    if (in_array($products['categories_id'] . '_' . $products['products_id'], $_POST['multi_products'])) {
730
                                        $is_checked = ' checked="checked"';
731
                                    }
732
                                }
733
                                ?>
734
								<tr class="dataTableRow visibility_switcher row_selection"
735
								    data-gx-compatibility="row_selection"
736
								    data-id="<?php echo $products['products_id']; ?>"
737
								    data-cpath="<?php echo $cPath ?>"
738
								    data-is-product="true"
739
                                    <?php echo isset($specialId) ? 'data-special-id="' . $specialId  . '"' : ''; ?>
740
								>
741
									<td class="categories_view_data">
742
										<input type="checkbox" class="checkbox" name="multi_products[]" value="<?php echo $products['categories_id'] . '_' . $products['products_id']; ?>" <?php echo $is_checked; ?>>
743
									</td>
744
									<td class="categories_view_data">
745
                                        <?php
746
                                        if ($current_category_id == 0){
747
                                            echo $products['products_startpage_sort'];
748
                                        } else {
749
                                            echo $products['products_sort'];
750
                                        }
751
                                        ?>
752
									</td>
753
									<td
754
										class="categories_view_data"
755
										style="text-align: left; padding-left: 8px;"
756
										data-gx-controller="product/product_tooltip"
757
										data-product_tooltip-image-url="<?php echo DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image']; ?>"
758
										data-product_tooltip-description="<?php echo TEXT_DATE_ADDED.' '.xtc_date_short($products['products_date_added']).'<br />' .
759
                                                                                     TEXT_LAST_MODIFIED.' '.xtc_date_short($products['products_last_modified']).'<br /><br />'.
760
                                                                                     TEXT_PRODUCT_LINKED_TO . '<br />' . htmlspecialchars_wrapper(xtc_output_generated_category_path($products['products_id'], 'product')); ?>"
761
									>
762
										<a data-tooltip-trigger href="<?php echo xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID')) . 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '&action=new_product'; ?>">
763
                                            <?php echo $products['products_name']; ?>
764
										</a>
765
									</td>
766
									
767
									<td class="categories_view_data">
768
                                        <?php
769
                                        echo $products['products_model'];
770
                                        ?>
771
									</td>
772
                                    
773
                                    <?php
774
                                    // check product and attributes stock
775
                                    if (STOCK_CHECK == 'true') { ?>
776
										<td class="categories_view_data">
777
                                            <?php echo check_stock($products['products_id']); ?>
778
										</td>
779
                                    <?php } ?>
780
									<td class="categories_view_data">
781
                                        <?php
782
                                        echo '<div data-gx-widget="checkbox"
756 783
                        data-checkbox-checked="' . (($products['products_status'] == '1') ? 'true' : 'false') . '"
757 784
                        data-checkbox-on_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
758 785
                                                                                     . 'action=setpflag&flag=1&pID=' . $products['products_id']
759 786
                                                                                     . '&cPath=' . $cPath
760 787
                                                                                     . '&page_token=' . $t_page_token) . '"
761 788
                        data-checkbox-off_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
762
                                                                                     . 'action=setpflag&flag=0&pID=' . $products['products_id']
763
                                                                                     . '&cPath=' . $cPath
764
                                                                                     . '&page_token=' . $t_page_token) . '"></div>';
765
      ?>
766
      </td>
767
      <td class="categories_view_data">
768
      <?php
769
             echo '<div data-gx-widget="checkbox"
789
                                                                                      . 'action=setpflag&flag=0&pID=' . $products['products_id']
790
                                                                                      . '&cPath=' . $cPath
791
                                                                                      . '&page_token=' . $t_page_token) . '"></div>';
792
                                        ?>
793
									</td>
794
									<td class="categories_view_data">
795
                                        <?php
796
                                        echo '<div data-gx-widget="checkbox"
770 797
                        data-checkbox-checked="' . (($products['products_startpage'] == '1') ? 'true' : 'false') . '"
771 798
                        data-checkbox-on_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
772 799
                                                                                     . 'action=setsflag&flag=1&pID=' . $products['products_id']
773 800
                                                                                     . '&cPath=' . $cPath
774 801
                                                                                     . '&page_token=' . $t_page_token) . '"
775 802
                        data-checkbox-off_url="' . xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('cPath', 'action', 'pID', 'cID'))
776
                                                                                     . 'action=setsflag&flag=0&pID=' . $products['products_id']
777
                                                                                     . '&cPath=' . $cPath
778
                                                                                     . '&page_token=' . $t_page_token) . '"></div>';
779
      ?>
780
      </td>
781
      <td class="categories_view_data text-right">
782
      <?php
783
        //show price
784
         $price = xtc_round($products['products_price'],PRICE_PRECISION);
785
            $price_string = $currencies->format($price);
786
            if (PRICE_IS_BRUTTO=='true'){
787
                $price_netto = xtc_round($price,PRICE_PRECISION);
788
                // BOF GM_MOD:
789
                $price = ($price*(xtc_get_tax_rate($products['products_tax_class_id'])+100)/100);
790
                $price_string = '&nbsp;' . $currencies->format($price) . '<br />' . TEXT_NETTO . $currencies->format($price_netto);
791
            }
792
        echo $price_string;
793
      ?>
794
      </td>
795
      <td class="categories_view_data text-right">
796
      <?php
797
        // Show Max Allowed discount
798
        echo $products['products_discount_allowed'] . '%';
799
      ?>
800
      </td>
801
      <td class="categories_view_data">
802
        <div class="action-list">
803
            <a class="action-icon"
804
               href="<?php echo xtc_href_link('categories.php?pID=' . $products['products_id'] . '&action=new_product'); ?>">
805
                <i class="fa fa-pencil"></i>
806
            </a>
807

  
808
            <a class="action-icon" href="#">
809
                <i class="fa fa-trash-o"></i>
810
            </a>
811

  
812
            <!-- ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
813
	        <div class="product-dropdown-button"
814
	             data-use-button_dropdown="true"
815
	             data-config_key="productOverviewDropdownBtn"
816
	             data-attributes-module-installed="<?php echo $productattributesInstalled; ?>"
817
	             data-config_value="<?php echo $productOverviewDropdownBtn; ?>"
818
	        >
819
                <button></button>
820
                <ul></ul>
821
            </div>
822
            <!-- /ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
823
        </div>
824
      </td>
825
     </tr>
826
<?php
827
// ----------------------------------------------------------------------------------------------------- //
828
    } //WHILE loop to display products ENDS
829
// ----------------------------------------------------------------------------------------------------- //
830

  
831
    if(xtc_db_num_rows($categories_query) == 0 && xtc_db_num_rows($products_query) == 0)
832
    {
833
	    $gmLangEditTextManager = MainFactory::create('LanguageTextManager', 'gm_lang_edit', $_SESSION['languages_id']);
834
	    echo '
803
                                                                                      . 'action=setsflag&flag=0&pID=' . $products['products_id']
804
                                                                                      . '&cPath=' . $cPath
805
                                                                                      . '&page_token=' . $t_page_token) . '"></div>';
806
                                        ?>
807
									</td>
808
									<td class="categories_view_data text-right">
809
                                        <?php
810
                                        //show price
811
                                        $price = xtc_round($products['products_price'],PRICE_PRECISION);
812
                                        $price_string = $currencies->format($price);
813
                                        if (PRICE_IS_BRUTTO=='true'){
814
                                            $price_netto = xtc_round($price,PRICE_PRECISION);
815
                                            // BOF GM_MOD:
816
                                            $price = ($price*(xtc_get_tax_rate($products['products_tax_class_id'])+100)/100);
817
                                            $price_string = '&nbsp;' . $currencies->format($price) . '<br />' . TEXT_NETTO . $currencies->format($price_netto);
818
                                        }
819
                                        echo $price_string;
820
                                        ?>
821
									</td>
822
									<td class="categories_view_data text-right">
823
                                        <?php
824
                                        // Show Max Allowed discount
825
                                        echo $products['products_discount_allowed'] . '%';
826
                                        ?>
827
									</td>
828
									<td class="categories_view_data">
829
										<div class="action-list">
830
											<a class="action-icon"
831
											   href="<?php echo xtc_href_link('categories.php?pID=' . $products['products_id'] . '&action=new_product'); ?>">
832
												<i class="fa fa-pencil"></i>
833
											</a>
834
											
835
											<a class="action-icon" href="#">
836
												<i class="fa fa-trash-o"></i>
837
											</a>
838
											
839
											<!-- ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
840
											<div class="product-dropdown-button"
841
											     data-use-button_dropdown="true"
842
											     data-config_key="productOverviewDropdownBtn"
843
											     data-attributes-module-installed="<?php echo $productattributesInstalled; ?>"
844
											     data-config_value="<?php echo $productOverviewDropdownBtn; ?>"
845
											>
846
												<button></button>
847
												<ul></ul>
848
											</div>
849
											<!-- /ROW ACTIONS - BUTTON DROPDOWN WIDGET -->
850
										</div>
851
									</td>
852
								</tr>
853
                                <?php
854
                                // ----------------------------------------------------------------------------------------------------- //
855
                            } //WHILE loop to display products ENDS
856
                            // ----------------------------------------------------------------------------------------------------- //
857
                            
858
                            if(xtc_db_num_rows($categories_query) == 0 && xtc_db_num_rows($products_query) == 0)
859
                            {
860
                                $gmLangEditTextManager = MainFactory::create('LanguageTextManager', 'gm_lang_edit', $_SESSION['languages_id']);
861
                                echo '
835 862
			<tr class="gx-container no-hover">
836 863
				<td colspan="10" class="text-center">' . $gmLangEditTextManager->get_text('TEXT_NO_RESULT') . '</td>
837 864
			</tr>';
838
    }
839

  
840
    if ($cPath_array) {
841
      unset($cPath_back);
842
      for($i = 0, $n = sizeof($cPath_array) - 1; $i < $n; $i++) {
843
        if ($cPath_back == '') {
844
          $cPath_back .= $cPath_array[$i];
845
        } else {
846
          $cPath_back .= '_' . $cPath_array[$i];
847
        }
848
      }
849
    }
850

  
851
    $cPath_back = ($cPath_back) ? 'cPath=' . $cPath_back : '';
852

  
853
	if($_GET['search'])
854
	{
855
		$cPath = $tmp_c_path;
856
	}
857
	if($_GET['cPath'])
858
	{
859
		$cPath = $_GET['cPath'];
860
	}
861
?>
862

  
863
        <!-- </tr> -->
864
        </table>
865
        <!-- categories and products table ENDS -->
866

  
867
        <!-- bottom buttons -->
868
        <table class="gx-container paginator articles-pager"
869
               data-gx-compatibility="categories/categories_multi_action_controller"
870
               data-categories_multi_action_controller-action="<?php echo $multiBtnConfigValue; ?>">
871
        <tr>
872
	        <td class="pull-left">
873

  
874
                <!-- Multi Action Button Dropdown -->
875
                <div class="js-bottom-dropdown"
876
                     data-use-button_dropdown="true"
877
                     data-config_key="multiCategoryOverviewDropdownBtn"
878
                     data-config_value="<?php echo $multiCategoryOverviewDropdownBtn; ?>"
879
                     data-icon="check-square-o fa-fw"
880
                >
881
                    <button></button>
882
                    <ul></ul>
883
                </div>
884
                <!-- /Multi Action Button Dropdown -->
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.
    (1-1/1)