elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Una ayuda , cable o lo que sea, para este tema en PHP SOLVE
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Una ayuda , cable o lo que sea, para este tema en PHP SOLVE  (Leído 1,997 veces)
Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.833



Ver Perfil
Una ayuda , cable o lo que sea, para este tema en PHP SOLVE
« en: 30 Septiembre 2014, 15:13 pm »

Holas!! El punto puede ser simple, pero para mi no lo es! jjajaj,
Estoy trabajando con simplecart, la parte que me tiene jodido es el send form, que al final lo he podido solucionar, el tema radica que me gustaría darle un formato mas pro, a los email, como el original  adjunto copia,

Alguien me puede explicar o apoyar o como buscarlo en google como manejar el php con css dentro sel send form, para tener ese formato de template, o algo parecido,  se agradece de antemano,  Adjunto El PHP del send form, asi como mi reporte y el original, (no vale reírse eh)


PHP
Código
  1. <?php
  2.  
  3. /*
  4. *  SimpleCartjs email
  5.  
  6. */
  7.  
  8.  
  9. // DATA FROM EMAIL FORM INPUT FIELDS
  10. $first_name = $_POST['first_name'];
  11. $last_name = $_POST['last_name'];
  12. $email = $_POST['email'];
  13. $phone = $_POST['phone'];
  14. $address = $_POST['address'];
  15. $postcode = $_POST['postcode'];
  16. $comment = $_POST['comment'];
  17.  
  18.  
  19.  
  20. // STARTING EMAIL BODY
  21. $body = '';
  22. $body .= '<html><body>';
  23. $body .= 'Order submission and details.<br /><br />';
  24. $body .= '<img src="https://lh6.googleusercontent.com/-rid5-_qM_bU/VCWj5yuJDII/AAAAAAAAAGI/_xacTWTKXfU/s350/logo5.png" alt="Woven And Folks" />';
  25. $body .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
  26. $body .= "<tr style='background: #6c96df;'><td><strong>ORDER BY:</strong> </td><td>";
  27. $body .= "<tr style='background: #eee;'><td><strong>First Name:</strong> </td><td>" .$_POST['first_name'] . "</td></tr>";
  28. $body .= "<tr style='background: #eee;'><td><strong>Last Name:</strong> </td><td>" . $_POST['last_name'] . "</td></tr>";
  29. $body .= "<tr style='background: #eee;'><td><strong>Email:</strong> </td><td>" . $_POST['email'] . "</td></tr>";
  30. $body .= "<tr style='background: #eee;'><td><strong>Phone:</strong> </td><td>" . $_POST['phone'] . "</td></tr>";
  31. $body .= "<tr style='background: #eee;'><td><strong>Address:</strong> </td><td>" . $_POST['address'] . "</td></tr>";
  32. $body .= "<tr style='background: #eee;'><td><strong>Postal Code:</strong> </td><td>" . $_POST['postcode'] . "</td></tr>";
  33. $body .= "<tr style='background: #eee;'><td><strong>Comments:</strong> </td><td>" . $_POST['comments'] . "</td></tr>";
  34. $body .= "<tr style='background: #9fb4f8;'><td><strong>ORDER DETAILS:</strong> </td><td>";
  35.  
  36. // LOOPING FOR EACH ITEMS IN SHOPPING CART DATA
  37. $curr = $_POST['currency'];
  38.  
  39. $content = $_POST;
  40. // STARTING THE LOOP
  41. for($i=1; $i < $content['itemCount'] + 1; $i++) {
  42. $name = 'item_name_'.$i;
  43. $option = 'item_options_'.$i;  
  44. $quantity = 'item_quantity_'.$i;
  45. $price = 'item_price_' .$i;
  46. // CALCULATE MULTIPLE ITEMS PER QUANTITY
  47. $amount = $content[$quantity]*$content[$price];
  48. $grandTotal += $amount;
  49.  
  50.  
  51. // DISPLAY RESULT FOR EACH ITEM
  52. $body .= '=============================================================<br />';
  53. $body .= '<b>Product #'.$i.'</b><br />';
  54. $body .= 'Item Name: '.$content[$name].'<br />';
  55. $body .= 'Item Description: '.$content[$option].'<br />';
  56.  
  57. $body .= 'Item Quantity: '.$content[$quantity].'<br />';
  58. $body .= 'Item Price: '.$curr.' '.number_format($content[$price], 2, '.', '').'<br />';
  59. $body .= 'Item Amount: '.$curr.' '.number_format($amount, 2, '.', '').'<br />';
  60. $body .= '=============================================================<br />';
  61. $body .= '<br />';
  62.  
  63.  
  64.  
  65.  
  66.  
  67. } // ENDING THE LOOP
  68.  
  69. $shipping = $_POST['shipping'];
  70. $tax = $_POST['tax'];
  71. $body .= 'Sub Total: $'.number_format($grandTotal, 2, '.', '').'<br />';
  72. $body .= 'Shipping Charges: '.$curr.' '.number_format($shipping, 2, '.', '').'<br />';
  73. $body .= 'Tax: '.$curr.' '.number_format($tax, 2, '.', '').'<br />';
  74.  
  75. // CALCULATE SUB TOTAL ITEMS
  76. $sub_total += $grandTotal;
  77.  
  78. // CALCULATE TOTAL
  79. $grand_total = $sub_total + $shipping + $tax;
  80.  
  81. $body .= "<tr style='background: #e8c090;'><td><strong>ORDER SUMMARY:</strong> </td><td>";
  82. // DISPLAY THE TOTALS/SHIPPING/TAX
  83. $body .= '=============================================================<br />';
  84. $body .= '<b>TOTAL: '.$curr.' '.number_format($grand_total, 2, '.', '').'</b><br />';
  85. $body .= '=============================================================<br />';
  86. $body .= '<br />';
  87.  
  88. // LOADING POST DATA FOR PAYMENT SECTION
  89. $body .= "<tr style='background: #e890d0;'><td><strong>PAYMENT METHODS:</strong> </td><td>";
  90. $bank1 = $_POST['bank1'];
  91. $bank1_acc_no = $_POST['bank1_acc_no'];
  92. $bank1_acc_name = $_POST['bank1_acc_name'];
  93.  
  94. // DISPLAY PAYMENT METHOD DATA
  95. $body .= '=============================================================<br />';
  96. $body .= 'Bank: '.$bank1.'<br />';
  97. $body .= 'Account number: '.$bank1_acc_no.'<br />';
  98. $body .= 'Name on Account: '.$bank1_acc_name.'<br />';
  99.  
  100. // CONTINUE WITH AVAILABLE VARS
  101.  
  102. $body .= '=============================================================<br />';
  103. $body .= '<br />';
  104.  
  105. // LOADING POST DATA FOR NOTES
  106. $note1 = $_POST['note1'];
  107. $note_detail1 = $_POST['note_detail1'];
  108.  
  109. // OUTPUT VARS HERE FOR GENERAL NOTES
  110. $body .= "<tr style='background: #adf89f;'><td><strong>GENERAL NOTES:</strong> </td><td>";
  111. $body .= '=============================================================<br />';
  112. $body .= ''.$note1.'<br />';
  113. $body .= ''.$note_detail1.'<br />';
  114.  
  115. // CONTINUE WITH AVAILABLE VARS
  116.  
  117. $body .= '=============================================================<br />';
  118. $body .= '<br />';
  119. $body .= '</body></html>';
  120.  
  121. // BEGIN TO SEND EMAIL
  122. // GRABS POST DATA FOR SUCCESS/ERROR/SHOP URLS & EMAIL
  123. $shop_thankyou = $_POST['shop_thankyou'];
  124. $shop_sendFail = $_POST['shop_sendFail'];
  125. $shop_email = $_POST['shop_email'];
  126. // SENDERS EMAIL GRABS FROM THE FORM
  127. $to = $email;
  128.  
  129. $subject = 'Order Submission';
  130.  
  131. // BECAUSE WE WANT THE EMAIL TO OUTPUT IN HTML
  132. // MAIL HEADERS MUST HAVE CONTENT-TYPE
  133. $headers  = 'MIME-Version: 1.0' . "\r\n";
  134. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  135. // EMAIL TO SENDER
  136. $headers .= 'To: '.$first_name.' '.$last_name.' <'.$email.'>' . "\r\n";
  137. // SETTING THE REPLY-TO
  138. //$headers .= 'Reply-To: '.$shop_bizname.' <'.$shop_email.'>' . "\r\n";
  139. // EMAIL FROM THE OWNER
  140. $headers .= 'From: '.$shop_bizname.' <'.$shop_email.'>' . "\r\n";
  141. // SEND A COPY TO OWNER
  142. $headers .= 'Cc: '.$shop_email.'' . "\r\n";
  143.  
  144. // SEND THE MAIL
  145. mail($to, $subject, $body, $headers);
  146.  
  147. // IF THE EMAIL CAN NOT SEND
  148. if(!mail) {
  149.  Header('Location: http://'.$shop_sendFail.''); // REDIRECTS TO ERROR PAGE
  150. } else {
  151.  // SEND THE MAIL + REDIRECTS
  152.  Header('Location: http://'.$shop_thankyou.''); // REDIRECTS TO SUCCESS PAGE AFTER
  153. }
  154.  
  155. ?>

