Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/05/2017, 09:04
miguelA4
 
Fecha de Ingreso: marzo-2015
Ubicación: Valencia
Mensajes: 132
Antigüedad: 9 años, 1 mes
Puntos: 0
Mandar por Mail arreglo y formulario

Hola buenas tardes.

Estoy creando con un arreglo, algo parecido a "presupuesto online". Los clientes irán añadiendo servicios y quitando, y eso va creando lo que vendría siendo una Proforma la cual me llegara por mail y ya solo quedaría conversar con el cliente.
Lo que es el arreglo ya lo tengo y me muestra todo correctamente, tanto puedo añadir como quitar y funciona todo bien.
Pero el problema que no tengo ni la menor idea de como hacer que al poner los datos del cliente y le den a enviar, me lo mande todo por mail.

Adjunto código por si podeis guiarme, es algo extenso, pido disculpas de ante mano.
Pego sólo una función que no me deja más...

Código Javascript:
Ver original
  1. <script>
  2.  
  3. // WEB 2.0 //
  4. var total = 0;
  5.  
  6. function pintaHosting(){
  7.  
  8. var miListaDeConceptos = [
  9.   { "concepto": "Web  Corporativa 2.0", "precio": 70, "concepto2": "Hosting Web", "concepto3": "Panel para gestionar el Blog", "concepto4": "Adaptada a dispositivos moviles", "concepto5": "Mantenimiento incluido", "concepto6": "Formación de <span class=\"etisnce\">2 Horas</span>", "concepto7": "Atención al cliente" }
  10.   ];
  11.  
  12.     if($("#div_0").length === 0){
  13.  
  14.       $.gritter.add({
  15.       // heading of the notification
  16.       title: '¡Producto Añadido!',
  17.       // the text inside the notification
  18.  
  19.       image: 'images/confirm.png',
  20.        // how fast notifications fade in
  21.       fade_in_speed: 'medium',
  22.  
  23.       // how fast the notices fade out
  24.       fade_out_speed: 1000,
  25.  
  26.     });
  27.     for (i = 0; i < miListaDeConceptos.length; i++){
  28.     var elemento = miListaDeConceptos[ i ];
  29.     document.getElementById('htmlHosting2').style.display='none';
  30.  
  31.   $( "#htmlHosting" ).append(
  32.     '<div id="div_'+i+'" class="servicio-pres2 espa-ps3" data-precio="'+elemento.precio+'">'+elemento.concepto+'<button onclick="borrame2(this);" class="bt-comp"><i class="fa fa-times"></i></button><span class="servicio-pres3">'+elemento.precio+',00 €</span><div class="servicio-pres256">'+elemento.concepto2+'<span class="servicio-pres312">0,00 €</span></div><div class="servicio-pres257">'+elemento.concepto3+'<span class="servicio-pres312">0,00 €</span></div><div class="servicio-pres257">'+elemento.concepto4+'<span class="servicio-pres312">0,00 €</span></div><div class="servicio-pres257">'+elemento.concepto5+'<span class="servicio-pres312">0,00 €</span></div><div class="servicio-pres257">'+elemento.concepto6+'<span class="servicio-pres312">0,00 €</span></div><div class="servicio-pres257">'+elemento.concepto7+'<span class="servicio-pres312">0,00 €</span></div></div>' );
  33.  
  34.       total += elemento.precio;
  35. }
  36. $("#htmlTotal").html('<div id="div_total" class="col-md-3 palab-total3"><span class="palab-total">TOTAL: </span><span class="palab-total2">'+total+',00 €/mes*</span><div></div></div>');
  37.  
  38. } else {
  39.  
  40.   $.gritter.add({
  41.   // heading of the notification
  42.   title: 'Ya has añadido este producto',
  43.   // the text inside the notification
  44.  
  45.   image: 'images/confirm.png',
  46.    // how fast notifications fade in
  47.   fade_in_speed: 'medium',
  48.  
  49.   // how fast the notices fade out
  50.   fade_out_speed: 1000,
  51.   });
  52.  
  53. }
  54. }
  55.     function borrame2( esto){
  56.     var contenedor = $( esto ).parent();
  57.     var precio = contenedor.attr( "data-precio" );
  58.     contenedor.remove();
  59.     total = total - precio;
  60.     document.getElementById('htmlHosting2').style.display='block';
  61.     $("#htmlTotal").html('<div id="div_total" class="col-md-3 palab-total3"><span class="palab-total">TOTAL: </span><span class="palab-total2">'+total+',00 €/mes*</span></div>');
  62.   }
  63. // FIN WEB 2.0 //
  64.  
  65. </script>

CON ESTO CREO LA FUNCIÓN PARA PINTAR EL ELEMENTO EN EL DIV. (Este es sólo uno, hay otro para pintar lo que incluye la tienda online y otro para cada de los servicios que hay. Pero así es algo mas corto).

Código PHP:
Ver original
  1. <a href="javascript:pintaHosting()" ><div id="imagen1" class="col-md-3"></div></a>

AQUÍ PINTO LOS ELEMENTOS. (De esto hay 3 pero sólo os pongo 1)

Código PHP:
Ver original
  1. <div id="htmlHosting2" class="alps alert-warning ">
  2.                        <span><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></span>
  3.                         <span class="pano">No a añadido ningúna web</span>
  4.                     </div>

POR ÚLTIMO EL FORMULARIO.

Código PHP:
Ver original
  1. <form action="form2.php" method="post">
  2.  
  3.                         <input type="text" name="nombre" placeholder="Nombre" type="text" >
  4.                         <input type="text" name="telefono" placeholder="Teléfono" type="text" />
  5.                         <input type="email" name="email" placeholder="Email" type="text" />
  6.  
  7.                      <input type="reset" class="hvr-sweep-to-right btppp2" value="Borrar" />
  8.                      <input type="submit" class="hvr-sweep-to-right btppp" value="Enviar" />
  9.                   </form>

Siento que sea algo tan extenso, podéis ver el funcionamiento en AQUÍ

Saludos