-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadvanced_search.php
220 lines (192 loc) · 7.49 KB
/
advanced_search.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require('includes/languages/' . $language . '/advanced_search.php');
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('advanced_search.php'));
require('includes/template_top.php');
?>
<script src="includes/general.js"></script>
<script><!--
function check_form() {
var error_message = "<?php echo JS_ERROR; ?>";
var error_found = false;
var error_field;
var keywords = document.advanced_search.keywords.value;
var dfrom = document.advanced_search.dfrom.value;
var dto = document.advanced_search.dto.value;
var pfrom = document.advanced_search.pfrom.value;
var pto = document.advanced_search.pto.value;
var pfrom_float;
var pto_float;
if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom.length < 1)) && ((dto == '') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
error_field = document.advanced_search.keywords;
error_found = true;
}
if (dfrom.length > 0) {
if (!IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) {
error_message = error_message + "* <?php echo ERROR_INVALID_FROM_DATE; ?>\n";
error_field = document.advanced_search.dfrom;
error_found = true;
}
}
if (dto.length > 0) {
if (!IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>')) {
error_message = error_message + "* <?php echo ERROR_INVALID_TO_DATE; ?>\n";
error_field = document.advanced_search.dto;
error_found = true;
}
}
if ((dfrom.length > 0) && (IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) && (dto.length > 0) && (IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>'))) {
if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) {
error_message = error_message + "* <?php echo ERROR_TO_DATE_LESS_THAN_FROM_DATE; ?>\n";
error_field = document.advanced_search.dto;
error_found = true;
}
}
if (pfrom.length > 0) {
pfrom_float = parseFloat(pfrom);
if (isNaN(pfrom_float)) {
error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
error_field = document.advanced_search.pfrom;
error_found = true;
}
} else {
pfrom_float = 0;
}
if (pto.length > 0) {
pto_float = parseFloat(pto);
if (isNaN(pto_float)) {
error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
error_field = document.advanced_search.pto;
error_found = true;
}
} else {
pto_float = 0;
}
if ( (pfrom.length > 0) && (pto.length > 0) ) {
if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
error_field = document.advanced_search.pto;
error_found = true;
}
}
if (error_found == true) {
alert(error_message);
error_field.focus();
return false;
} else {
return true;
}
}
//--></script>
<div class="page-header">
<h1><?php echo HEADING_TITLE_1; ?></h1>
</div>
<?php
if ($messageStack->size('search') > 0) {
echo $messageStack->output('search');
}
?>
<?php echo tep_draw_form('advanced_search', tep_href_link('advanced_search_result.php', '', 'NONSSL', false), 'get', 'class="form-horizontal" onsubmit="return check_form(this);"') . tep_hide_session_id(); ?>
<div class="contentContainer">
<div class="contentText">
<div class="form-group has-feedback">
<label for="inputKeywords" class="control-label col-sm-3"><?php echo HEADING_SEARCH_CRITERIA; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_input_field('keywords', '', 'required aria-required="true" id="inputKeywords" placeholder="' . TEXT_SEARCH_PLACEHOLDER . '"', 'search');
echo FORM_REQUIRED_INPUT;
echo tep_draw_hidden_field('search_in_description', '1');
?>
</div>
</div>
<div class="buttonSet row">
<div class="col-xs-6"><a data-toggle="modal" href="#helpSearch" class="btn btn-primary"><?php echo TEXT_SEARCH_HELP_LINK; ?></a></div>
<div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_SEARCH, 'fa fa-search', null, 'primary', null, 'btn-success'); ?></div>
</div>
<div class="modal fade" id="helpSearch" tabindex="-1" role="dialog" aria-labelledby="helpSearchLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="fa fa-remove"></span></button>
<h4 class="modal-title"><?php echo HEADING_SEARCH_HELP; ?></h4>
</div>
<div class="modal-body">
<p><?php echo TEXT_SEARCH_HELP; ?></p>
</div>
</div>
</div>
</div>
<hr>
<div class="form-group">
<label for="entryCategories" class="control-label col-sm-3"><?php echo ENTRY_CATEGORIES; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))), NULL, 'id="entryCategories"');
?>
</div>
</div>
<div class="form-group">
<label for="entryIncludeSubs" class="control-label col-sm-3"><?php echo ENTRY_INCLUDE_SUBCATEGORIES; ?></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<?php echo tep_draw_checkbox_field('inc_subcat', '1', true, 'id="entryIncludeSubs"'); ?>
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="entryManufacturers" class="control-label col-sm-3"><?php echo ENTRY_MANUFACTURERS; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_pull_down_menu('manufacturers_id', tep_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS))), NULL, 'id="entryManufacturers"');
?>
</div>
</div>
<div class="form-group">
<label for="PriceFrom" class="control-label col-sm-3"><?php echo ENTRY_PRICE_FROM; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_input_field('pfrom', '', 'id="PriceFrom" placeholder="' . ENTRY_PRICE_FROM_TEXT . '"');
?>
</div>
</div>
<div class="form-group">
<label for="PriceTo" class="control-label col-sm-3"><?php echo ENTRY_PRICE_TO; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_input_field('pto', '', 'id="PriceTo" placeholder="' . ENTRY_PRICE_TO_TEXT . '"');
?>
</div>
</div>
<div class="form-group">
<label for="dfrom" class="control-label col-sm-3"><?php echo ENTRY_DATE_FROM; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_input_field('dfrom', '', 'id="dfrom" placeholder="' . ENTRY_DATE_FROM_TEXT . '"');
?>
</div>
</div>
<div class="form-group">
<label for="dto" class="control-label col-sm-3"><?php echo ENTRY_DATE_TO; ?></label>
<div class="col-sm-9">
<?php
echo tep_draw_input_field('dto', '', 'id="dto" placeholder="' . ENTRY_DATE_TO_TEXT . '"');
?>
</div>
</div>
</div>
</div>
</form>
<?php
require('includes/template_bottom.php');
require('includes/application_bottom.php');
?>