Mi Reporte


El Original



Como uso el CSS en el php, lo puedo manejar en una pagina web, pero no me entra como mandarlo  Sl2


« Última modificación: 30 Septiembre 2014, 19:44 pm por Man-In-the-Middle » En línea

https://www.latotatv.com
Código:
La Tota TV
MinusFour
Moderador Global
***
Desconectado Desconectado

Mensajes: 5.529


I'm fourth.


Ver Perfil WWW
Re: Una ayuda , cable o lo que sea, para este tema en PHP
« Respuesta #1 en: 30 Septiembre 2014, 15:31 pm »

No hay nada en especial para manejar CSS en PHP. Puedes imprimir los estilos en la cabecera del documento html:

Código
  1. echo '<head><style type="text/css"> .estilo { } </style></head>';

O haces el CSS en un archivo .css y lo linkeas con linkrel
Código
  1. echo '<link rel="stylesheet" type="text/css" href="archivo.css">';


En línea

Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.833



Ver Perfil
Re: Una ayuda , cable o lo que sea, para este tema en PHP
« Respuesta #2 en: 30 Septiembre 2014, 16:22 pm »

Gracias Bro, pero la verdad, no la veo,  por que estoy un poco tostado ya,  me puedes dar un ejemplo  simple en mi código como base para poder arrancar de ahí, por que como veras solo he llegado meter una tabla, poner colores , pero no veooo mas,

