reservering systeem
Ik heb onlangs een script gekocht , hierbij is het mogelijk om dmv oscommerce een product te reserveren.
Nu ben ik niet zo blij met mijn aankoop ,omdat het toch niet helemaal doet wat ik ervan verwacht had.
ergens wist ik dit al , maar ik had gehoopt dit zelf te corrigeren, wat mij ook deels gelukt is.
Maar nu zit ik toch met een paar probleempjes.
bij dit reserverings-systeem zit namelijk een optie om ook per uur te reserveren en ik krijg deze er niet uit , iig niet zo dat wanneer je dus op de huidige dag "19-09-2006 tot 19-09-2006" reserveert deze als 1 hele dag geteld word , omdat er in de checks nog steeds uren gezocht worden word de prijs achteraf nog steeds 0.
Ik ben in wezen opzoek naar iemand die bv via msn samen dit probleem met mij wil oplossen.
Als tegenprestatie wil ik voor diegenige wel een design ontwerpen o.i.d.
Ik zit echt met mijn handen in het haar omdat ik een bedrijf op wil starten , werkloos ben , en hierdoor nergens financiële steun krijg van bv een bank.
Gek genoeg ben ik wel instaat om precies alles uit te leggen van de meeste php code maar ik krijg het 0,0 uit mijn vingers, maar dat is waarschijnlijk omdat ik nooit de tijd gehad heb (nee ben niet altijd werkloos geweest, maar de tijd dringt) om het fatsoenlijk te leren.
Wie helpt , natuurlijk bij reacties zal er om meer detail gevraagt worden , maar die geef ik dan naar gelang de reactie zelf.
Gewijzigd op 01/01/1970 01:00:00 door Henry
Wat ik zou zeggen.
Haal de datum uit je database en vergelijk die met de datum die 't op dat moment is, wanneer die overeen komen
if( ... == ... )
Kan je de tijd (uren) ophalen die in je database staat en dan kijken hoelaat het op dat moment is.
Ik denk dat je op die manier te werk moet gaan, maar echt duidelijk is het me allemaal niet.
Code (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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<?php
/*
$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
require('includes/functions/akond.php');
include_once("includes/classes/rentalInfo.php");
function validateInput()
{
global $fmDateStart, $fmDateFinish, $fmTimeStart, $fmTimeFinish, $fmQuantity, $products_id, $ri;
$errors = array();
if (!($fmQuantity = intval($fmQuantity)))
{
$errors[] = AKOND_QUANTITY_MUST_BE_NON_ZERO;
}
// ïðîâåðèòü äàòû íà âàëèäíîñòü
if (!checkdate($fmDateStart[1], $fmDateStart[0], $fmDateStart[2])) $errors[] = AKOND_NOT_VALID_START_DATE;
if (!checkdate($fmDateFinish[1], $fmDateFinish[0], $fmDateFinish[2])) $errors[] = AKOND_NOT_VALID_FINISH_DATE;
$fmTimeStart = intval($fmTimeStart);
$fmTimeFinish = intval($fmTimeFinish);
if ($fmTimeStart < 0 || $fmTimeStart > 23) $errors[] = AKOND_NOT_VALID_START_TIME;
if ($fmTimeFinish < 0 || $fmTimeFinish > 23) $errors[] = AKOND_NOT_VALID_FINISH_TIME;
$temp_timeStart = $ri->hourToTimeArray($fmTimeStart);
$temp_timeFinish = $ri->hourToTimeArray($fmTimeFinish);
// åñëè äàòû óêàçàíû â îáðàòíîì ïðîðÿäêå, òî ïîìåíÿòü èõ ìåñòàìè
if (!count($errors))
{
$start = mktime($temp_timeStart[0], $temp_timeStart[1], $temp_timeStart[2], $fmDateStart[1], $fmDateStart[0], $fmDateStart[2]);
$finish = mktime($temp_timeFinish[0], $temp_timeFinish[1], $temp_timeFinish[2], $fmDateFinish[1], $fmDateFinish[0], $fmDateFinish[2]);
if ($start > $finish)
{
list($fmDateStart, $fmDateFinish) = array($fmDateFinish, $fmDateStart);
$b = $temp_timeStart;
$temp_timeStart = $temp_timeFinish;
$temp_timeFinish = $b;
}
}
// âðåìÿ àðåíäû íå äîëæíî íà÷èíàòüñÿ ñ ïðîøåäøåé äàòû
if (!count($errors))
{
$start = mktime($temp_timeStart[0], $temp_timeStart[1], $temp_timeStart[2], $fmDateStart[1], $fmDateStart[0], $fmDateStart[2]);
$now = time();
if ($now > $start)
{
$errors[] = AKOND_PAST_DATE;
}
}
if ($fmQuantity)
{
if ($products_id = intval($products_id))
{
global $productInfo;
//$ri = new RentalInfo();
$productInfo = $ri->getProductInfo($products_id);
$maxUsed = $ri->getMaxUsedItemsInPeriod(date("Y-m-d", $start), date("Y-m-d", $finish), $products_id);
if ($maxUsed + $fmQuantity > $productInfo["products_quantity"])
{
$errors[] = AKOND_NOT_IN_STOCK;
}
}
}
return $errors;
}
$ri = new RentalInfo();
if ($fmSubmit == 1)
{
// ïðîâåðèòü ïàðàìåòðû
$errors = validateInput();
// åñëè âñå íîðìàëüíî, òî äîáàâèòü ïðîäóêò â êîðçèíó è ïåðåéòè â êîðçèíó
if (!count($errors))
{
/* list($days, $hours) = $ri->getPeriodLength($fmDateStart, $fmTimeStart, $fmDateFinish, $fmTimeFinish);
$price = $ri->getPriceForPeriod($productInfo, $days, $hours);
echo "($days, $hours)<br>";
echo $price;
exit;
*/
if ($book_x)
{
$stage = 1;
}
$ri->book($a, $stage);
if ($stage == 1)
{
// åñëè ïîëüçîâàòåë óæå çàøåë, è ýòî áóêèíã, à íå ïîêóïêà, òî ìîæíî îòïðàèòü åãî íà ñîîáùåíèå èëè íà ñòðàíèöó ñ åãî áóêàìè
tep_redirect(tep_href_link("booking.php"));
// && isset($HTTP_SESSION_VARS["customer_id"]) && $HTTP_SESSION_VARS["customer_id"] > 0
}
// åñëè îí íå çàøåë, à ýòî áóêà, òî íóæíî çàñòàâèòü åãî çàëîãèíèòüñÿ.
// è òîãäà îáíîâèòü èäåíòèôèêàòîð ïîëüçîâàòåëÿ â òàáëèöå áóêîâ
// åñëè ýòî ïîêóïêà, òî âñå äåéñòâèÿ ïðîèçîéäóò ñàìè ñîáîé.
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
exit;
}
// åñëè åñòü îøèáêè, òî ïîêàçàòü èõ
}
else
{
$fmDateStart = preg_split("/\s+/", date("d m Y"));
$fmDateFinish = preg_split("/\s+/", date("d m Y"));
$fmTimeStart = 0;
$fmTimeFinish = 23;
}
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="stylesheet" type="text/css" href="calendar.css">
<script language="javascript" src="common.js"></script>
<script language="javascript"><!--
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<?php
echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action', 'fmSubmit')) . 'fmSubmit=1#rent'));
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
if ($product_check['total'] < 1) {
?>
<tr>
<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
} else {
$product_info_query = tep_db_query("
select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image,
products_price_1, products_price_2, products_price_3, products_price_5, products_price_7, products_price_14, products_price_14, products_price_30, products_price_hour,
pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
if (tep_not_null($product_info['products_model'])) {
$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
$products_name = $product_info['products_name'];
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
<table border="0" cellspacing="0" cellpadding="2" align="right">
<tr>
<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>
</tr>
</table>
<?php
}
?>
<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
<tr>
<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if (tep_not_null($product_info['products_url'])) {
?>
<tr>
<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
</tr>
<?php
} else {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
</tr>
<?php
}
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?
if ($product_info["products_quantity"]):
?>
<tr>
<td><?
//print_r($product_info);
$ri->renderPriceReview($product_info);
?></td>
</tr>
<tr><td><br>
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents"><td>
<br><a name="rent"></a>
<div class="pageHeading"><?=RENTALOSC_RENT_FORM_TITLE?></div>
<?
if (is_array($errors) && count($errors))
{
echo '<div class="pad"><div class="error" align="center">'.AKOND_SUBMISSION_ERRORS.':</div><div align="center" class="vpad">';
foreach ($errors as $e)
{
echo '<li>', $e, '</li>';
}
echo '</div>';
echo '</div>';
}
$ri->renderRentalControls($product_info);
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
//rmh M-S_fixes end
?>
<table width="100%"><tr><td width="15%"> </td><td>
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
</tr>
<?php
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
while ($products_options = tep_db_fetch_array($products_options_query)) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
?>
<tr>
<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
</tr>
<?php
}
?>
</table></td></tr></table>
<?php
}
?>
</td></tr></table></td></tr>
</td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_rent.gif', IMAGE_BUTTON_RENT_THIS_ITEM, 'name="buy"'); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><br>
<table id="calendar" width="100%" cellspacing="0" cellpadding="0">
<?
// ïîêàçûâàòü 12 ìåñÿöåâ âïåðåä
include_once("includes/classes/calendar.php");
include_once("includes/classes/activecalendar.php");
$now = mktime(0, 0, 1, date("m"), date("d"), date("Y"));
$sqlDateNow = date("Y-m-d", $now);
$sqlDateFinish = date("Y-m-d", $now + 366 * 60 * 60 *24);
$bought = array();
$booked = array();
$partly = array();
//$ri->getMaxUsedItemsInPeriod($sqlDateNow, $sqlDateFinish, $products_id);
$grid = $ri->getQuantitiesGrid($sqlDateNow, $sqlDateFinish, $products_id);
foreach ($ri->getBookingsForPeriod($sqlDateNow, $sqlDateFinish, $products_id) as $booking_id=>$row)
{
$t1 = strtotime($row["booking_date_start"]);
$t2 = strtotime($row["booking_date_finish"]);
for ($i=$t1; $i<=$t2; $i = strtotime(date("Y-m-d", $i) . " +1 day"))
{
switch ($row["booking_stage"])
{
case 3:
$booked[] = date("Y-m-d", $i);
break;
case 2:
$temp_date = date("Y-m-d", $i);
if ($grid[$temp_date] == $product_info["products_quantity"])
{
$bought[] = $temp_date;
}
else
{
$partly[] = $temp_date;
}
break;
}
}
}
$now = time();
for ($i=1; $i<13; $i++)
{
$now = mktime(1,0,0, date("n", $now + $delta), 10, date("Y", $now + $delta));
$m = date("n", $now);
$y = date("Y", $now);
$cal = new activeCalendar($y, $m);
$cal->cssEvent = "past";
$cal->setFirstWeekDay(0); // sunday
$cal->enableDayLinks(false, "selectDate");
if ($HTTP_SESSION_VARS["language"] != "english")
{
// load appropriate language strings
$cal->setMonthNames(preg_split("/,\s+/", ACTIVECALENDAR_MONTHNAMES));
$cal->setDayNames(preg_split("/,\s+/", ACTIVECALENDAR_DAYSNAMES));
}
// îòìå÷àòü ïðîøåäøèå äíè òåêóùåãî ìåñÿöà
if ($delta == 0 && date("d") > 1)
{
for ($j=1; $j<date("d"); $j++)
{
$cal->setAdditionalCssClass($y, $m, $j, "past");
}
}
foreach ($bought as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "bought");
}
foreach ($partly as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "partly");
}
foreach ($booked as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "booked");
}
//$cal->setAdditionalCssClass($y, $m, 20, "bought");
//$cal->setAdditionalCssClass($y, $m, 21, "booked");
if ($i % 4 == 1) echo "<tr>";
echo '<td valign="top" width="25%">';
echo $cal->showMonth();
echo "</td>";
$delta = 60 * 60 * 24 * 30;
if ($i % 4 == 0) echo "</tr>";
}
?>
</table><br/></td>
</tr>
<tr>
<td class="bordered">
<table id="calendar">
<tr>
<td><div class="today legend"> </div></td>
<td><?=RENTALOSC_TODAY?></td>
<td></td>
<td><div class="booked legend"> </div></td>
<td><?=RENTALOSC_RESERVED?></td>
<td></td>
<td><div class="partly legend"> </div></td>
<td><?=RENTALOSC_PARTLY_AVAILABLE?></td>
<td></td>
<td><div class="bought legend"> </div></td>
<td><?=RENTALOSC_NA?></td>
<td></td>
<td><div class="past legend"> </div></td>
<td><?=RENTALOSC_PAST_DAYS?></td>
<td></td>
</tr>
</table>
</td>
</tr>
<?php
endif;
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
echo tep_cache_also_purchased(3600);
} else {
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
}
?>
</td>
</tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
/*
$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
require('includes/functions/akond.php');
include_once("includes/classes/rentalInfo.php");
function validateInput()
{
global $fmDateStart, $fmDateFinish, $fmTimeStart, $fmTimeFinish, $fmQuantity, $products_id, $ri;
$errors = array();
if (!($fmQuantity = intval($fmQuantity)))
{
$errors[] = AKOND_QUANTITY_MUST_BE_NON_ZERO;
}
// ïðîâåðèòü äàòû íà âàëèäíîñòü
if (!checkdate($fmDateStart[1], $fmDateStart[0], $fmDateStart[2])) $errors[] = AKOND_NOT_VALID_START_DATE;
if (!checkdate($fmDateFinish[1], $fmDateFinish[0], $fmDateFinish[2])) $errors[] = AKOND_NOT_VALID_FINISH_DATE;
$fmTimeStart = intval($fmTimeStart);
$fmTimeFinish = intval($fmTimeFinish);
if ($fmTimeStart < 0 || $fmTimeStart > 23) $errors[] = AKOND_NOT_VALID_START_TIME;
if ($fmTimeFinish < 0 || $fmTimeFinish > 23) $errors[] = AKOND_NOT_VALID_FINISH_TIME;
$temp_timeStart = $ri->hourToTimeArray($fmTimeStart);
$temp_timeFinish = $ri->hourToTimeArray($fmTimeFinish);
// åñëè äàòû óêàçàíû â îáðàòíîì ïðîðÿäêå, òî ïîìåíÿòü èõ ìåñòàìè
if (!count($errors))
{
$start = mktime($temp_timeStart[0], $temp_timeStart[1], $temp_timeStart[2], $fmDateStart[1], $fmDateStart[0], $fmDateStart[2]);
$finish = mktime($temp_timeFinish[0], $temp_timeFinish[1], $temp_timeFinish[2], $fmDateFinish[1], $fmDateFinish[0], $fmDateFinish[2]);
if ($start > $finish)
{
list($fmDateStart, $fmDateFinish) = array($fmDateFinish, $fmDateStart);
$b = $temp_timeStart;
$temp_timeStart = $temp_timeFinish;
$temp_timeFinish = $b;
}
}
// âðåìÿ àðåíäû íå äîëæíî íà÷èíàòüñÿ ñ ïðîøåäøåé äàòû
if (!count($errors))
{
$start = mktime($temp_timeStart[0], $temp_timeStart[1], $temp_timeStart[2], $fmDateStart[1], $fmDateStart[0], $fmDateStart[2]);
$now = time();
if ($now > $start)
{
$errors[] = AKOND_PAST_DATE;
}
}
if ($fmQuantity)
{
if ($products_id = intval($products_id))
{
global $productInfo;
//$ri = new RentalInfo();
$productInfo = $ri->getProductInfo($products_id);
$maxUsed = $ri->getMaxUsedItemsInPeriod(date("Y-m-d", $start), date("Y-m-d", $finish), $products_id);
if ($maxUsed + $fmQuantity > $productInfo["products_quantity"])
{
$errors[] = AKOND_NOT_IN_STOCK;
}
}
}
return $errors;
}
$ri = new RentalInfo();
if ($fmSubmit == 1)
{
// ïðîâåðèòü ïàðàìåòðû
$errors = validateInput();
// åñëè âñå íîðìàëüíî, òî äîáàâèòü ïðîäóêò â êîðçèíó è ïåðåéòè â êîðçèíó
if (!count($errors))
{
/* list($days, $hours) = $ri->getPeriodLength($fmDateStart, $fmTimeStart, $fmDateFinish, $fmTimeFinish);
$price = $ri->getPriceForPeriod($productInfo, $days, $hours);
echo "($days, $hours)<br>";
echo $price;
exit;
*/
if ($book_x)
{
$stage = 1;
}
$ri->book($a, $stage);
if ($stage == 1)
{
// åñëè ïîëüçîâàòåë óæå çàøåë, è ýòî áóêèíã, à íå ïîêóïêà, òî ìîæíî îòïðàèòü åãî íà ñîîáùåíèå èëè íà ñòðàíèöó ñ åãî áóêàìè
tep_redirect(tep_href_link("booking.php"));
// && isset($HTTP_SESSION_VARS["customer_id"]) && $HTTP_SESSION_VARS["customer_id"] > 0
}
// åñëè îí íå çàøåë, à ýòî áóêà, òî íóæíî çàñòàâèòü åãî çàëîãèíèòüñÿ.
// è òîãäà îáíîâèòü èäåíòèôèêàòîð ïîëüçîâàòåëÿ â òàáëèöå áóêîâ
// åñëè ýòî ïîêóïêà, òî âñå äåéñòâèÿ ïðîèçîéäóò ñàìè ñîáîé.
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
exit;
}
// åñëè åñòü îøèáêè, òî ïîêàçàòü èõ
}
else
{
$fmDateStart = preg_split("/\s+/", date("d m Y"));
$fmDateFinish = preg_split("/\s+/", date("d m Y"));
$fmTimeStart = 0;
$fmTimeFinish = 23;
}
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="stylesheet" type="text/css" href="calendar.css">
<script language="javascript" src="common.js"></script>
<script language="javascript"><!--
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<?php
echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action', 'fmSubmit')) . 'fmSubmit=1#rent'));
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
if ($product_check['total'] < 1) {
?>
<tr>
<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
} else {
$product_info_query = tep_db_query("
select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image,
products_price_1, products_price_2, products_price_3, products_price_5, products_price_7, products_price_14, products_price_14, products_price_30, products_price_hour,
pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
if (tep_not_null($product_info['products_model'])) {
$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
$products_name = $product_info['products_name'];
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
<table border="0" cellspacing="0" cellpadding="2" align="right">
<tr>
<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>
</tr>
</table>
<?php
}
?>
<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
<tr>
<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if (tep_not_null($product_info['products_url'])) {
?>
<tr>
<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
</tr>
<?php
} else {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
</tr>
<?php
}
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?
if ($product_info["products_quantity"]):
?>
<tr>
<td><?
//print_r($product_info);
$ri->renderPriceReview($product_info);
?></td>
</tr>
<tr><td><br>
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents"><td>
<br><a name="rent"></a>
<div class="pageHeading"><?=RENTALOSC_RENT_FORM_TITLE?></div>
<?
if (is_array($errors) && count($errors))
{
echo '<div class="pad"><div class="error" align="center">'.AKOND_SUBMISSION_ERRORS.':</div><div align="center" class="vpad">';
foreach ($errors as $e)
{
echo '<li>', $e, '</li>';
}
echo '</div>';
echo '</div>';
}
$ri->renderRentalControls($product_info);
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
//rmh M-S_fixes end
?>
<table width="100%"><tr><td width="15%"> </td><td>
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
</tr>
<?php
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
while ($products_options = tep_db_fetch_array($products_options_query)) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
?>
<tr>
<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
</tr>
<?php
}
?>
</table></td></tr></table>
<?php
}
?>
</td></tr></table></td></tr>
</td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_rent.gif', IMAGE_BUTTON_RENT_THIS_ITEM, 'name="buy"'); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><br>
<table id="calendar" width="100%" cellspacing="0" cellpadding="0">
<?
// ïîêàçûâàòü 12 ìåñÿöåâ âïåðåä
include_once("includes/classes/calendar.php");
include_once("includes/classes/activecalendar.php");
$now = mktime(0, 0, 1, date("m"), date("d"), date("Y"));
$sqlDateNow = date("Y-m-d", $now);
$sqlDateFinish = date("Y-m-d", $now + 366 * 60 * 60 *24);
$bought = array();
$booked = array();
$partly = array();
//$ri->getMaxUsedItemsInPeriod($sqlDateNow, $sqlDateFinish, $products_id);
$grid = $ri->getQuantitiesGrid($sqlDateNow, $sqlDateFinish, $products_id);
foreach ($ri->getBookingsForPeriod($sqlDateNow, $sqlDateFinish, $products_id) as $booking_id=>$row)
{
$t1 = strtotime($row["booking_date_start"]);
$t2 = strtotime($row["booking_date_finish"]);
for ($i=$t1; $i<=$t2; $i = strtotime(date("Y-m-d", $i) . " +1 day"))
{
switch ($row["booking_stage"])
{
case 3:
$booked[] = date("Y-m-d", $i);
break;
case 2:
$temp_date = date("Y-m-d", $i);
if ($grid[$temp_date] == $product_info["products_quantity"])
{
$bought[] = $temp_date;
}
else
{
$partly[] = $temp_date;
}
break;
}
}
}
$now = time();
for ($i=1; $i<13; $i++)
{
$now = mktime(1,0,0, date("n", $now + $delta), 10, date("Y", $now + $delta));
$m = date("n", $now);
$y = date("Y", $now);
$cal = new activeCalendar($y, $m);
$cal->cssEvent = "past";
$cal->setFirstWeekDay(0); // sunday
$cal->enableDayLinks(false, "selectDate");
if ($HTTP_SESSION_VARS["language"] != "english")
{
// load appropriate language strings
$cal->setMonthNames(preg_split("/,\s+/", ACTIVECALENDAR_MONTHNAMES));
$cal->setDayNames(preg_split("/,\s+/", ACTIVECALENDAR_DAYSNAMES));
}
// îòìå÷àòü ïðîøåäøèå äíè òåêóùåãî ìåñÿöà
if ($delta == 0 && date("d") > 1)
{
for ($j=1; $j<date("d"); $j++)
{
$cal->setAdditionalCssClass($y, $m, $j, "past");
}
}
foreach ($bought as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "bought");
}
foreach ($partly as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "partly");
}
foreach ($booked as $date)
{
list($y, $m, $d) = preg_split("/-/", $date);
$cal->setAdditionalCssClass($y, $m, $d, "booked");
}
//$cal->setAdditionalCssClass($y, $m, 20, "bought");
//$cal->setAdditionalCssClass($y, $m, 21, "booked");
if ($i % 4 == 1) echo "<tr>";
echo '<td valign="top" width="25%">';
echo $cal->showMonth();
echo "</td>";
$delta = 60 * 60 * 24 * 30;
if ($i % 4 == 0) echo "</tr>";
}
?>
</table><br/></td>
</tr>
<tr>
<td class="bordered">
<table id="calendar">
<tr>
<td><div class="today legend"> </div></td>
<td><?=RENTALOSC_TODAY?></td>
<td></td>
<td><div class="booked legend"> </div></td>
<td><?=RENTALOSC_RESERVED?></td>
<td></td>
<td><div class="partly legend"> </div></td>
<td><?=RENTALOSC_PARTLY_AVAILABLE?></td>
<td></td>
<td><div class="bought legend"> </div></td>
<td><?=RENTALOSC_NA?></td>
<td></td>
<td><div class="past legend"> </div></td>
<td><?=RENTALOSC_PAST_DAYS?></td>
<td></td>
</tr>
</table>
</td>
</tr>
<?php
endif;
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
echo tep_cache_also_purchased(3600);
} else {
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
}
?>
</td>
</tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Gewijzigd op 01/01/1970 01:00:00 door Henry
Code (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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<?php
class RentalInfo
{
var $rateIntervals = array(1,2,3,5,7,14,30);
function RentalInfo()
{
}
function getProductInfo($product_id)
{
$query = <<<query
SELECT *
FROM products
WHERE
products_id = ?
query;
$query = constructQuery($query, $product_id);
$r = tep_db_query($query);
return mysql_fetch_assoc($r);
}
function getBookingInfo($pk_booking)
{
$query = <<<query
SELECT *
FROM booking
WHERE
pk_booking = ?
query;
$query = constructQuery($query, $pk_booking);
$r = tep_db_query($query);
return mysql_fetch_assoc($r);
}
function getPriceForPeriod($productInfo, $days, $hours=0)
{
if (!$days && $hours)
{
return $productInfo["products_price_hour"] * $hours;
}
foreach ($this->rateIntervals as $ri)
{
$i++;
if ($days < $ri)
{
$averagePriceForADay = $sum / $lastKnownDaysMark;
return round($days * $averagePriceForADay, 0);
}
$rate = floatval($productInfo["products_price_$ri"]);
$temp_rate = ($currentRate) ? $rate - $currentRate : $rate;
$sum = $sum + $productInfo["products_price"] * $temp_rate;
$currentRate = $rate;
if ($days == $ri)
{
break;
}
$lastKnownDaysMark = $ri;
if (count($this->rateIntervals) == $i)
{
$averagePriceForADay = $sum / $lastKnownDaysMark;
return round($days * $averagePriceForADay, 0);
}
}
return $sum;
}
function renderPriceReview($productInfo)
{
foreach ($this->rateIntervals as $ri)
{
$rate = floatval($productInfo["products_price_$ri"]);
$days = $ri;
$row1 .= '<td align="center" height="20"><b>'.$days.' '.(($days == 1) ? DAY : DAYS).'</b></td>';
$row2 .= '<td align="center" height="20">('.$rate . ' x ' .number_format($productInfo["products_price"], 2) .' €)</td>';
$row3 .= '<td align="center" height="20">'.$this->getPriceForPeriod($productInfo, $days).' €</td>';
}
$preis_basis = AKOND_PRICE_BASIS;
echo <<<html
<table class="infoBox" cellpadding="0" cellspacing="1" width="100%" border="0">
<tr><td height="20" align="center" class="infoBoxHeading">$preis_basis:
</td></tr>
<tr><td>
<table class="infoBoxContents" cellpadding="0" cellspacing="0" width="100%">
<tr>$row1</tr>
<tr class="tan">$row2</tr>
<tr>$row3</tr>
</table>
</td></tr>
</table>
html;
1;
}
function renderRentalControls($product_info)
{
$time = $quantity = $days = $month = array();
for ($d=1; $d<32; $d++)
{
$days[] = array("id" => $d, "text" => $d);
}
foreach (preg_split("/,\s+/", ACTIVECALENDAR_MONTHNAMES) as $m)
{
$month[] = array("id" => ++$i, "text" => $m);
}
$years = array(
array("id" => date("Y"), "text" => date("Y")),
array("id" => date("Y")+1, "text" => date("Y")+1),
);
for ($j = 1; $j <= $product_info["products_quantity"]; $j++)
{
$quantity[] = array("id" => $j, "text" => $j);
}
for ($j = 0; $j <= 23; $j++)
{
$time[] = array("id" => $j, "text" => "$j:00");
}
global $fmDateStart, $fmDateFinish;
$fmStartTime = tep_draw_pull_down_menu("fmTimeStart", $time);
$fmFinishTime = tep_draw_pull_down_menu("fmTimeFinish", $time);
$fmStartDay = tep_draw_pull_down_menu("fmDateStart[]", $days, $fmDateStart[0]);
$fmStartMonth = tep_draw_pull_down_menu("fmDateStart[]", $month, $fmDateStart[1]);
$fmStartYear = tep_draw_pull_down_menu("fmDateStart[]", $years, $fmDateStart[2]);
$fmFinishDay = tep_draw_pull_down_menu("fmDateFinish[]", $days, $fmDateFinish[0]);
$fmFinishMonth = tep_draw_pull_down_menu("fmDateFinish[]", $month, $fmDateFinish[1]);
$fmFinishYear = tep_draw_pull_down_menu("fmDateFinish[]", $years, $fmDateFinish[2]);
$fmQuantity = tep_draw_pull_down_menu("fmQuantity", $quantity);
$msg_from = RENTALOSC_FROM;
$msg_to = RENTALOSC_TO;
$msg_exemplars = RENTALOSC_EXEMPLARS;
$clk_tip1 = $this->getClickTip(0);
$clk_tip2 = $this->getClickTip(1);
echo <<<html
<table width="100%" class="main">
<tr>
<td width="15%" class="main">$msg_from</td>
<td class="main">$fmStartTime $fmStartDay - $fmStartMonth - $fmStartYear</td>
<td class="main">$clk_tip1<td>
</tr>
<tr>
<td width="15%" class="main">$msg_to</td>
<td class="main">$fmFinishTime $fmFinishDay - $fmFinishMonth - $fmFinishYear</td>
<td class="main">$clk_tip2<td>
</tr>
<tr>
<td width="15%" class="main"></td>
<td class="main">$fmQuantity $msg_exemplars</td>
</tr>
</table>
html;
1;
}
function getClickTip($i)
{
return '<div style="display: '.(($i) ? "none" : "block") . ';" id="tip_'.$i.'"><img src="images/arrow3a.gif">'.AKOND_CLICK_CALENDAR.'</div>';
}
function getPeriodLength($startDate, $fmTimeStart, $finishDate, $fmTimeFinish)
{
$st = mktime($fmTimeStart, 0, 0, $startDate[1], $startDate[0], $startDate[2]);
$fn = mktime($fmTimeFinish, 0, 0, $finishDate[1], $finishDate[0], $finishDate[2]);
$days = intval(abs($st - $fn) / (60*60*24));
$hours = (abs($st - $fn) / (60*60) - $days*24);
if ($hours == 23 && !$days)
{
list($days, $hours) = array(1, 0);
}
if ($days && $hours)
{
$days++;
$hours = 0;
}
return array($days, $hours);
}
function book($bookInfo, $stage)
{
global $fmDateStart, $fmDateFinish, $fmTimeStart, $fmTimeFinish, $fmQuantity;
global $cart, $products_id, $id, $HTTP_SESSION_VARS;
$query = <<<query
INSERT INTO booking
SET
booking_date = NOW(),
products_id = ?,
booking_date_start = ?,
booking_date_finish = ?,
booking_stage = ?,
booking_price = ?,
booking_quantity = ?,
customers_id = ?,
booking_products_attributes = ?
query;
$fmQuantity = intval($fmQuantity);
if ($fmQuantity)
{
$productInfo = $this->getProductInfo($products_id);
list($days, $hours) = $this->getPeriodLength($fmDateStart, $fmTimeStart, $fmDateFinish, $fmTimeFinish);
$price = $this->getPriceForPeriod($productInfo, $days, $hours);
/*
if ($fmTimeStart == 24)
{
$fmTimeStart = "23:59:59";
}
if ($fmTimeFinish == 24)
{
$fmTimeFinish = "23:59:59";
}
*/
$query = constructQuery($query,
$products_id,
"{$fmDateStart[2]}-{$fmDateStart[1]}-{$fmDateStart[0]} $fmTimeStart",
"{$fmDateFinish[2]}-{$fmDateFinish[1]}-{$fmDateFinish[0]} $fmTimeFinish",
$stage,
$price,
$fmQuantity,
$HTTP_SESSION_VARS["customer_id"],
serialize($id)
);
$r = tep_db_query($query);
$booking_id = mysql_insert_id();
if ($stage == 1)
{
global $mybookings;
$mybookings = array();
if (!tep_session_is_registered("mybookings"))
{
tep_session_register("mybookings");
}
$mybookings[] = $booking_id;
}
else
{
$id[0] = $booking_id;
$cart->add_cart($products_id, $fmQuantity, $id);
}
}
return ;
}
function getBookingsForPeriod($start, $finish, $product_id)
{
$query = <<<query
SELECT
*,
IF(booking_date_start < "$start", "$start", booking_date_start) booking_date_start,
IF(booking_date_finish > "$finish", "$finish", booking_date_finish) booking_date_finish
FROM booking
WHERE
products_id = ?
AND
TO_DAYS("$start") <= TO_DAYS(booking_date_finish)
AND
TO_DAYS("$finish") >= TO_DAYS(booking_date_start)
AND booking_stage > 1
query;
$query = constructQuery($query, $product_id);
$r = tep_db_query($query);
$result = array();
while ($row = mysql_fetch_assoc($r))
{
$result[$row["pk_booking"]] = $row;
}
return $result;
}
function getQuantitiesGrid($start, $finish, $product_id)
{
$days = array();
foreach ($this->getBookingsForPeriod($start, $finish, $product_id) as $pk_booking=>$booking)
{
//echo "<br>", $booking["booking_date_start"], " ->", $booking["booking_date_finish"];
for (
$temp_start = strtotime($booking["booking_date_start"]);
$temp_start <= strtotime($booking["booking_date_finish"]);
$temp_start = strtotime(date("Y-m-d", $temp_start) . " +1 day")
)
{
//echo "<br>",
$temp_date = date("Y-m-d", $temp_start);
$days[$temp_date] += $booking["booking_quantity"];
}
}
return $days;
}
function getMaxUsedItemsInPeriod($start, $finish, $product_id)
{
$grid = $this->getQuantitiesGrid($start, $finish, $product_id);
if (count($grid))
{
$maxQuantity = max(array_values($grid));
}
return $maxQuantity;
}
function hourToTimeArray($hour)
{
$result = array($hour, 0, 0);
/*
if ($hour == 24)
{
$result = array(23, 59, 59);
}
*/
return $result;
}
}
?>
class RentalInfo
{
var $rateIntervals = array(1,2,3,5,7,14,30);
function RentalInfo()
{
}
function getProductInfo($product_id)
{
$query = <<<query
SELECT *
FROM products
WHERE
products_id = ?
query;
$query = constructQuery($query, $product_id);
$r = tep_db_query($query);
return mysql_fetch_assoc($r);
}
function getBookingInfo($pk_booking)
{
$query = <<<query
SELECT *
FROM booking
WHERE
pk_booking = ?
query;
$query = constructQuery($query, $pk_booking);
$r = tep_db_query($query);
return mysql_fetch_assoc($r);
}
function getPriceForPeriod($productInfo, $days, $hours=0)
{
if (!$days && $hours)
{
return $productInfo["products_price_hour"] * $hours;
}
foreach ($this->rateIntervals as $ri)
{
$i++;
if ($days < $ri)
{
$averagePriceForADay = $sum / $lastKnownDaysMark;
return round($days * $averagePriceForADay, 0);
}
$rate = floatval($productInfo["products_price_$ri"]);
$temp_rate = ($currentRate) ? $rate - $currentRate : $rate;
$sum = $sum + $productInfo["products_price"] * $temp_rate;
$currentRate = $rate;
if ($days == $ri)
{
break;
}
$lastKnownDaysMark = $ri;
if (count($this->rateIntervals) == $i)
{
$averagePriceForADay = $sum / $lastKnownDaysMark;
return round($days * $averagePriceForADay, 0);
}
}
return $sum;
}
function renderPriceReview($productInfo)
{
foreach ($this->rateIntervals as $ri)
{
$rate = floatval($productInfo["products_price_$ri"]);
$days = $ri;
$row1 .= '<td align="center" height="20"><b>'.$days.' '.(($days == 1) ? DAY : DAYS).'</b></td>';
$row2 .= '<td align="center" height="20">('.$rate . ' x ' .number_format($productInfo["products_price"], 2) .' €)</td>';
$row3 .= '<td align="center" height="20">'.$this->getPriceForPeriod($productInfo, $days).' €</td>';
}
$preis_basis = AKOND_PRICE_BASIS;
echo <<<html
<table class="infoBox" cellpadding="0" cellspacing="1" width="100%" border="0">
<tr><td height="20" align="center" class="infoBoxHeading">$preis_basis:
</td></tr>
<tr><td>
<table class="infoBoxContents" cellpadding="0" cellspacing="0" width="100%">
<tr>$row1</tr>
<tr class="tan">$row2</tr>
<tr>$row3</tr>
</table>
</td></tr>
</table>
html;
1;
}
function renderRentalControls($product_info)
{
$time = $quantity = $days = $month = array();
for ($d=1; $d<32; $d++)
{
$days[] = array("id" => $d, "text" => $d);
}
foreach (preg_split("/,\s+/", ACTIVECALENDAR_MONTHNAMES) as $m)
{
$month[] = array("id" => ++$i, "text" => $m);
}
$years = array(
array("id" => date("Y"), "text" => date("Y")),
array("id" => date("Y")+1, "text" => date("Y")+1),
);
for ($j = 1; $j <= $product_info["products_quantity"]; $j++)
{
$quantity[] = array("id" => $j, "text" => $j);
}
for ($j = 0; $j <= 23; $j++)
{
$time[] = array("id" => $j, "text" => "$j:00");
}
global $fmDateStart, $fmDateFinish;
$fmStartTime = tep_draw_pull_down_menu("fmTimeStart", $time);
$fmFinishTime = tep_draw_pull_down_menu("fmTimeFinish", $time);
$fmStartDay = tep_draw_pull_down_menu("fmDateStart[]", $days, $fmDateStart[0]);
$fmStartMonth = tep_draw_pull_down_menu("fmDateStart[]", $month, $fmDateStart[1]);
$fmStartYear = tep_draw_pull_down_menu("fmDateStart[]", $years, $fmDateStart[2]);
$fmFinishDay = tep_draw_pull_down_menu("fmDateFinish[]", $days, $fmDateFinish[0]);
$fmFinishMonth = tep_draw_pull_down_menu("fmDateFinish[]", $month, $fmDateFinish[1]);
$fmFinishYear = tep_draw_pull_down_menu("fmDateFinish[]", $years, $fmDateFinish[2]);
$fmQuantity = tep_draw_pull_down_menu("fmQuantity", $quantity);
$msg_from = RENTALOSC_FROM;
$msg_to = RENTALOSC_TO;
$msg_exemplars = RENTALOSC_EXEMPLARS;
$clk_tip1 = $this->getClickTip(0);
$clk_tip2 = $this->getClickTip(1);
echo <<<html
<table width="100%" class="main">
<tr>
<td width="15%" class="main">$msg_from</td>
<td class="main">$fmStartTime $fmStartDay - $fmStartMonth - $fmStartYear</td>
<td class="main">$clk_tip1<td>
</tr>
<tr>
<td width="15%" class="main">$msg_to</td>
<td class="main">$fmFinishTime $fmFinishDay - $fmFinishMonth - $fmFinishYear</td>
<td class="main">$clk_tip2<td>
</tr>
<tr>
<td width="15%" class="main"></td>
<td class="main">$fmQuantity $msg_exemplars</td>
</tr>
</table>
html;
1;
}
function getClickTip($i)
{
return '<div style="display: '.(($i) ? "none" : "block") . ';" id="tip_'.$i.'"><img src="images/arrow3a.gif">'.AKOND_CLICK_CALENDAR.'</div>';
}
function getPeriodLength($startDate, $fmTimeStart, $finishDate, $fmTimeFinish)
{
$st = mktime($fmTimeStart, 0, 0, $startDate[1], $startDate[0], $startDate[2]);
$fn = mktime($fmTimeFinish, 0, 0, $finishDate[1], $finishDate[0], $finishDate[2]);
$days = intval(abs($st - $fn) / (60*60*24));
$hours = (abs($st - $fn) / (60*60) - $days*24);
if ($hours == 23 && !$days)
{
list($days, $hours) = array(1, 0);
}
if ($days && $hours)
{
$days++;
$hours = 0;
}
return array($days, $hours);
}
function book($bookInfo, $stage)
{
global $fmDateStart, $fmDateFinish, $fmTimeStart, $fmTimeFinish, $fmQuantity;
global $cart, $products_id, $id, $HTTP_SESSION_VARS;
$query = <<<query
INSERT INTO booking
SET
booking_date = NOW(),
products_id = ?,
booking_date_start = ?,
booking_date_finish = ?,
booking_stage = ?,
booking_price = ?,
booking_quantity = ?,
customers_id = ?,
booking_products_attributes = ?
query;
$fmQuantity = intval($fmQuantity);
if ($fmQuantity)
{
$productInfo = $this->getProductInfo($products_id);
list($days, $hours) = $this->getPeriodLength($fmDateStart, $fmTimeStart, $fmDateFinish, $fmTimeFinish);
$price = $this->getPriceForPeriod($productInfo, $days, $hours);
/*
if ($fmTimeStart == 24)
{
$fmTimeStart = "23:59:59";
}
if ($fmTimeFinish == 24)
{
$fmTimeFinish = "23:59:59";
}
*/
$query = constructQuery($query,
$products_id,
"{$fmDateStart[2]}-{$fmDateStart[1]}-{$fmDateStart[0]} $fmTimeStart",
"{$fmDateFinish[2]}-{$fmDateFinish[1]}-{$fmDateFinish[0]} $fmTimeFinish",
$stage,
$price,
$fmQuantity,
$HTTP_SESSION_VARS["customer_id"],
serialize($id)
);
$r = tep_db_query($query);
$booking_id = mysql_insert_id();
if ($stage == 1)
{
global $mybookings;
$mybookings = array();
if (!tep_session_is_registered("mybookings"))
{
tep_session_register("mybookings");
}
$mybookings[] = $booking_id;
}
else
{
$id[0] = $booking_id;
$cart->add_cart($products_id, $fmQuantity, $id);
}
}
return ;
}
function getBookingsForPeriod($start, $finish, $product_id)
{
$query = <<<query
SELECT
*,
IF(booking_date_start < "$start", "$start", booking_date_start) booking_date_start,
IF(booking_date_finish > "$finish", "$finish", booking_date_finish) booking_date_finish
FROM booking
WHERE
products_id = ?
AND
TO_DAYS("$start") <= TO_DAYS(booking_date_finish)
AND
TO_DAYS("$finish") >= TO_DAYS(booking_date_start)
AND booking_stage > 1
query;
$query = constructQuery($query, $product_id);
$r = tep_db_query($query);
$result = array();
while ($row = mysql_fetch_assoc($r))
{
$result[$row["pk_booking"]] = $row;
}
return $result;
}
function getQuantitiesGrid($start, $finish, $product_id)
{
$days = array();
foreach ($this->getBookingsForPeriod($start, $finish, $product_id) as $pk_booking=>$booking)
{
//echo "<br>", $booking["booking_date_start"], " ->", $booking["booking_date_finish"];
for (
$temp_start = strtotime($booking["booking_date_start"]);
$temp_start <= strtotime($booking["booking_date_finish"]);
$temp_start = strtotime(date("Y-m-d", $temp_start) . " +1 day")
)
{
//echo "<br>",
$temp_date = date("Y-m-d", $temp_start);
$days[$temp_date] += $booking["booking_quantity"];
}
}
return $days;
}
function getMaxUsedItemsInPeriod($start, $finish, $product_id)
{
$grid = $this->getQuantitiesGrid($start, $finish, $product_id);
if (count($grid))
{
$maxQuantity = max(array_values($grid));
}
return $maxQuantity;
}
function hourToTimeArray($hour)
{
$result = array($hour, 0, 0);
/*
if ($hour == 24)
{
$result = array(23, 59, 59);
}
*/
return $result;
}
}
?>
Beste kalle , het zit dus overal he, het is een script geen pagina.
$HTTP_GET_VARS['products_id'] ($_GET[''] is het)
Best logisch dat het niet helemaal werkt.
Ja ik denk niet dat het de bedoeling is dat je hier honderden regels code gaat plaatsen.
edit:
meestal zit er een support bij als je wat koopt, de maker weet wel waar alles zit. En er zit overigens ook geen commentaar bij, dus dat is wel ff spitten.
Dus kan je niet bij de maker aankloppen waar je daar voor moeten zijn.
Gewijzigd op 01/01/1970 01:00:00 door Kalle P
Ik ben opzoek naar hulp om "iets" aan te passen.
ik vraag "hulp" en geen kritiek.
en nee kalle , daarom kom ik dus juist hier , de oorspronkelijke maker correspondeert niet.
Gewijzigd op 01/01/1970 01:00:00 door Henry
Geven alleen aan dat je iets zwaar verouderds hebt verkocht. En das gewoon jammer van je geld. Waarschijnlijk gaat alles aanpassen meer tijd en geld kosten dan dat je een goede versie had aangeschaft
Quote:
/*
$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
het is een omgebouwde oscommerce tbv reserveringen.