-
Notifications
You must be signed in to change notification settings - Fork 0
/
tienda.php
51 lines (30 loc) · 1.46 KB
/
tienda.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
<?php
require_once './class/Producto.php';
require_once './require/header.php';
?>
<div class="container-fluid m-0 p-0">
<img src="./public/Frame%206.jpg" class="w-100 " alt="">
</div>
<main role="main">
<div class=" jumbotron mb-0">
<?php
$getSearch = isset($_GET['search']) ? '%' . $_GET['search'] . '%' : '';
if(!isset($_GET['search'])){
$productos = Producto::getAllProducts();
}else{
$productos = Producto::searchTienda($getSearch);;
}
$textoResultado = '<p class="small">Se han encontrado <span class="font-weight-bold">'.Producto::getCount().'</span> resultados.</p>';
if(isset($_GET['search']) && Producto::getCount() === 1) {
$textoResultado = '<p class="small">Se ha encontrado <span class="font-weight-bold">'.Producto::getCount().'</span> resultado.</p>';
} elseif(Producto::getCount() > 1 && isset($_GET['search'])) {
$textoResultado = '<p class="small">Se han encontrado <span class="font-weight-bold">'.Producto::getCount().'</span> resultados.</p>';
}
if($productos){
require './require/tienda_resultados.php';
}else{
require './require/sin_resultados.php';
}
?>
</div>
</main>