Como puedo llegar a poner un Top header azul con sombra, en el informe??? , toda mi vida he trabajado bajo html y no hay problema, pero el hecho de que salga del php como un send form, me tiene loco, .. se agradece, nuevamente.

Ps, Tengo que aclarar, que todo lo tengo que hacer internamente dentro del mismo php, lo cual no tengo opción de trabajar con css externo.
« Última modificación: 30 Septiembre 2014, 16:25 pm por Man-In-the-Middle » En línea

https://www.latotatv.com
Código:
La Tota TV
MinusFour
Moderador Global
***
Desconectado Desconectado

Mensajes: 5.529


I'm fourth.


Ver Perfil WWW
Re: Una ayuda , cable o lo que sea, para este tema en PHP
« Respuesta #3 en: 30 Septiembre 2014, 16:51 pm »

No tengo idea de como se hace el shadow desde CSS, nunca me he puesto a explorar las cosas del CSS bien.

Pero por ejemplo, al principio tienes:

Código
  1. $body .= '<html><body>';

Pues agregar aquí el header y el style:

Código
  1. $body .= '<html><head><style type="text/css"> .formHeader { background-color: #41BACC; } </style></head><body>';

Y luego agregas el estiilo a una etiqueta:

Código
  1. $body .= '<tr class="formHeader"></tr>';
  2. $body .= "<tr style='background: #6c96df;'><td><strong>ORDER BY:</strong> </td><td>";
  3.  
En línea

Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.833



Ver Perfil
Re: Una ayuda , cable o lo que sea, para este tema en PHP SOLVE
« Respuesta #4 en: 30 Septiembre 2014, 19:44 pm »

Gracias Bro, con eso mas que suficiente!, mas claro el panorama!
En línea

https://www.latotatv.com
Código:
La Tota TV
JorgeEMX
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.615



Ver Perfil WWW
Re: Una ayuda , cable o lo que sea, para este tema en PHP SOLVE
« Respuesta #5 en: 2 Octubre 2014, 05:45 am »

Yo te recomendaría dejar de hacer eso (usar html con php), no tienen ningún sentido. Podrías usar mejor DOMPDF https://github.com/dompdf/dompdf , hacer tu template con HTML + CSS y PHP (sólo para obtener datos) y después hacer tu Reporte en PDF.
En línea

Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.833



Ver Perfil
Re: Una ayuda , cable o lo que sea, para este tema en PHP SOLVE
« Respuesta #6 en: 2 Octubre 2014, 15:01 pm »

Es muy buena tu opcion grax!, pero mi tema es mas de solo poder mandar un buen invoice,  trabajo sobre googlehost, blogger y por ahi un free server para el php(que no me consume nada)!  Thanks
En línea

https://www.latotatv.com
Código:
La Tota TV
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
para que se usa este cable?
Hardware
flacc 8 5,248 Último mensaje 12 Enero 2011, 17:43 pm
por Artikbot
Se acabaron los líos con este cargador universal para portátiles con cable ....
Noticias
wolfbcn 2 1,990 Último mensaje 17 Mayo 2013, 10:21 am
por #!drvy
ayuda con este tema « 1 2 »
Programación C/C++
sofia555555 14 3,637 Último mensaje 1 Marzo 2019, 04:32 am
por K-YreX
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines