Javascript in div
Ik beheer op dit moment een site met dagaanbiedingen maar ik wil graag nog iets toevoegen. Een timer/countdown die elke dag afloopt en om 0:00 weer op 23:59 springt en weer afteld. Zoals je wel vaker ziet op dagaanbieding sites.
Dit is mijn div:
<div class=\"".$storename."store-timer store-timer\"> </div>
Hierin wil ik een heel simpel timer/countdown die zicht elke nacht weer opnieuw insteld.
Kan iemand mij daar bij helpen?
Thanks
Eventueel laat je dat weg; dan doe je gewoon
var t = d.getHours() +':'+ d.getMinutes();
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<style>
#demo {
}
</style>
<div id="demo"></div>
<script>
var myVar=setInterval(function(){myTimer()},1000);
function myTimer() {
var d=new Date();
var t = d.getHours() +':'+ d.getMinutes() +':'+ d.getSeconds();
document.getElementById("demo").innerHTML=t;
}
</script>
#demo {
}
</style>
<div id="demo"></div>
<script>
var myVar=setInterval(function(){myTimer()},1000);
function myTimer() {
var d=new Date();
var t = d.getHours() +':'+ d.getMinutes() +':'+ d.getSeconds();
document.getElementById("demo").innerHTML=t;
}
</script>
Gewijzigd op 21/10/2013 10:30:05 door Kris Peeters
Dit kan ik gewoon in mijn DIV plakken?
<div id="demo" class=\"".$storename."store-timer store-timer\"> </div>
----
O ja ...
Dit neemt dus de tijd over van de computer van de gebruiker.
Gewijzigd op 21/10/2013 10:37:41 door Kris Peeters
Parse error: syntax error, unexpected T_STRING in
(ondertussen zie ik voor betere code; even geduld; ik had de vraag niet deftig gelezen)
<style>
#demo {
}
</style>
<div id="demo"></div>
<script>
var myVar=setInterval(function(){myTimer()},1000);
function myTimer() {
var d=new Date();
var t = d.getHours() +':'+ d.getMinutes() +':'+ d.getSeconds();
document.getElementById("demo").innerHTML=t;
}
</script>
En dit wordt mijn div:
<div id="demo" class=\"".$storename."store-timer store-timer\"> </div>
Klopt dat zo?
Dat komt door de code die je ons nog niet hebt laten zien.
Toon zelf eens de code van jou; waar
<div id="demo" class=\"".$storename."store-timer store-timer\"> </div>
in voorkomt.
Ik kan niet zien wat je ons niet toont.
Ik wil iets zien in de aard van
Code (php)
1
2
3
4
2
3
4
<?php
$storename = 'Pietje Puk';
echo "<div id=\"demo\" class=\"".$storename."store-timer store-timer\"> </div>";
?>
$storename = 'Pietje Puk';
echo "<div id=\"demo\" class=\"".$storename."store-timer store-timer\"> </div>";
?>
Dit is intussen aangepaste code die doet wat je vraagt
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
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
<div id="demo"></div>
<script>
(function() {
var d=new Date();
var tomorrow = new Date(d.getTime() + 24 * 60 * 60 * 1000);
tomorrow.setHours(0)
tomorrow.setMinutes(0)
tomorrow.setSeconds(0);
var target_date = tomorrow;// new Date("Aug 15, 2019").getTime();
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdown = document.getElementById("demo");
// update the tag with id "countdown" every 1 second
setInterval(function () {
// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value
countdown.innerHTML = hours + ":" + minutes + ":" + seconds + "";
}, 1000);
})();
</script>
<script>
(function() {
var d=new Date();
var tomorrow = new Date(d.getTime() + 24 * 60 * 60 * 1000);
tomorrow.setHours(0)
tomorrow.setMinutes(0)
tomorrow.setSeconds(0);
var target_date = tomorrow;// new Date("Aug 15, 2019").getTime();
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdown = document.getElementById("demo");
// update the tag with id "countdown" every 1 second
setInterval(function () {
// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value
countdown.innerHTML = hours + ":" + minutes + ":" + seconds + "";
}, 1000);
})();
</script>
Gewijzigd op 21/10/2013 11:04:49 door Kris Peeters
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
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
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
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
<?php
/*
..--==[ Function to add the stylesheet for the store ]==--..
*/
function TTstore_scripts() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script( 'ttstoreexpand-script', WP_PLUGIN_URL . '/tradetracker-store/js/expand.js');
$ttslidertheme = get_option("Tradetracker_slidertheme");
if($ttslidertheme == ""){
$ttslidertheme = "base";
}
if(get_option("Tradetracker_usecss") == "1"){
wp_register_style( 'tt_store_css', get_option('Tradetracker_csslink'));
wp_enqueue_style( 'tt_store_css');
}
wp_register_style( 'tt_slider_css', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css");
wp_enqueue_style( 'tt_slider_css');
}
add_action('wp_enqueue_scripts', 'TTstore_scripts');
function store_items($used, $winkel, $searching)
{
global $wpdb;
global $ttstorexmltable;
$wpdb->get_var( "SELECT COUNT(*) FROM $ttstorexmltable;" );
if($tradetracker_xml>0)
{
_e('No XML filled in yet please change the settings first.', 'ttstore');
} else {
return show_items($used, $winkel, $searching);
}
}
/*
..--==[ Function to show the items. ]==--..
*/
add_action('wp_head', 'header_css_style');
function header_css_style() {
global $wpdb;
$ttslidertheme = get_option("Tradetracker_slidertheme");
if($ttslidertheme == ""){
$ttslidertheme = "base";
}
if(get_option("Tradetracker_usecss") == "1"){
//echo "<link rel=\"stylesheet\" href=\"".get_option('Tradetracker_csslink')."\" type=\"text/css\" />";
//echo "<link href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\"/>";
} else {
//echo "<link href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\"/>";
$style="";
global $ttstorelayouttable;
global $ttstoremultitable;
$style .= "<style type=\"text/css\" media=\"screen\">";
$multi=$wpdb->get_results("SELECT multiname, laywidth, layfont, laycolortitle, laycolorbuttonfont, laycolorbutton, laycolorborder, laycolorfooter, laycolorimagebg, laycolorfont FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id");
foreach ($multi as $multi_val){
$i="1";
if( $multi_val->laywidth == "" ){
$width= "250";
} else {
$width= $multi_val->laywidth;
}
if( $multi_val->layfont == "" ){
$font= "Verdana";
} else {
$font= $multi_val->layfont;
}
$widthtitle = $width-6;
$widthmore = $width-10;
if( $multi_val->laycolortitle == "" ){
$colortitle = "#ececed";
} else {
$colortitle = $multi_val->laycolortitle;
}
if( $multi_val->laycolorfooter == "" ){
$colorfooter = "#ececed";
} else {
$colorfooter = $multi_val->laycolorfooter;
}
if( $multi_val->laycolorimagebg == "" ){
$colorimagebg = "#ffffff";
} else {
$colorimagebg = $multi_val->laycolorimagebg;
}
if( $multi_val->laycolorfont == "" ){
$colorfont = "#000000";
} else {
$colorfont = $multi_val->laycolorfont;
}
if( $multi_val->laycolorborder == "" ){
$colorborder = "#65B9C1";
} else {
$colorborder = $multi_val->laycolorborder;
}
if( $multi_val->laycolorbutton == "" ){
$colorbutton = "#65B9C1";
} else {
$colorbutton = $multi_val->laycolorbutton;
}
if( $multi_val->laycolorbuttonfont == "" ){
$colorbuttonfont = "#ffffff";
} else {
$colorbuttonfont = $multi_val->laycolorbuttonfont;
}
$storename = create_slug($multi_val->multiname);
$style .= "\n.".$storename."store-outerbox{width:".$width."px;color:".$colorfont.";font-family:".$font.";float:left;margin:0px 15px 15px 0;min-height:353px;border:solid 1px ".$colorborder.";position:relative;}";
$style .= "\n.".$storename."store-titel{width:".$widthtitle."px;background-color:".$colortitle.";color:".$colorfont.";float:left;position:relative;height:30px;line-height:15px;font-size:11px;padding:3px;font-weight:bold;text-align:center;}";
$style .= "\n.".$storename."store-image img{display: block;border:0px;margin: auto;}";
$style .= "\n.".$storename."store-footer{width:".$width."px;background-color:".$colorfooter.";float:left;position:relative;min-height:137px;}";
$style .= "\n.".$storename."store-description{width:".$widthtitle."px;color:".$colorfont.";position:relative;top:5px;left:5px;height:90px;line-height:14px;font-size:10px;overflow:auto;}";
$style .= "\n.".$storename."store-more{min-height:20px; width:".$widthtitle."px;position: relative;float: left;margin-top:10px;margin-left:5px;margin-bottom: 5px;}";
$style .= "\n.".$storename."store-more img{margin:0px !important;}";
$style .= "\n.".$storename."store-price {border: 0 solid #65B9C1;color: #4E4E4E !important;float: right;font-size: 12px !important;font-weight: bold !important;height: 30px !important;position: relative;text-align: center !important;width: 80px !important;}";
$style .= "\n.".$storename."store-price table {height:29px;width:79px;background-color: ".$colorfooter." !important; border: 1px none !important;border-collapse: inherit !important;float: right;margin: 1px 0 1px 1px;text-align: center !important;}";
$style .= "\n.".$storename."store-price table tr {padding: 1px !important;}";
$style .= "\n.".$storename."store-price table tr td {padding: 1px !important;}";
$style .= "\n.".$storename."store-price table td, table th, table tr {border: 1px solid #CCCCCC;padding: 0 !important;}";
$style .= "\n.".$storename."store-price table td.euros {font-size: 12px !important;letter-spacing: -1px !important; }";
$style .= "\n.".$storename."store-price {background-color: ".$colorborder." !important;}";
$style .= "\n.".$storename."buttons a, .".$storename."buttons button {background-color: ".$colorbutton.";border: 1px solid ".$colorbutton.";bottom: 0;color: ".$colorbuttonfont.";cursor: pointer;display: block;float: left;font-size: 12px;font-weight: bold;margin-top: 0;padding: 5px 10px 5px 7px;position: relative;text-decoration: none;width: 100px;}";
$style .= "\n.".$storename."buttons button {overflow: visible;padding: 4px 10px 3px 7px;width: auto;}";
$style .= "\n.".$storename."buttons button[type] {line-height: 17px;padding: 5px 10px 5px 7px;}";
$style .= "\n.".$storename.":first-child + html button[type] {padding: 4px 10px 3px 7px;}";
$style .= "\n.".$storename."buttons button img, .".$storename."buttons a img {border: medium none;margin: 0 3px -3px 0 !important;padding: 0;}";
$style .= "\n.".$storename."button.regular, .".$storename."buttons a.regular {color: ".$colorbuttonfont.";}";
$style .= "\n.".$storename."buttons a.regular:hover, button.regular:hover {background-color: #4E4E4E;border: 1px solid #4E4E4E;color: ".$colorbuttonfont.";}";
$style .= "\n.".$storename."buttons a.regular:active {background-color: #FFFFFF;border: 1px solid ".$colorbutton.";color: ".$colorbuttonfont.";}";
}
$style .= "\n.cleared {border: medium none;clear: both;float: none;font-size: 1px;margin: 0;padding: 0;}";
$style .= "\n.ttstorelink a { font-size:0px; }";
$style .= "</style>";
echo $style;
}
}
function show_ttuserpages($winkelvol)
{
if(isset($_GET['ipp'])){
if(is_numeric($_GET['ipp'])){
$itemsperpage = $_GET['ipp'];
} else {
$itemsperpage = "0";
}
} else {
$itemsperpage = "0";
}
$userperpage = "<form action=\"\" method=\"get\" name=\"itemsperpage\" >";
if(isset($_GET['pmax'])){
if(is_numeric($_GET['pmax'])){
$userperpage .= "<input type=\"hidden\" value=\"".$_GET['pmax']."\" name=\"pmax\">";
}
}
if(isset($_GET['pmin'])){
if(is_numeric($_GET['pmin'])){
$userperpage .= "<input type=\"hidden\" value=\"".$_GET['pmin']."\" name=\"pmin\">";
}
}
$userperpage .= __('Items per page:','ttstore');
$userperpage .= "<select name=\"ipp\" onchange=\"this.form.submit();\">";
$userperpage .= "<option name=\"\"> </option>";
$userperpage .= "<option name=\"10\"";
if($itemsperpage == "10"){
$userperpage .= "selected";
}
$userperpage .= ">10</option>";
$userperpage .= "<option name=\"20\"";
if($itemsperpage == "20"){
$userperpage .= "selected";
}
$userperpage .= ">20</option>";
$userperpage .= "<option name=\"50\"";
if($itemsperpage == "50"){
$userperpage .= "selected";
}
$userperpage .= ">50</option>";
$userperpage .= "<option name=\"100\"";
if($itemsperpage == "100"){
$userperpage .= "selected";
}
$userperpage .= ">100</option>";
$userperpage .= "</select>";
$userperpage .= "</form>";
return $userperpage;
}
function show_ttfilter($winkelvol)
{
global $wpdb;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
$max_price = $wpdb->get_var( "SELECT multimaxprice FROM $ttstoremultitable where id='".$winkelvol."';" );
if ($max_price == "0") {
$max_price = $wpdb->get_var( "SELECT MAX(price) FROM $ttstoretable;" );
$max_price = round($max_price+1);
}
if(isset($_GET['ipp'])){
if(is_numeric($_GET['ipp'])){
$ipp = $_GET['ipp'];
} else {
$ipp = "10";
}
} else {
$ipp = "10";
}
if(isset($_GET['pmin']) && isset($_GET['pmax'])){
if(is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
$min_price = $_GET['pmin'];
$max_pricecur = $_GET['pmax'];
} else {
$min_price = "0";
$max_pricecur = $max_price;
}
} else {
$min_price = "0";
$max_pricecur = $max_price;
}
$filter = "<style>#demo-frame > div.demo { padding: 10px !important; };</style>";
$filter .= "<script type='text/javascript'>
jQuery(document).ready(function($) {
$(function() {
$( \"#slider-range\" ).slider({
range: true,
min: 0,
max: ".$max_price.",
values: [ ".$min_price.", ".$max_pricecur." ],
slide: function( event, ui ) {
$( \"#amount\" ).val( \"\u20AC\" + ui.values[ 0 ] + \" - \u20AC\" + ui.values[ 1 ] );
}, change: function(event, ui) {
location.href = '?ipp=".$ipp."&tsp=0&pmin=' + ui.values[0] + '&pmax=' + ui.values[1] ;
}
});
$( \"#amount\" ).val( \"\u20AC\" + $( \"#slider-range\" ).slider( \"values\", 0 ) +
\" - \u20AC\" + $( \"#slider-range\" ).slider( \"values\", 1 ) );
})});
</script>
<div class=\"demo\">
<p>
<label for=\"amount\">".__('Price range:','ttstore')."</label>
<input type=\"text\" readonly=\"readonly\" id=\"amount\" style=\"border:0; color:#f6931f; font-weight:bold;\" />
</p>
<div id=\"slider-range\"></div>
</div><!-- End demo -->";
return $filter;
}
function show_ttpages($winkelvol)
{
global $wpdb;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
global $ttstorecattable;
$multi=$wpdb->get_results("SELECT multiamount, multiitems, multipageamount, categories, multixmlfeed, multimaxprice, count(".$ttstoreitemtable.".id) as totalitems FROM ".$ttstoremultitable." left join ".$ttstoreitemtable." on ".$ttstoremultitable.".id = ".$ttstoreitemtable.".storeID where ".$ttstoremultitable.".id=".$winkelvol." group by storeID, multiname");
foreach ($multi as $multi_val){
$Tradetracker_productid = $multi_val->totalitems;
$Tradetracker_amount = $multi_val->multiamount;
if($multi_val->multixmlfeed == "*" ){
$multixmlfeed = "";
} else {
$multixmlfeed = "and xmlfeed = ".$multi_val->multixmlfeed." ";
}
$i="1";
$categories = unserialize($multi_val->categories);
if(!empty($categories)){
foreach ($categories as $categories){
if($i == "1" ) {
if($multixmlfeed == ""){
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}else {
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}
$i = "2";
} else {
$categorieselect .= " or ".$ttstorecattable.".categorieid = \"".$categories."\"";
}
}
$categorieselect .= ") ";
} else {
$categorieselect = "";
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
if($multixmlfeed == ""){
if($categorieselect == ""){
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else if ( $multi_val->multimaxprice > "0" ) {
$priceselect = " and price > '0' and price < ".$multi_val->multimaxprice."";
} else {
$priceselect = "";
}
if($multi_val->multipageamount > "0" || (isset($_GET['ipp']) && is_numeric($_GET['ipp']) )){
if ($Tradetracker_productid == "0")
{
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "LIMIT ".$Tradetracker_productid;
} else if ($Tradetracker_productid < $multi_val->multiamount){
$Tradetracker_amount_i = "LIMIT ".$Tradetracker_productid;
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
}
if(isset($_GET['ipp']) && is_numeric($_GET['ipp']) && $_GET['ipp']>"0"){
$itemsperpage = mysql_real_escape_string($_GET['ipp']);
} else {
$itemsperpage = $multi_val->multipageamount;
}
$pages = ceil($totalitems / $itemsperpage)-1;
if(isset($_GET['tsp']) && is_numeric($_GET['tsp'])){
$currentpage = mysql_real_escape_string($_GET['tsp']);
$nextpage = $currentpage * $multi_val->multipageamount;
} else {
$currentpage = "0";
$nextpage = $currentpage + $multi_val->multipageamount;
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
$min_price = "&pmin=".$_GET['pmin'];
$max_pricecur = "&pmax=".$_GET['pmax'];
} else {
$min_price = "";
$max_pricecur = "";
}
if($pages > "0"){
$pagetext ="";
if ($currentpage != 0) { // Don't show back link if current page is first page.
$back_page = $currentpage - "1";
$pagetext = "<a class=\"ttbackpage\" href=\"?ipp=".$itemsperpage."&tsp=".$back_page."".$min_price."".$max_pricecur."\">".__('back','ttstore')."</a>\n";
}
for ($i=0; $i <= $pages; $i++){
if ($i == $currentpage){
$pagetext .= "<b>$i</b> \n"; // If current page don't give link, just text.
}else{
if ($currentpage <= $i-5){
$pagetext .= "<a class=\"ttmorethan5\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
} else if ($currentpage >= $i+5){
$pagetext .= "<a class=\"ttlessthan5\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
} else {
$pagetext .= "<a class=\"ttinbetween\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
}
}
}
if ($currentpage < $pages ) { // If last page don't give next link.
$next_page = $currentpage + "1";
$pagetext .= "<a class=\"ttnextpage\" href=\"?ipp=".$itemsperpage."&tsp=".$next_page."".$min_price."".$max_pricecur."\">".__('next','ttstore')."</a>\n";
}
}
}
}
if(isset($pagetext)){
return $pagetext;
}
}
function show_items($usedhow, $winkelvol, $searching)
{
global $wpdb;
global $ttstorelayouttable;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
global $folderhome;
global $ttstoreextratable;
global $ttstorecattable;
global $pagetext;
$wpdb->show_errors();
if ($searching == "1") {
$multi=$wpdb->get_results("SELECT buynow, multimaxprice, multisorting, multiorder, categories, multixmlfeed, multiproductpage, multiname, laywidth, multiamount, multipageamount, multilightbox FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id and ".$ttstoremultitable.".id=".get_option("Tradetracker_searchlayout")."");
} else {
$multi=$wpdb->get_results("SELECT buynow, multimaxprice, multisorting, multiorder, categories, multixmlfeed, multiproductpage, multiname, laywidth, multiamount, multipageamount, multilightbox FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id and ".$ttstoremultitable.".id=".$winkelvol."");
}
foreach ($multi as $multi_val){
$Tradetracker_amount = $multi_val->multiamount;
$nonexisting = $wpdb->get_results("SELECT productID from ".$ttstoreitemtable." where storeID = ".$winkelvol."");
if(count($nonexisting)>0){
$Tradetracker_productid = array();
foreach($nonexisting as $term){
$Tradetracker_productid[] = $term->productID;
}
$Tradetracker_productid = implode(",", $Tradetracker_productid);
}
if($multi_val->multixmlfeed == "*" ){
$multixmlfeed = "";
} else {
$multixmlfeed = "and xmlfeed = ".$multi_val->multixmlfeed." ";
}
if($multi_val->multiproductpage == "1" ){
$multiproductpage = "1";
} else {
$multiproductpage = "0";
}
$i="1";
$categories = unserialize($multi_val->categories);
if(!empty($categories)){
foreach ($categories as $categories){
if($i == "1" ) {
if($multixmlfeed == ""){
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}else {
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}
$i = "2";
} else {
$categorieselect .= " or ".$ttstorecattable.".categorieid = \"".$categories."\"";
}
}
$categorieselect .= ") ";
} else {
$categorieselect = "";
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
if($multixmlfeed == ""){
if($categorieselect == ""){
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
$priceselectcur = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}else if ( $multi_val->multimaxprice > "0" ) {
$priceselect = " and price > '0' and price < ".$multi_val->multimaxprice."";
} else {
$priceselect = "";
$priceselectcur = "";
}
if( $multi_val->buynow == "" ){
$buynow= "Buy Item";
} else {
$buynow= $multi_val->buynow;
}
if($multi_val->multipageamount > "0" || (isset($_GET['ipp']) && is_numeric($_GET['ipp']))){
if (!isset($Tradetracker_productid) || $Tradetracker_productid == null)
{
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$productID = $Tradetracker_productid;
$productID = str_replace(",", "' or ".$ttstoretable.".productID='", $productID);
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and (".$ttstoretable.".productID='".$productID."') ".$priceselectcur." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
}
if(isset($_GET['ipp']) && is_numeric($_GET['ipp']) && $_GET['ipp']>"0"){
$itemsperpage = mysql_real_escape_string($_GET['ipp']);
} else {
$itemsperpage = $multi_val->multipageamount;
}
$pages = ceil($totalitems / $itemsperpage)-1;
if(isset($_GET['tsp']) && is_numeric($_GET['tsp'])){
$currentpage = mysql_real_escape_string($_GET['tsp']);
$nextpage = $currentpage * $multi_val->multipageamount;
if($totalitems <= $nextpage ){
$Tradetracker_amount_i = "LIMIT ".$nextpage.", ".$totalitems."";
} else {
$Tradetracker_amount_i = "LIMIT ".$nextpage.", ".$itemsperpage."";
}
} else {
$currentpage = "0";
$nextpage = $currentpage + $multi_val->multipageamount;
if($totalitems <= $nextpage ){
$Tradetracker_amount_i = "LIMIT ".$currentpage.", ".$totalitems."";
} else {
$Tradetracker_amount_i = "LIMIT ".$currentpage.", ".$itemsperpage."";
}
}
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
}
if( $multi_val->laywidth == "" ){
$width= "250";
} else {
$width= $multi_val->laywidth;
}
$multisorting = $multi_val->multisorting;
if(isset($multisorting) && $multisorting=="categorie"){
$multisorting = $ttstorecattable.".".$multisorting;
}
$multiorder = $multi_val->multiorder;
$widthtitle = $width-6;
$widthmore = $width-10;
$storename = create_slug($multi_val->multiname);
if($multi_val->multilightbox==1){
$uselightbox = "1";
} else {
$uselightbox = "0";
}
}
if ($searching == "1") {
if(!empty($multisorting)){
$multisorting = ", ".$multisorting;
}
$term = mysql_real_escape_string(get_search_query());
$visits=$wpdb->get_results("SELECT *, MATCH(name,description) AGAINST ('$term' IN BOOLEAN MODE) as relevance FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and MATCH(name,description) AGAINST ('$term' IN BOOLEAN MODE) group by ".$ttstoretable.".productID ORDER BY relevance DESC ".$Tradetracker_amount_i."");
} else {
if (!isset($Tradetracker_productid) || $Tradetracker_productid == null)
{
$visits=$wpdb->get_results("SELECT * FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ORDER BY ".$multisorting." ".$multiorder." ".$Tradetracker_amount_i."");
} else {
$productID = $Tradetracker_productid;
$productID = str_replace(",", "' or ".$ttstoretable.".productID='", $productID);
$visits=$wpdb->get_results("SELECT * FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and (".$ttstoretable.".productID='".$productID."') ".$priceselectcur." group by ".$ttstoretable.".productID ORDER BY ".$multisorting." ".$multiorder." ".$Tradetracker_amount_i."");
}
}
$storeitems = "";
$i="1";
foreach ($visits as $product){
$Tradetracker_extra_val = get_option("Tradetracker_extra");
if(!empty($Tradetracker_extra_val)){
$extraname = "";
$extravar = "";
$extras = $wpdb->get_results("SELECT extravalue, extrafield FROM $ttstoreextratable where productID='".$product->productID."'", ARRAY_A);
foreach ($extras as $extra) {
$Tradetracker_extra_val = get_option("Tradetracker_extra");
if(!empty($Tradetracker_extra_val)){
if(in_array($extra['extrafield'], $Tradetracker_extra_val, true)) {
$extraname .= "<tr><td width=\"50\"><b>".$extra['extrafield']."</b></td><td>".$extra['extravalue']."</td></tr>";
}
}
}
if($extraname != ""){
$moretext = __('More info', 'ttstore');
$more = "<div class=\"".$storename."store-more\">
<img src=\"/wp-content/plugins/tradetracker-store/images/more.png\" style=\"border:0;\" border=\"0\" name=\"img".$i."\" width=\"11\" height=\"13\" border=\"0\" >
<a href=\"#first\" onClick=\"shoh('".$i."');\" >".$moretext."</a>
<div style=\"display: none;\" id=\"".$i."\" >
<table style=\"width:".$widthmore."px;\" width=\"".$widthmore."\">".$extraname."</table>
</div>
</div>";
} else {
$more = "<div class=\"".$storename."store-more\"></div>";
}
} else {
$more = "<div class=\"".$storename."store-more\"></div>";
}
$outpage = get_option('Tradetracker_outpageURL');
if($multiproductpage == "1" ){
$producturl = "".get_option("Tradetracker_productpageURL")."?ttproductid=".$product->productID."";
$urltarget ="";
$rel = "";
} elseif (isset($outpage) && !empty($outpage)){
$producturl = "".$outpage."?id=".$product->productID."";
$urltarget ="target=\"_blank\"";
$rel = "";
} else {
$producturl = htmlspecialchars($product->productURL);
$urltarget ="target=\"_blank\"";
$rel = "rel=\"nofollow\"";
}
if($product->imageURL==""){
$imageURL = plugins_url( 'images/No_image.png' , __FILE__ );
} else {
$imageURL = $product->imageURL;
}
if($uselightbox==1){
$image = $imageURL;
$target = "";
$rel = "";
$imagerel = "rel=\"lightbox[store]\"";
} else {
$image = $producturl;
$target = $urltarget;
$imagerel = "";
}
$productname = html_entity_decode($product->name, ENT_QUOTES,'UTF-8');
$productname = str_replace("&", "&", $productname);
$productdescription = $product->description;
//$productdescription = mb_convert_encoding($product->description, "UTF-8");
//$productdescription = str_replace("&", "&", $productdescription);
if(get_option("Tradetracker_currency")=="1") {
$curarray = get_option("Tradetracker_newcur");
$key = $product->currency;
if(isset($curarray) && !empty($curarray)){
if(isset($key)){
$currency = $curarray[$key];
} else {
$currency = $product->currency;
}
} else {
$currency = $product->currency;
}
} else {
$currency = $product->currency;
}
if(get_option("Tradetracker_currencyloc")=="1") {
$price = $product->price." ".$currency;
}else {
$price = $currency." ".$product->price;
}
if(function_exists(showproviderlogo)){
$logo = showproviderlogo($product->xmlfeed, $storename);
} else {
$logo = "";
}
$storeitems .= "<div class=\"".$storename."store-outerbox store-outerbox\">
<div class=\"".$storename."store-timer store-timer\"> </div>
<div class=\"".$storename."store-logo store-logo\">
<div class=\"".$storename."store-logo-image store-logo-image\"></div>
</div>
<div class=\"".$storename."store-image store-image\">
<a href=\"".$image."\" ".$rel." ".$imagerel." ".$target.">
<img src=\"".$imageURL."\" alt=\"".$productname."\" title=\"".$productname."\"/>
</a>
</div>
<div class=\"".$storename."store-titel store-titel\">
".$productname."
</div>
<div class=\"".$storenam."store-price-div store-price-div\">
<div class=\"".$storename."store-price store-price\">
<a href=\"".$producturl."\" ".$rel." class=\"regular\" ".$urltarget." title=\"".$productname."\">
".$price."
</a>
</div>
</div>
<div class=\"".$storename."store-footer store-footer\">
".$more."
<div class=\"".$storename."buttons buttons\">
<a href=\"".$producturl."\" ".$rel." class=\"regular\" ".$urltarget." title=\"".$productname."\">
".$buynow."
</a>
</div>
</div>
</div>";
$i++;
}
$storeitems .= "<div class=\"cleared\"></div>";
if(get_option("Tradetracker_showurl")=="1"){
$storeitems .= "<div class=\"ttstorelink\"><a target=\"_blank\" href=\"http://wpaffiliatefeed.com\">TradeTracker wordpress plugin</a></div>";
}
$storeitems .= "<!-- These items are shown using the TradeTracker Store plugin - http://wpaffiliatefeed.com -->";
if ($usedhow == 1){
return $storeitems;
}
if ($usedhow == 2){
echo $storeitems;
}
}
add_shortcode('user_pages', 'display_store_userpages_short');
function display_store_userpages_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttuserpages($store);
}
add_shortcode('display_pages', 'display_store_pages_short');
function display_store_pages_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttpages($store);
}
add_shortcode('display_filter', 'display_store_filter_short');
function display_store_filter_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttfilter($store);
}
add_shortcode('display_store', 'display_store_items_short');
function display_store_items_short()
{
return store_items(1, 0, 0);
}
function display_store_items()
{
return store_items(2, 0, 0);
}
add_shortcode('display_multi', 'display_multi_items_short');
function display_multi_items_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return store_items(1, $store, 0);
}
function display_multi_items($store)
{
return store_items(2, $store, 0);
}
add_shortcode('display_search', 'display_search_items_short');
function display_search_items_short()
{
return store_items(1, 1, 1);
}
function display_search_items()
{
return store_items(2, 1, 1);
}
?>
/*
..--==[ Function to add the stylesheet for the store ]==--..
*/
function TTstore_scripts() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script( 'ttstoreexpand-script', WP_PLUGIN_URL . '/tradetracker-store/js/expand.js');
$ttslidertheme = get_option("Tradetracker_slidertheme");
if($ttslidertheme == ""){
$ttslidertheme = "base";
}
if(get_option("Tradetracker_usecss") == "1"){
wp_register_style( 'tt_store_css', get_option('Tradetracker_csslink'));
wp_enqueue_style( 'tt_store_css');
}
wp_register_style( 'tt_slider_css', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css");
wp_enqueue_style( 'tt_slider_css');
}
add_action('wp_enqueue_scripts', 'TTstore_scripts');
function store_items($used, $winkel, $searching)
{
global $wpdb;
global $ttstorexmltable;
$wpdb->get_var( "SELECT COUNT(*) FROM $ttstorexmltable;" );
if($tradetracker_xml>0)
{
_e('No XML filled in yet please change the settings first.', 'ttstore');
} else {
return show_items($used, $winkel, $searching);
}
}
/*
..--==[ Function to show the items. ]==--..
*/
add_action('wp_head', 'header_css_style');
function header_css_style() {
global $wpdb;
$ttslidertheme = get_option("Tradetracker_slidertheme");
if($ttslidertheme == ""){
$ttslidertheme = "base";
}
if(get_option("Tradetracker_usecss") == "1"){
//echo "<link rel=\"stylesheet\" href=\"".get_option('Tradetracker_csslink')."\" type=\"text/css\" />";
//echo "<link href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\"/>";
} else {
//echo "<link href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/".$ttslidertheme."/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\"/>";
$style="";
global $ttstorelayouttable;
global $ttstoremultitable;
$style .= "<style type=\"text/css\" media=\"screen\">";
$multi=$wpdb->get_results("SELECT multiname, laywidth, layfont, laycolortitle, laycolorbuttonfont, laycolorbutton, laycolorborder, laycolorfooter, laycolorimagebg, laycolorfont FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id");
foreach ($multi as $multi_val){
$i="1";
if( $multi_val->laywidth == "" ){
$width= "250";
} else {
$width= $multi_val->laywidth;
}
if( $multi_val->layfont == "" ){
$font= "Verdana";
} else {
$font= $multi_val->layfont;
}
$widthtitle = $width-6;
$widthmore = $width-10;
if( $multi_val->laycolortitle == "" ){
$colortitle = "#ececed";
} else {
$colortitle = $multi_val->laycolortitle;
}
if( $multi_val->laycolorfooter == "" ){
$colorfooter = "#ececed";
} else {
$colorfooter = $multi_val->laycolorfooter;
}
if( $multi_val->laycolorimagebg == "" ){
$colorimagebg = "#ffffff";
} else {
$colorimagebg = $multi_val->laycolorimagebg;
}
if( $multi_val->laycolorfont == "" ){
$colorfont = "#000000";
} else {
$colorfont = $multi_val->laycolorfont;
}
if( $multi_val->laycolorborder == "" ){
$colorborder = "#65B9C1";
} else {
$colorborder = $multi_val->laycolorborder;
}
if( $multi_val->laycolorbutton == "" ){
$colorbutton = "#65B9C1";
} else {
$colorbutton = $multi_val->laycolorbutton;
}
if( $multi_val->laycolorbuttonfont == "" ){
$colorbuttonfont = "#ffffff";
} else {
$colorbuttonfont = $multi_val->laycolorbuttonfont;
}
$storename = create_slug($multi_val->multiname);
$style .= "\n.".$storename."store-outerbox{width:".$width."px;color:".$colorfont.";font-family:".$font.";float:left;margin:0px 15px 15px 0;min-height:353px;border:solid 1px ".$colorborder.";position:relative;}";
$style .= "\n.".$storename."store-titel{width:".$widthtitle."px;background-color:".$colortitle.";color:".$colorfont.";float:left;position:relative;height:30px;line-height:15px;font-size:11px;padding:3px;font-weight:bold;text-align:center;}";
$style .= "\n.".$storename."store-image img{display: block;border:0px;margin: auto;}";
$style .= "\n.".$storename."store-footer{width:".$width."px;background-color:".$colorfooter.";float:left;position:relative;min-height:137px;}";
$style .= "\n.".$storename."store-description{width:".$widthtitle."px;color:".$colorfont.";position:relative;top:5px;left:5px;height:90px;line-height:14px;font-size:10px;overflow:auto;}";
$style .= "\n.".$storename."store-more{min-height:20px; width:".$widthtitle."px;position: relative;float: left;margin-top:10px;margin-left:5px;margin-bottom: 5px;}";
$style .= "\n.".$storename."store-more img{margin:0px !important;}";
$style .= "\n.".$storename."store-price {border: 0 solid #65B9C1;color: #4E4E4E !important;float: right;font-size: 12px !important;font-weight: bold !important;height: 30px !important;position: relative;text-align: center !important;width: 80px !important;}";
$style .= "\n.".$storename."store-price table {height:29px;width:79px;background-color: ".$colorfooter." !important; border: 1px none !important;border-collapse: inherit !important;float: right;margin: 1px 0 1px 1px;text-align: center !important;}";
$style .= "\n.".$storename."store-price table tr {padding: 1px !important;}";
$style .= "\n.".$storename."store-price table tr td {padding: 1px !important;}";
$style .= "\n.".$storename."store-price table td, table th, table tr {border: 1px solid #CCCCCC;padding: 0 !important;}";
$style .= "\n.".$storename."store-price table td.euros {font-size: 12px !important;letter-spacing: -1px !important; }";
$style .= "\n.".$storename."store-price {background-color: ".$colorborder." !important;}";
$style .= "\n.".$storename."buttons a, .".$storename."buttons button {background-color: ".$colorbutton.";border: 1px solid ".$colorbutton.";bottom: 0;color: ".$colorbuttonfont.";cursor: pointer;display: block;float: left;font-size: 12px;font-weight: bold;margin-top: 0;padding: 5px 10px 5px 7px;position: relative;text-decoration: none;width: 100px;}";
$style .= "\n.".$storename."buttons button {overflow: visible;padding: 4px 10px 3px 7px;width: auto;}";
$style .= "\n.".$storename."buttons button[type] {line-height: 17px;padding: 5px 10px 5px 7px;}";
$style .= "\n.".$storename.":first-child + html button[type] {padding: 4px 10px 3px 7px;}";
$style .= "\n.".$storename."buttons button img, .".$storename."buttons a img {border: medium none;margin: 0 3px -3px 0 !important;padding: 0;}";
$style .= "\n.".$storename."button.regular, .".$storename."buttons a.regular {color: ".$colorbuttonfont.";}";
$style .= "\n.".$storename."buttons a.regular:hover, button.regular:hover {background-color: #4E4E4E;border: 1px solid #4E4E4E;color: ".$colorbuttonfont.";}";
$style .= "\n.".$storename."buttons a.regular:active {background-color: #FFFFFF;border: 1px solid ".$colorbutton.";color: ".$colorbuttonfont.";}";
}
$style .= "\n.cleared {border: medium none;clear: both;float: none;font-size: 1px;margin: 0;padding: 0;}";
$style .= "\n.ttstorelink a { font-size:0px; }";
$style .= "</style>";
echo $style;
}
}
function show_ttuserpages($winkelvol)
{
if(isset($_GET['ipp'])){
if(is_numeric($_GET['ipp'])){
$itemsperpage = $_GET['ipp'];
} else {
$itemsperpage = "0";
}
} else {
$itemsperpage = "0";
}
$userperpage = "<form action=\"\" method=\"get\" name=\"itemsperpage\" >";
if(isset($_GET['pmax'])){
if(is_numeric($_GET['pmax'])){
$userperpage .= "<input type=\"hidden\" value=\"".$_GET['pmax']."\" name=\"pmax\">";
}
}
if(isset($_GET['pmin'])){
if(is_numeric($_GET['pmin'])){
$userperpage .= "<input type=\"hidden\" value=\"".$_GET['pmin']."\" name=\"pmin\">";
}
}
$userperpage .= __('Items per page:','ttstore');
$userperpage .= "<select name=\"ipp\" onchange=\"this.form.submit();\">";
$userperpage .= "<option name=\"\"> </option>";
$userperpage .= "<option name=\"10\"";
if($itemsperpage == "10"){
$userperpage .= "selected";
}
$userperpage .= ">10</option>";
$userperpage .= "<option name=\"20\"";
if($itemsperpage == "20"){
$userperpage .= "selected";
}
$userperpage .= ">20</option>";
$userperpage .= "<option name=\"50\"";
if($itemsperpage == "50"){
$userperpage .= "selected";
}
$userperpage .= ">50</option>";
$userperpage .= "<option name=\"100\"";
if($itemsperpage == "100"){
$userperpage .= "selected";
}
$userperpage .= ">100</option>";
$userperpage .= "</select>";
$userperpage .= "</form>";
return $userperpage;
}
function show_ttfilter($winkelvol)
{
global $wpdb;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
$max_price = $wpdb->get_var( "SELECT multimaxprice FROM $ttstoremultitable where id='".$winkelvol."';" );
if ($max_price == "0") {
$max_price = $wpdb->get_var( "SELECT MAX(price) FROM $ttstoretable;" );
$max_price = round($max_price+1);
}
if(isset($_GET['ipp'])){
if(is_numeric($_GET['ipp'])){
$ipp = $_GET['ipp'];
} else {
$ipp = "10";
}
} else {
$ipp = "10";
}
if(isset($_GET['pmin']) && isset($_GET['pmax'])){
if(is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
$min_price = $_GET['pmin'];
$max_pricecur = $_GET['pmax'];
} else {
$min_price = "0";
$max_pricecur = $max_price;
}
} else {
$min_price = "0";
$max_pricecur = $max_price;
}
$filter = "<style>#demo-frame > div.demo { padding: 10px !important; };</style>";
$filter .= "<script type='text/javascript'>
jQuery(document).ready(function($) {
$(function() {
$( \"#slider-range\" ).slider({
range: true,
min: 0,
max: ".$max_price.",
values: [ ".$min_price.", ".$max_pricecur." ],
slide: function( event, ui ) {
$( \"#amount\" ).val( \"\u20AC\" + ui.values[ 0 ] + \" - \u20AC\" + ui.values[ 1 ] );
}, change: function(event, ui) {
location.href = '?ipp=".$ipp."&tsp=0&pmin=' + ui.values[0] + '&pmax=' + ui.values[1] ;
}
});
$( \"#amount\" ).val( \"\u20AC\" + $( \"#slider-range\" ).slider( \"values\", 0 ) +
\" - \u20AC\" + $( \"#slider-range\" ).slider( \"values\", 1 ) );
})});
</script>
<div class=\"demo\">
<p>
<label for=\"amount\">".__('Price range:','ttstore')."</label>
<input type=\"text\" readonly=\"readonly\" id=\"amount\" style=\"border:0; color:#f6931f; font-weight:bold;\" />
</p>
<div id=\"slider-range\"></div>
</div><!-- End demo -->";
return $filter;
}
function show_ttpages($winkelvol)
{
global $wpdb;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
global $ttstorecattable;
$multi=$wpdb->get_results("SELECT multiamount, multiitems, multipageamount, categories, multixmlfeed, multimaxprice, count(".$ttstoreitemtable.".id) as totalitems FROM ".$ttstoremultitable." left join ".$ttstoreitemtable." on ".$ttstoremultitable.".id = ".$ttstoreitemtable.".storeID where ".$ttstoremultitable.".id=".$winkelvol." group by storeID, multiname");
foreach ($multi as $multi_val){
$Tradetracker_productid = $multi_val->totalitems;
$Tradetracker_amount = $multi_val->multiamount;
if($multi_val->multixmlfeed == "*" ){
$multixmlfeed = "";
} else {
$multixmlfeed = "and xmlfeed = ".$multi_val->multixmlfeed." ";
}
$i="1";
$categories = unserialize($multi_val->categories);
if(!empty($categories)){
foreach ($categories as $categories){
if($i == "1" ) {
if($multixmlfeed == ""){
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}else {
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}
$i = "2";
} else {
$categorieselect .= " or ".$ttstorecattable.".categorieid = \"".$categories."\"";
}
}
$categorieselect .= ") ";
} else {
$categorieselect = "";
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
if($multixmlfeed == ""){
if($categorieselect == ""){
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else if ( $multi_val->multimaxprice > "0" ) {
$priceselect = " and price > '0' and price < ".$multi_val->multimaxprice."";
} else {
$priceselect = "";
}
if($multi_val->multipageamount > "0" || (isset($_GET['ipp']) && is_numeric($_GET['ipp']) )){
if ($Tradetracker_productid == "0")
{
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "LIMIT ".$Tradetracker_productid;
} else if ($Tradetracker_productid < $multi_val->multiamount){
$Tradetracker_amount_i = "LIMIT ".$Tradetracker_productid;
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
}
if(isset($_GET['ipp']) && is_numeric($_GET['ipp']) && $_GET['ipp']>"0"){
$itemsperpage = mysql_real_escape_string($_GET['ipp']);
} else {
$itemsperpage = $multi_val->multipageamount;
}
$pages = ceil($totalitems / $itemsperpage)-1;
if(isset($_GET['tsp']) && is_numeric($_GET['tsp'])){
$currentpage = mysql_real_escape_string($_GET['tsp']);
$nextpage = $currentpage * $multi_val->multipageamount;
} else {
$currentpage = "0";
$nextpage = $currentpage + $multi_val->multipageamount;
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
$min_price = "&pmin=".$_GET['pmin'];
$max_pricecur = "&pmax=".$_GET['pmax'];
} else {
$min_price = "";
$max_pricecur = "";
}
if($pages > "0"){
$pagetext ="";
if ($currentpage != 0) { // Don't show back link if current page is first page.
$back_page = $currentpage - "1";
$pagetext = "<a class=\"ttbackpage\" href=\"?ipp=".$itemsperpage."&tsp=".$back_page."".$min_price."".$max_pricecur."\">".__('back','ttstore')."</a>\n";
}
for ($i=0; $i <= $pages; $i++){
if ($i == $currentpage){
$pagetext .= "<b>$i</b> \n"; // If current page don't give link, just text.
}else{
if ($currentpage <= $i-5){
$pagetext .= "<a class=\"ttmorethan5\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
} else if ($currentpage >= $i+5){
$pagetext .= "<a class=\"ttlessthan5\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
} else {
$pagetext .= "<a class=\"ttinbetween\" href=\"?ipp=".$itemsperpage."&tsp=".$i."".$min_price."".$max_pricecur."\">$i</a> \n";
}
}
}
if ($currentpage < $pages ) { // If last page don't give next link.
$next_page = $currentpage + "1";
$pagetext .= "<a class=\"ttnextpage\" href=\"?ipp=".$itemsperpage."&tsp=".$next_page."".$min_price."".$max_pricecur."\">".__('next','ttstore')."</a>\n";
}
}
}
}
if(isset($pagetext)){
return $pagetext;
}
}
function show_items($usedhow, $winkelvol, $searching)
{
global $wpdb;
global $ttstorelayouttable;
global $ttstoremultitable;
global $ttstoreitemtable;
global $ttstoretable;
global $folderhome;
global $ttstoreextratable;
global $ttstorecattable;
global $pagetext;
$wpdb->show_errors();
if ($searching == "1") {
$multi=$wpdb->get_results("SELECT buynow, multimaxprice, multisorting, multiorder, categories, multixmlfeed, multiproductpage, multiname, laywidth, multiamount, multipageamount, multilightbox FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id and ".$ttstoremultitable.".id=".get_option("Tradetracker_searchlayout")."");
} else {
$multi=$wpdb->get_results("SELECT buynow, multimaxprice, multisorting, multiorder, categories, multixmlfeed, multiproductpage, multiname, laywidth, multiamount, multipageamount, multilightbox FROM ".$ttstoremultitable.",".$ttstorelayouttable." where ".$ttstoremultitable.".multilayout=".$ttstorelayouttable.".id and ".$ttstoremultitable.".id=".$winkelvol."");
}
foreach ($multi as $multi_val){
$Tradetracker_amount = $multi_val->multiamount;
$nonexisting = $wpdb->get_results("SELECT productID from ".$ttstoreitemtable." where storeID = ".$winkelvol."");
if(count($nonexisting)>0){
$Tradetracker_productid = array();
foreach($nonexisting as $term){
$Tradetracker_productid[] = $term->productID;
}
$Tradetracker_productid = implode(",", $Tradetracker_productid);
}
if($multi_val->multixmlfeed == "*" ){
$multixmlfeed = "";
} else {
$multixmlfeed = "and xmlfeed = ".$multi_val->multixmlfeed." ";
}
if($multi_val->multiproductpage == "1" ){
$multiproductpage = "1";
} else {
$multiproductpage = "0";
}
$i="1";
$categories = unserialize($multi_val->categories);
if(!empty($categories)){
foreach ($categories as $categories){
if($i == "1" ) {
if($multixmlfeed == ""){
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}else {
$categorieselect = " and (".$ttstorecattable.".categorieid = \"".$categories."\"";
}
$i = "2";
} else {
$categorieselect .= " or ".$ttstorecattable.".categorieid = \"".$categories."\"";
}
}
$categorieselect .= ") ";
} else {
$categorieselect = "";
}
if(isset($_GET['pmin']) && isset($_GET['pmax']) && is_numeric($_GET['pmin']) && is_numeric($_GET['pmax'])){
if($multixmlfeed == ""){
if($categorieselect == ""){
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
} else {
$priceselect = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}
$priceselectcur = " and price > ".mysql_real_escape_string($_GET['pmin'])." and price < ".mysql_real_escape_string($_GET['pmax'])."";
}else if ( $multi_val->multimaxprice > "0" ) {
$priceselect = " and price > '0' and price < ".$multi_val->multimaxprice."";
} else {
$priceselect = "";
$priceselectcur = "";
}
if( $multi_val->buynow == "" ){
$buynow= "Buy Item";
} else {
$buynow= $multi_val->buynow;
}
if($multi_val->multipageamount > "0" || (isset($_GET['ipp']) && is_numeric($_GET['ipp']))){
if (!isset($Tradetracker_productid) || $Tradetracker_productid == null)
{
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
$productID = $Tradetracker_productid;
$productID = str_replace(",", "' or ".$ttstoretable.".productID='", $productID);
$totalitems=count($wpdb->get_results("SELECT id FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and (".$ttstoretable.".productID='".$productID."') ".$priceselectcur." group by ".$ttstoretable.".productID ".$Tradetracker_amount_i.""));
}
if(isset($_GET['ipp']) && is_numeric($_GET['ipp']) && $_GET['ipp']>"0"){
$itemsperpage = mysql_real_escape_string($_GET['ipp']);
} else {
$itemsperpage = $multi_val->multipageamount;
}
$pages = ceil($totalitems / $itemsperpage)-1;
if(isset($_GET['tsp']) && is_numeric($_GET['tsp'])){
$currentpage = mysql_real_escape_string($_GET['tsp']);
$nextpage = $currentpage * $multi_val->multipageamount;
if($totalitems <= $nextpage ){
$Tradetracker_amount_i = "LIMIT ".$nextpage.", ".$totalitems."";
} else {
$Tradetracker_amount_i = "LIMIT ".$nextpage.", ".$itemsperpage."";
}
} else {
$currentpage = "0";
$nextpage = $currentpage + $multi_val->multipageamount;
if($totalitems <= $nextpage ){
$Tradetracker_amount_i = "LIMIT ".$currentpage.", ".$totalitems."";
} else {
$Tradetracker_amount_i = "LIMIT ".$currentpage.", ".$itemsperpage."";
}
}
} else {
if ($multi_val->multiamount == "") {
$Tradetracker_amount_i = "LIMIT 12";
} else if ($multi_val->multiamount == "0") {
$Tradetracker_amount_i = "";
} else {
$Tradetracker_amount_i = "LIMIT ".$multi_val->multiamount."";
}
}
if( $multi_val->laywidth == "" ){
$width= "250";
} else {
$width= $multi_val->laywidth;
}
$multisorting = $multi_val->multisorting;
if(isset($multisorting) && $multisorting=="categorie"){
$multisorting = $ttstorecattable.".".$multisorting;
}
$multiorder = $multi_val->multiorder;
$widthtitle = $width-6;
$widthmore = $width-10;
$storename = create_slug($multi_val->multiname);
if($multi_val->multilightbox==1){
$uselightbox = "1";
} else {
$uselightbox = "0";
}
}
if ($searching == "1") {
if(!empty($multisorting)){
$multisorting = ", ".$multisorting;
}
$term = mysql_real_escape_string(get_search_query());
$visits=$wpdb->get_results("SELECT *, MATCH(name,description) AGAINST ('$term' IN BOOLEAN MODE) as relevance FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and MATCH(name,description) AGAINST ('$term' IN BOOLEAN MODE) group by ".$ttstoretable.".productID ORDER BY relevance DESC ".$Tradetracker_amount_i."");
} else {
if (!isset($Tradetracker_productid) || $Tradetracker_productid == null)
{
$visits=$wpdb->get_results("SELECT * FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID ".$multixmlfeed." ".$categorieselect." ".$priceselect." group by ".$ttstoretable.".productID ORDER BY ".$multisorting." ".$multiorder." ".$Tradetracker_amount_i."");
} else {
$productID = $Tradetracker_productid;
$productID = str_replace(",", "' or ".$ttstoretable.".productID='", $productID);
$visits=$wpdb->get_results("SELECT * FROM ".$ttstoretable.", ".$ttstorecattable." where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and (".$ttstoretable.".productID='".$productID."') ".$priceselectcur." group by ".$ttstoretable.".productID ORDER BY ".$multisorting." ".$multiorder." ".$Tradetracker_amount_i."");
}
}
$storeitems = "";
$i="1";
foreach ($visits as $product){
$Tradetracker_extra_val = get_option("Tradetracker_extra");
if(!empty($Tradetracker_extra_val)){
$extraname = "";
$extravar = "";
$extras = $wpdb->get_results("SELECT extravalue, extrafield FROM $ttstoreextratable where productID='".$product->productID."'", ARRAY_A);
foreach ($extras as $extra) {
$Tradetracker_extra_val = get_option("Tradetracker_extra");
if(!empty($Tradetracker_extra_val)){
if(in_array($extra['extrafield'], $Tradetracker_extra_val, true)) {
$extraname .= "<tr><td width=\"50\"><b>".$extra['extrafield']."</b></td><td>".$extra['extravalue']."</td></tr>";
}
}
}
if($extraname != ""){
$moretext = __('More info', 'ttstore');
$more = "<div class=\"".$storename."store-more\">
<img src=\"/wp-content/plugins/tradetracker-store/images/more.png\" style=\"border:0;\" border=\"0\" name=\"img".$i."\" width=\"11\" height=\"13\" border=\"0\" >
<a href=\"#first\" onClick=\"shoh('".$i."');\" >".$moretext."</a>
<div style=\"display: none;\" id=\"".$i."\" >
<table style=\"width:".$widthmore."px;\" width=\"".$widthmore."\">".$extraname."</table>
</div>
</div>";
} else {
$more = "<div class=\"".$storename."store-more\"></div>";
}
} else {
$more = "<div class=\"".$storename."store-more\"></div>";
}
$outpage = get_option('Tradetracker_outpageURL');
if($multiproductpage == "1" ){
$producturl = "".get_option("Tradetracker_productpageURL")."?ttproductid=".$product->productID."";
$urltarget ="";
$rel = "";
} elseif (isset($outpage) && !empty($outpage)){
$producturl = "".$outpage."?id=".$product->productID."";
$urltarget ="target=\"_blank\"";
$rel = "";
} else {
$producturl = htmlspecialchars($product->productURL);
$urltarget ="target=\"_blank\"";
$rel = "rel=\"nofollow\"";
}
if($product->imageURL==""){
$imageURL = plugins_url( 'images/No_image.png' , __FILE__ );
} else {
$imageURL = $product->imageURL;
}
if($uselightbox==1){
$image = $imageURL;
$target = "";
$rel = "";
$imagerel = "rel=\"lightbox[store]\"";
} else {
$image = $producturl;
$target = $urltarget;
$imagerel = "";
}
$productname = html_entity_decode($product->name, ENT_QUOTES,'UTF-8');
$productname = str_replace("&", "&", $productname);
$productdescription = $product->description;
//$productdescription = mb_convert_encoding($product->description, "UTF-8");
//$productdescription = str_replace("&", "&", $productdescription);
if(get_option("Tradetracker_currency")=="1") {
$curarray = get_option("Tradetracker_newcur");
$key = $product->currency;
if(isset($curarray) && !empty($curarray)){
if(isset($key)){
$currency = $curarray[$key];
} else {
$currency = $product->currency;
}
} else {
$currency = $product->currency;
}
} else {
$currency = $product->currency;
}
if(get_option("Tradetracker_currencyloc")=="1") {
$price = $product->price." ".$currency;
}else {
$price = $currency." ".$product->price;
}
if(function_exists(showproviderlogo)){
$logo = showproviderlogo($product->xmlfeed, $storename);
} else {
$logo = "";
}
$storeitems .= "<div class=\"".$storename."store-outerbox store-outerbox\">
<div class=\"".$storename."store-timer store-timer\"> </div>
<div class=\"".$storename."store-logo store-logo\">
<div class=\"".$storename."store-logo-image store-logo-image\"></div>
</div>
<div class=\"".$storename."store-image store-image\">
<a href=\"".$image."\" ".$rel." ".$imagerel." ".$target.">
<img src=\"".$imageURL."\" alt=\"".$productname."\" title=\"".$productname."\"/>
</a>
</div>
<div class=\"".$storename."store-titel store-titel\">
".$productname."
</div>
<div class=\"".$storenam."store-price-div store-price-div\">
<div class=\"".$storename."store-price store-price\">
<a href=\"".$producturl."\" ".$rel." class=\"regular\" ".$urltarget." title=\"".$productname."\">
".$price."
</a>
</div>
</div>
<div class=\"".$storename."store-footer store-footer\">
".$more."
<div class=\"".$storename."buttons buttons\">
<a href=\"".$producturl."\" ".$rel." class=\"regular\" ".$urltarget." title=\"".$productname."\">
".$buynow."
</a>
</div>
</div>
</div>";
$i++;
}
$storeitems .= "<div class=\"cleared\"></div>";
if(get_option("Tradetracker_showurl")=="1"){
$storeitems .= "<div class=\"ttstorelink\"><a target=\"_blank\" href=\"http://wpaffiliatefeed.com\">TradeTracker wordpress plugin</a></div>";
}
$storeitems .= "<!-- These items are shown using the TradeTracker Store plugin - http://wpaffiliatefeed.com -->";
if ($usedhow == 1){
return $storeitems;
}
if ($usedhow == 2){
echo $storeitems;
}
}
add_shortcode('user_pages', 'display_store_userpages_short');
function display_store_userpages_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttuserpages($store);
}
add_shortcode('display_pages', 'display_store_pages_short');
function display_store_pages_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttpages($store);
}
add_shortcode('display_filter', 'display_store_filter_short');
function display_store_filter_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return show_ttfilter($store);
}
add_shortcode('display_store', 'display_store_items_short');
function display_store_items_short()
{
return store_items(1, 0, 0);
}
function display_store_items()
{
return store_items(2, 0, 0);
}
add_shortcode('display_multi', 'display_multi_items_short');
function display_multi_items_short($store)
{
extract(shortcode_atts(array("store" => '0'), $store));
return store_items(1, $store, 0);
}
function display_multi_items($store)
{
return store_items(2, $store, 0);
}
add_shortcode('display_search', 'display_search_items_short');
function display_search_items_short()
{
return store_items(1, 1, 1);
}
function display_search_items()
{
return store_items(2, 1, 1);
}
?>
En dan moet in deze div <div class=\"".$storename."store-timer store-timer\"> </div>
de countdown komen.
Jij gebruikt overal dubbele aanhalingstekens.
Dat maakt het wat lastiger, omdat je telkens een \ voor de " moet zettten.
Nu, het is wat te veel code om dat te veranderen.
Dit kan je rechtstreeks in jouw code inplanten:
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
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
<?php
...
// lijn 654
$storeitems .= "
<div class=\"".$storename."store-outerbox store-outerbox\">
<div id=\"demo\" class=\"".$storename."store-timer store-timer\"> </div>
<script>
(function() {
var d=new Date();
var tomorrow = new Date(d.getTime() + 24 * 60 * 60 * 1000);
tomorrow.setHours(0);
tomorrow.setMinutes(0);
tomorrow.setSeconds(0);
var target_date = tomorrow;
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdown = document.getElementById('demo');
// update the tag with id 'countdown' every 1 second
setInterval(function () {
// find the amount of 'seconds' between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value
countdown.innerHTML = hours + ':' + minutes + ':' + seconds ;
}, 1000);
})();
</script>
<div class=\"".$storename."store-logo store-logo\">
<div class=\"".$storename."store-logo-image store-logo-image\"></div>
...
";
...?>
...
// lijn 654
$storeitems .= "
<div class=\"".$storename."store-outerbox store-outerbox\">
<div id=\"demo\" class=\"".$storename."store-timer store-timer\"> </div>
<script>
(function() {
var d=new Date();
var tomorrow = new Date(d.getTime() + 24 * 60 * 60 * 1000);
tomorrow.setHours(0);
tomorrow.setMinutes(0);
tomorrow.setSeconds(0);
var target_date = tomorrow;
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdown = document.getElementById('demo');
// update the tag with id 'countdown' every 1 second
setInterval(function () {
// find the amount of 'seconds' between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value
countdown.innerHTML = hours + ':' + minutes + ':' + seconds ;
}, 1000);
})();
</script>
<div class=\"".$storename."store-logo store-logo\">
<div class=\"".$storename."store-logo-image store-logo-image\"></div>
...
";
...?>
De ... aanvullen met jouw code
Gewijzigd op 21/10/2013 11:21:27 door Kris Peeters
Zie (www. kiesaanbieding.nl)
id moet uniek zijn.
Stel dat iedereen "Jan Klaas" zou heten, dan zou je "Jan Klaas" niet meer kunnen gebruiken om iemand te identificeren. Juist?
Dus ...
in de div heb je
<div id=\"demo\" ...>
en in de javascript heb je
var countdown = document.getElementById('demo');
Daar komt demo dus overeen.
ALs je bij de tweede timer demo verandert door demo2, zowel in de div als in javascript; heb je er dus twee.
Of noem het hoe je wil.
Nog 12 uur en 22 minuten
THANKS!!
Gewijzigd op 21/10/2013 11:41:13 door Kris Peeters
Gewijzigd op 21/10/2013 11:44:06 door Eddy Achterberg
Als je het niet te erg vind; ik zou het zo laten.