/
product_listing.php
112 lines (92 loc) · 3.25 KB
/
product_listing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/*
$Id$
CE Phoenix, E-Commerce made Easy
https://phoenixcart.org
Copyright (c) 2021 Phoenix Cart
Released under the GNU General Public License
*/
$listing_split = new splitPageResults($listing_sql, $num_list, 'p.products_id');
if ($GLOBALS['messageStack']->size('product_action') > 0) {
echo $GLOBALS['messageStack']->output('product_action');
}
?>
<div class="contentText">
<?php
if ($listing_split->number_of_rows > 0) {
if ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) {
?>
<div class="row align-items-center">
<div class="col-sm-6 d-none d-sm-block">
<?= $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) ?>
</div>
<div class="col-sm-6">
<?= $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS) ?>
</div>
</div>
<?php
}
?>
<div class="card card-body py-2 pl-1 mb-2 alert-filters">
<ul class="nav">
<li class="nav-item dropdown">
<a href="#" class="nav-link text-dark dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?= TEXT_SORT_BY ?></a>
<div class="dropdown-menu">
<?php
foreach ($column_list as $i => $column) {
if ($column_specifications[$column]['sortable']) {
echo splitPageResults::create_sort_heading($_GET['sort'], $i+1, $column_specifications[$column]['heading']);
}
}
?>
</div>
</li>
<?php
echo $GLOBALS['hooks']->cat('navItemFilters');
?>
</ul>
</div>
<?php
$listing_query = $GLOBALS['db']->query($listing_split->sql_query);
$prod_list_contents = '';
while ($listing = $listing_query->fetch_assoc()) {
$listing['link'] = Product::build_link($listing['products_id'], null);
$product = new Product($listing);
$card = [
'show_buttons' => true,
];
if (!Text::is_empty($product->get('seo_description'))) {
$card['extra'] = '<div class="pt-2 font-weight-lighter">'
. $product->get('seo_description')
. '</div>' . PHP_EOL;
}
$prod_list_contents .= '<div class="col mb-2">';
$prod_list_contents .= '<div class="card h-100 is-product"' . $product->get('data_attributes') . '>' . PHP_EOL;
ob_start();
include $GLOBALS['Template']->map('product_card.php', 'component');
$prod_list_contents .= ob_get_clean();
$prod_list_contents .= '</div>' . PHP_EOL;
$prod_list_contents .= '</div>' . PHP_EOL;
}
// filter hook
echo $GLOBALS['hooks']->cat('drawForm');
echo '<div class="' . IS_PRODUCT_PRODUCTS_DISPLAY_ROW . '">' . PHP_EOL;
echo $prod_list_contents;
echo '</div>' . PHP_EOL;
if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<div class="row align-items-center">
<div class="col-sm-6 d-none d-sm-block">
<?= $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) ?>
</div>
<div class="col-sm-6">
<?= $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS) ?>
</div>
</div>
<?php
}
} else {
echo '<div class="alert alert-info" role="alert">' . TEXT_NO_PRODUCTS . '</div>';
}
?>
</div>