forked from vicksWalkiria/AffiliateTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
detalle.php
631 lines (526 loc) · 26.5 KB
/
detalle.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
<?php include('includes/constants.php');
include('includes/conexion.php');
include('includes/initializerDetail.php');?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="【 Reseña del <?php echo $productSing." ".$product['name']?> 】" />
<meta name="author" content="<?php echo $domain?>" />
<meta name="Keywords" content="<?php echo $productSing." ".$product['name']?>"/>
<meta name="googlebot" content="all"/>
<meta name="googlebot" content="index"/>
<meta name="googlebot" content="follow"/>
<meta name="robots" content="all"/>
<meta name="robots" content="index"/>
<meta name="robots" content="follow"/>
<meta name="robots" content="index,follow">
<meta http-equiv="Content-Language" content="es"/>
<title><?php echo $productSing." "?> <?php echo $product['name']?></title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="<?php echo $root?>assets/favicon.ico" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="<?php echo $root?>css/styles.css" rel="stylesheet" />
<?php include('cookies.php'); ?>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
<style>
.quote {
color: rgba(0,0,0,.1);
text-align: center;
margin-bottom: 30px;
}
/*-------------------------------*/
/* Carousel Fade Transition */
/*-------------------------------*/
#fade-quote-carousel.carousel {
padding-bottom: 60px;
}
#fade-quote-carousel.carousel .carousel-inner .item {
opacity: 0;
-webkit-transition-property: opacity;
-ms-transition-property: opacity;
transition-property: opacity;
}
#fade-quote-carousel.carousel .carousel-inner .active {
opacity: 1;
-webkit-transition-property: opacity;
-ms-transition-property: opacity;
transition-property: opacity;
}
#fade-quote-carousel.carousel .carousel-indicators {
bottom: 10px;
}
#fade-quote-carousel.carousel .carousel-indicators > li {
background-color: #e84a64;
border: none;
}
#fade-quote-carousel blockquote {
text-align: center;
border: none;
}
#fade-quote-carousel .profile-circle {
width: 100px;
height: 100px;
margin: 0 auto;
border-radius: 100px;
}
.pricing-card {
flex-direction: column;
min-width: 0;
color: #000;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid #fff;
border-radius: 6px;
-webkit-box-shadow: 0px 0px 5px 0px rgb(249, 249, 250);
-moz-box-shadow: 0px 0px 5px 0px rgba(212, 182, 212, 1);
box-shadow: 0px 0px 5px 0px rgb(161, 163, 164)
}
</style>
</head>
<body>
<?php
include 'includes/nav.php';
?>
<!-- Header-->
<header class="bg-dark py-5">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder"><?php echo $product['name']?></h1>
<p class="lead fw-normal text-white-50 mb-0"><?php echo $headline ?></p>
</div>
</div>
</header>
<!-- Section-->
<section class="py-5">
<div class="container px-4 px-lg-5 my-5">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">Estás en: <a href="<?php echo $root?>"><?php echo $productPlural?></a></li>
<li class="breadcrumb-item"> <a href="<?php echo $root.$_GET['category'] ?>/"><?php echo $productPlural." ".$categoryTitle; ?></a></li>
<li class="breadcrumb-item"><?php echo $product['name'];?> </li>
</ol>
</nav>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "<?php echo $productPlural?>",
"item": "<?php echo $root?>"
},{
"@type": "ListItem",
"position": 2,
"name": "<?php echo $productPlural." ".$categoryTitle; ?>",
"item": "<?php echo $root.$_GET['category']?>/"
},
{
"@type": "ListItem",
"position": 3,
"name": "<?php echo $h1 ?>",
"item": "<?php echo $root.$_GET['category']."/".$_GET['asin']?>/"
}
]
}
</script>
<div class="row gx-4 gx-lg-5 align-items-center">
<div class="col-md-6"><img class="card-img-top mb-5 mb-md-0" src="<?php echo $product['image_url']?>" alt="<?php echo $product['name']?>" /></div>
<div class="col-md-6">
<?php $title = strlen($product['name']) > 70 ? substr($product['name'],0,70)."..." : $product['name'];?>
<div class="small mb-1">ASIN: <?php echo $product['asin']?></div>
<p class="display-5 fw-bolder"><?php echo $title ?></p>
<div class="fs-5 mb-5">
<span><?php echo $product['brand']?></span>
</div>
<p class="lead"><?php echo printProperties($product)?></p>
<div class="d-flex">
<a href="<?php echo $product['link'] ?>" rel="nofollow sponsored">
<button class="btn btn-outline-dark btn btn-success" type="button" style="padding-left: 55px; padding-top:55px; padding-right:55px; padding-bottom:55px; font-size: 30px;">
<i class="bi-cart-fill me-1"></i>
Ver en Amazon
</button>
</a>
</div>
</div>
</div>
</div>
</section>
<section class="py-5 bg-light" id="carousel">
<?php
$textSamples = array();
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$textSamples[] = "Compré este ".$productSing." de la marca ".$product['brand']." por solo ".$product['price']."€";
$names = array();
$names[0] = "Nombre1";
$names[1] = "Nombre2";
$names[2] = "Nombre3";
$names[3] = "Nombre4";
$names[4] = "Nombre5";
$names[5] = "Nombre6";
$names[6] = "Nombre7";
$names[7] = "Nombre8";
$names[8] = "Nombre9";
$names[9] = "Nombre10";
$surnames = array();
$surnames[0] = "Apellido1";
$surnames[1] = "Apellido2";
$surnames[2] = "Apellido3";
$surnames[3] = "Apellido4";
$surnames[4] = "Apellido5";
$surnames[5] = "Apellido6";
$surnames[6] = "Apellido7";
$surnames[7] = "Apellido8";
$surnames[8] = "Apellido9";
$surnames[9] = "Apellido10";
$reviews = array();
$texts = array();
$numReviews = rand(3,5);
$persons = array();
$i=0;
while($i < $numReviews)
{
$randomPerson = rand(1,10);
if(!in_array($randomPerson, $persons))
{
$texts[] = $textSamples[$randomPerson];
$persons[] = $randomPerson;
$i++;
}
}
?>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="quote"><i class="fa fa-quote-left fa-4x"></i></div>
<div class="carousel slide" id="fade-quote-carousel" data-ride="carousel" data-interval="3000">
<!-- Carousel indicators -->
<ol class="carousel-indicators">
<?php
$i = 0;
for($i; $i<$numReviews; $i++)
{
if($i===0)
{
echo '<li data-target="#fade-quote-carousel" data-slide-to="0" class="active"></li>';
}
else{
echo '<li data-target="#fade-quote-carousel" data-slide-to="'.$i.'"></li>';
}
}
?>
</ol>
<!-- Carousel items -->
<div class="carousel-inner">
<?php
$i = 0;
for($i; $i<$numReviews; $i++)
{
$surname = $surnames[rand(0,9)];
$reviews[$i]['person'] = $names[$persons[$i]-1].' '.$surname;
if($i===0)
{
echo '<div class="active item">
<img src="'.$root.'images/persona-'.$persons[$i].'.jpg" class="profile-circle" style="background-color: rgba(145,169,216,.2);"></img>
<br/>
<p style="text-align: center; vertical-align: middle;"><b>'.$names[$persons[$i]-1].' '.$surname.'</b> </p>
<div class="d-flex justify-content-center small text-warning mb-2">
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
</div>
<blockquote>
<p>'.$texts[$i].'</p>
</blockquote>
</div>';
}
else{
echo '<div class="item">
<img src="'.$root.'images/persona-'.$persons[$i].'.jpg" class="profile-circle" style="background-color: rgba(145,169,216,.2);"></img>
<br/>
<p style="text-align: center; vertical-align: middle;"><b>'.$names[$persons[$i]-1].' '.$surname.'</b> </p>
<div class="d-flex justify-content-center small text-warning mb-2">
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
</div>
<blockquote>
<p>'.$texts[$i].'</p>
</blockquote>
</div>';
}
}
?>
</div>
</div>
<div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
<div class="text-center"> <a href="<?php echo $product['link'] ?>" rel="nofollow sponsored"><button style="padding-left: 55px; padding-top:55px; padding-right:55px; padding-bottom:55px; font-size: 30px;" type="button" class="btn btn-success">Ver más opiniones en Amazon</button></a></div>
</div>
</div>
</div>
</div>
</section>
<section class="py-5 bg-light">
<div class="container px-4 px-lg-5 my-5">
<h2>Comparativa de <?php echo $productPlural?> </h2>
</div>
<div class="container mt-5">
<div class="row">
<?php
$products = array();
$products[] = $product;
$sql= "SELECT * FROM ".$dbTable." WHERE category ='".$product['category']."' AND asin != '".$product['asin']."' ORDER by rand() limit 2";
$result = mysqli_query($conn, $sql);
while($row=mysqli_fetch_array($result)) {
$products[] = $row;
}
foreach($products as $product){
echo '<div class="col-md-4">
<div class="pricing-card p-3 text-center py-5 mt-2">
<div class="images"><img src="'.$product['image_url'].'" width="150"></div>
<p class="mt-3"><b>'.substr($product['name'],0,40).'...</p></b><span class="d-block">'
.$product['brand'].'</span><a href="'.$root.$_GET['category'].'/'.strtolower($product['asin']).'/"><button class="btn btn-info shadow mt-4 px-5 rounded-pill" type="button">Ver '.$productSing.'</button></a>
<div class="mt-3">';
if(strlen($product['size'])>0){
echo '<span class="d-block"><i class="fa fa-check"></i> Talla: <b>'.$product['size'].'</b></span>';
}
if(strlen($product['height'])>0){
echo '<span class="d-block"><i class="fa fa-check"></i> Alto: <b>'.$product['height'].'</b></span>';
}
if(strlen($product['width'])>0){
echo '<span class="d-block"><i class="fa fa-check"></i> Ancho: <b>'.$product['width'].'</b></span>';
}
if(strlen($product['length'])>0){
echo '<span class="d-block"><i class="fa fa-check"></i> Largo: <b>'.$product['length'].'</b></span>';
}
if(strlen($product['color'])>0){
echo '<span class="d-block"><i class="fa fa-check"></i> Color: <b>'.$product['color'].'</b></span>';
}
echo ' <span class="d-block"><i class="fa fa-check"></i> Marca: <b>'.$product['brand'].'</b></span>
<span class="d-block"><i class="fa fa-check"></i> Precio aproximado: <b>'.$product['price'].'€</b></span>
<span class="text-left"> Valoración final <div class="d-flex justify-content-center small ">
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
</div></span></div>
</div>
</div>';
}
?>
</div>
</div>
</section>
<!-- Related items section-->
<section class="py-5 bg-light">
<div class="container px-4 px-lg-5 mt-5">
<h2 class="fw-bolder mb-4">Otros <?php echo $productPlural." ".$brand?></h2>
<div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
<?php
$sql = "SELECT category, asin, name, brand, image_url from ".$dbTable." where brand ='".$brand."'order by rand() LIMIT 4";
$result = mysqli_query($conn, $sql);
while($row=mysqli_fetch_array($result)) {
$title = strlen($product['name']) > 70 ? substr($product['name'],0,70)."..." : $product['name'];
echo '
<div class="col mb-5">
<div class="card h-100">
<!-- Product image-->
<img class="card-img-top" src="'.$row['image_url'].'" alt="'.$row['name'].'" />
<!-- Product details-->
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<p class="fw-bolder">'.$title.'</p>
<!-- Product reviews-->
<div class="d-flex justify-content-center small text-warning mb-2">
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
</div>
<!-- Product price-->
'.$row['brand'].'
</div>
</div>
<!-- Product actions-->
<div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
<div class="text-center"><a class="btn btn-outline-dark btn-success mt-auto" href="'.$root.$row['category'].'/'.strtolower($row['asin']).'/">Ver '.$productSing
.'</a></div>
</div>
</div>
</div>';
}
?>
</div>
</div>
</section>
<section class="py-5 bg-light">
<div class="container px-4 px-lg-5 mt-5">
<h2 class="fw-bolder mb-4">Más <?php echo $productPlural." ".$categoryTitle?></h2>
<div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
<?php
$sql = 'SELECT asin, name, brand, image_url from '.$dbTable.' where category = ? order by rand() LIMIT 4';
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $category);
$stmt->execute();
$result = $stmt->get_result();
while($row=mysqli_fetch_array($result)) {
$title = strlen($product['name']) > 70 ? substr($product['name'],0,70)."..." : $product['name'];
echo '
<div class="col mb-5">
<div class="card h-100">
<!-- Product image-->
<img class="card-img-top" src="'.$row['image_url'].'" alt="'.$row['name'].'" />
<!-- Product details-->
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<p class="fw-bolder">'.$title.'</p>
<!-- Product reviews-->
<div class="d-flex justify-content-center small text-warning mb-2">
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
<div class="bi-star-fill"></div>
</div>
<!-- Product price-->
'.$row['brand'].'
</div>
</div>
<!-- Product actions-->
<div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
<div class="text-center"><a class="btn btn-success btn-outline-dark mt-auto" href="'.$root.$_GET['category'].'/'.strtolower($row['asin']).'/">Ver '.$productSing.'</a></div>
</div>
</div>
</div>';
}
?>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "<?php echo $product['name']?>",
"image": [
"<?php echo $product['image_url']?>"
],
"description": "<?php echo $productSing." ".$product['name']?>",
"sku": "<?php echo $product['asin']?>",
"gtin": "<?php echo $product['asin']?>",
"brand": {
"@type": "Brand",
"name": "<?php echo $product['brand']?>"
},
"review": [{
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5"
},
"author": {
"@type": "Person",
"name": "Víctor Alonso"
}
}
<?php
$i =0;
foreach($reviews as $review){
echo ',
{
"@type": "Review",
"datePublished": "'.date('Y-m-d',strtotime("-1 days")).'",
"reviewBody": "'.$texts[$i].'",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5",
"worstRating": "1"
},
"author": {
"@type": "Person",
"name": "'.$reviews[$i]['person'].'"
}
}';
$i++;
}
echo '],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "5",
"reviewCount": "'.($numReviews+1).'"
},'
?>
"offers": {
"@type": "Offer",
"url": "<?php echo $product['link']?>",
"priceCurrency": "EUR",
"price": "<?php echo $product['price']?>",
"priceValidUntil": "2052-11-20",
"itemCondition": "https://schema.org/UsedCondition",
"availability": "https://schema.org/InStock"
}
}
</script>
</div>
</div>
</section>
<!-- Footer-->
<?php
include 'includes/footer.php';
?>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="<?php echo $root?>js/scripts.js"></script>
</body>
</html>
<?php
function printProperties($product)
{
$properties = "<div>";
if(strlen($product['size']) >0)
{
$properties = $properties."<p><b>Talla: </b>".$product['size']."</p>";
}
if(strlen($product['width']) >0)
{
$properties = $properties."<p><b>Ancho: </b>".number_format($product['width']*2.54,2)." cm.</p>";
}
if(strlen($product['length']) >0)
{
$properties = $properties."<p><b>Largo: </b>".number_format($product['length']*2.54,2)." cm.</p>";
}
if(strlen($product['height']) >0)
{
$properties = $properties."<p><b>Alto: </b>".number_format($product['height']*2.54,2)." cm.</p>";
}
if(strlen($product['color']) >0)
{
$properties = $properties."<p><b>Color: </b>".$product['color']."</p>";
}
$properties = $properties."</div>";
return $properties;
}