diff --git a/_incl/shoopOfertas.php b/_incl/shoopOfertas.php index 65759ba..24f09a0 100644 --- a/_incl/shoopOfertas.php +++ b/_incl/shoopOfertas.php @@ -77,17 +77,14 @@ var $curTipo; $this->contador = 0; $this->result = false; $this->curTipo = $tipo; - - $cuantos = $cuantos * 4; - + $conn = db_connect(); if($conn) { $query = 'SELECT oferta_id, oferta_fab_id, fab_nombre, oferta_categoria, oferta_nombre, oferta_estado, oferta_pvp, oferta_descripcion FROM shoop_oferta LEFT JOIN shoop_fabricantes on (oferta_fab_id=fab_id) WHERE oferta_unidades > 0 - ORDER BY RAND()'; -// LIMIT ' . $cuantos; + ORDER BY RAND() LIMIT '. $cuantos; $this->result = mysql_query($query, $conn); $this->numOfertas = mysql_num_rows($this->result); @@ -104,7 +101,7 @@ var $curTipo; if($this->contador < $this->numOfertas) { $row = mysql_fetch_array($this->result); $this->contador ++; - if(file_exists('_ofr/' . $row['oferta_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) { +// if(file_exists('_ofr/' . $row['oferta_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) { $oferta = array ( 'categoria_id' => $row['oferta_categoria'], 'nombre' => $row['oferta_nombre'], 'id' => $row['oferta_id'], @@ -113,9 +110,9 @@ var $curTipo; 'fab_nombre' => $row['fab_nombre'], 'pvp' => $row['oferta_pvp'], 'descripcion' => $row['oferta_descripcion']); - } else { - $oferta = $this->getNextOferta(); - } +// } else { +// $oferta = $this->getNextOferta(); +// } } return $oferta; // es un array } @@ -133,17 +130,15 @@ var $curTipo; $this->contador = 0; $this->result = false; $this->curTipo = $tipo; - - $cuantos = $cuantos * 4; $conn = db_connect(); if($conn) { - $query = 'SELECT ocasion_id, ocasion_categoria, ocasion_nombre, ocasion_estado, ocasion_pvp, ocasion_precio, ocasion_descripcion, ocasion_fab_id + $query = 'SELECT ocasion_id, ocasion_categoria, ocasion_nombre, ocasion_estado, ocasion_pvp, ocasion_precio, ocasion_descripcion, ocasion_fab_id, fab_nombre FROM shoop_ocasion - WHERE ocasion_unidades > 0 - ORDER BY RAND()'; -// LIMIT ' . $cuantos; - + LEFT JOIN shoop_fabricantes on (ocasion_fab_id=fab_id) + WHERE (ocasion_unidades > 0) + ORDER BY RAND() LIMIT '. $cuantos; + $this->result = mysql_query($query, $conn); $this->numOcasiones = mysql_num_rows($this->result); } @@ -159,18 +154,19 @@ var $curTipo; if($this->contador < $this->numOcasiones) { $row = mysql_fetch_array($this->result); $this->contador ++; - if(file_exists('_ocs/' . $row['ocasion_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) { +// if(file_exists('_ocs/' . $row['ocasion_id'] . ($this->curTipo != 2 ? '_168.jpg' : '_247.jpg'))) { $ocasion = array ( 'categoria_id' => $row['ocasion_categoria'], 'nombre' => $row['ocasion_nombre'], 'id' => $row['ocasion_id'], 'fab_id' => $row['ocasion_fab_id'], + 'fab_nombre' => $row['fab_nombre'], 'estado' => $row['ocasion_estado'], 'precio' => $row['ocasion_precio'], 'pvp' => $row['ocasion_pvp'], 'descripcion' => $row['ocasion_descripcion']); - } else { - $ocasion = $this->getNextOcasion(); - } +// } else { +// $ocasion = $this->getNextOcasion(); +// } } return $ocasion; // es un array } diff --git a/admin/shoop/oferta_db.php b/admin/shoop/oferta_db.php index 49397a4..2dfe6bd 100644 --- a/admin/shoop/oferta_db.php +++ b/admin/shoop/oferta_db.php @@ -55,6 +55,7 @@ $conn = db_connect(); if ($operacion != "del") { // modifico la imagen. uploadImagenOferta($id, 247, 95, 168, 102); + uploadPDFOferta($id); // y vuelvo a la pantalla correspondiente header('Location: oferta_edit.php?op=edit&id=' . $id); } diff --git a/admin/shoop/oferta_edit.php b/admin/shoop/oferta_edit.php index f11540e..fb4f4e6 100644 --- a/admin/shoop/oferta_edit.php +++ b/admin/shoop/oferta_edit.php @@ -70,11 +70,7 @@ define("MAX_SIZE", $max_size); - - - - -
Categoría Imagen
+ Categoría
- + + + +
Folleto PDF

+ Folleto PDF "; + } + ?> +

+
Imagen
diff --git a/admin/shoop/upload.php b/admin/shoop/upload.php index 08244e9..fddc74e 100644 --- a/admin/shoop/upload.php +++ b/admin/shoop/upload.php @@ -168,4 +168,44 @@ } } + function uploadPDFOferta($prodID) { + $path = "../../_ofr/"; // este directorio tiene que tener chmod 777 + $upload_file_name = "ofr_pdf"; // el nombre del campo tipo file de nuestro formulario + $acceptable_file_types = ""; // acepta GIF et JPEG + $default_extension = ""; + $mode = 1; // OPTIONS: + // 1 = overwrite mode + // 2 = create new with incremental extention + // 3 = do nothing if exists, highest protection + + +// un poco de limpieza previa + // este es el temporal + $glob = glob($path . $prodID. '_tmp'); + limpia($glob); + limpia($path . '_' . $prodID . '.pdf'); +// fin de la limpia + + if(strlen($_FILES['ofr_pdf']['name'])) { + $my_uploader = new uploader('es'); // Create a new instance of the class + $my_uploader->max_filesize(5000000); // OPTIONAL: set the max filesize of uploadable files in bytes +// $my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions + // UPLOAD the file + if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) { + $my_uploader->save_file($path, $prodID . '.pdf', $mode); + if (!$my_uploader->error) { + $my_uploader->delete_file; + } + } + if ($my_uploader->error) { + echo $my_uploader->error; + } + + $glob = glob($path . $proid. '_tmp'); + limpia($glob); + } +// else +// limpia($path . $prodID . '.pdf'); + } + ?> \ No newline at end of file diff --git a/bann1.php b/bann1.php index e84da23..9509420 100644 --- a/bann1.php +++ b/bann1.php @@ -1,4 +1,4 @@ - +
+ +
diff --git a/bann2_oferta.php b/bann2_oferta.php index fc9a123..801ecfb 100644 --- a/bann2_oferta.php +++ b/bann2_oferta.php @@ -31,6 +31,15 @@

Precio PVP:
+ + Ver folleto PDF "; + } + ?> + diff --git a/bann_ocasion_home.php b/bann_ocasion_home.php new file mode 100644 index 0000000..a63b0d1 --- /dev/null +++ b/bann_ocasion_home.php @@ -0,0 +1,18 @@ +
diff --git a/bann2_ocasion.php b/bann2_ocasion.php index d405609..799b8b0 100644 --- a/bann2_ocasion.php +++ b/bann2_ocasion.php @@ -18,7 +18,7 @@ ?>
- +
€'); ?>
+ + + + +
+
+ +
+ +
+
+
+

+
€'); ?>
+
+

Precio PVP:
+
diff --git a/bann_oferta_home.php b/bann_oferta_home.php new file mode 100644 index 0000000..7bed867 --- /dev/null +++ b/bann_oferta_home.php @@ -0,0 +1,26 @@ + + + + + +
+
+ +
+ +
+
+
+

+
€'); ?>
+
+ + Ver folleto PDF "; + } + ?> + +
diff --git a/index.php b/index.php index 02e7661..4f358e1 100644 --- a/index.php +++ b/index.php @@ -64,7 +64,9 @@ ini_set ('display_errors', '0'); ?> - + + + + + + + - + + + +
@@ -78,11 +80,17 @@ ini_set ('display_errors', '0'); -
@@ -96,7 +104,62 @@ ini_set ('display_errors', '0');
- + +
+ +
+ + + + + +getNum(); $i++){ + $arrayOfertas = $miOfertas->getNextOferta(); + if(!empty($arrayOfertas)){ +?> + + + + + +
OFERTAS
+

Ver todo el material de Oferta >>

+
+ + + + + +getNum(); $i++){ + $arrayOcasion = $miOcasion->getNextOcasion(); + if(!empty($arrayOcasion)){ +?> + + + + + +
OCASIÓN
+

Ver todo el material de Ocasión >>

+
+ + + + + +
- - + + +
0)) { + while ($row = mysql_fetch_array($result)){ ?> - - - - + + + + - - - -
novedades
-
- [+]
+
+
+ [+]
@@ -237,15 +303,15 @@ ini_set ('display_errors', '0'); ?>
+
+ @@ -265,14 +331,15 @@ ini_set ('display_errors', '0'); -
getNum()) - echo $miBanner->getNextBanner(); - ?> -
+ $miBanner = new shoopBanners(2, 348); + for ($i=0; $i < $miBanner->getNum(); $i++){ + ?> +
getNextBanner();?>
+
diff --git a/oferta_ficha.php b/oferta_ficha.php index ada4822..4dd5494 100644 --- a/oferta_ficha.php +++ b/oferta_ficha.php @@ -132,6 +132,14 @@ switch($oferta_categoria_id) { Oferta PVP:

+ Ver folleto PDF "; + } + ?> +