Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php][problem]Generowana tresc maila
Azonic
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 19.04.2014

Ostrzeżenie: (0%)
-----


Witam, więc tak posiadam pewien skrypt sklepu i po dokonaniu zamówienia {czyt. wypełnieniu formularzu) skrypt wysyła automatycznie potwierdzenie zakupu oraz dane kontaktowe itp na maila w postaci prostej tresci. i teraz mam pytanie, jak przerobić skrypt php aby troche to urozmaicić czyli np. dane personalne zrobić aby były wyswietlane w tabelce dodać jakis kolor tekstu oraz np. obrazek jakis na górze logo serwisu.

Podkreslam że nie pytam tu jakim kodem to zrobić bo wiem jak się koloruje tekst czy wstawia obrazek. tylko chodzi mi tu aby to zgrać z php żeby trybiło

Próbowałem wkomponować css / html do kodu php na róźne sposoby i za każdym razem wywalało mi błąd.

Tutaj mam kod odpowiadający za tresc wysłanego maila.
  1.  
  2. /**
  3.   * Sends email to admin with order details
  4.   * @return void
  5.   * @param string $sFile
  6.   * @param int $iOrder
  7.   */
  8. public function sendEmailWithOrderDetails( $iOrder, $bSendToCustomer = null ){
  9. global $lang, $config;
  10.  
  11. $aData = $this->throwOrder( $iOrder );
  12.  
  13. $sProducts = $this->listProducts( $iOrder, true );
  14. $aData['sOrderSummary'] = $this->aOrders[$iOrder]['sOrderSummary'];
  15. $aUrls = throwSiteUrls( );
  16. $sOrderUrlEmail = $aUrls['sHomeUrl'].$GLOBALS['oPage']->aPages[$config['order_print']]['sLinkName'].'&sKey='.$this->throwOrderKey( $aData );
  17.  
  18. $aSend['sMailContent'] = preg_replace( '/\|n\|/', "\n","\n\n".
  19. $lang['Order_customer_email_head']."".$aData['sFirstName'].' '."\nDziękujemy za złożenie zamówienia w sklepie - sklep z ."."\n\n".
  20. $aData['sFirstName'].' '.$aData['sLastName'].( isset( $aData['sCompanyName'] ) ? "\n".$aData['sCompanyName'] : null )."\n".$aData['sStreet']."\n".$aData['sZipCode'].' '.$aData['sCity']."\n".$aData['sPhone']."\n".$aData['sEmail']."\n\n".
  21. $lang['Order_customer_products']."".$sProducts.( isset( $_SESSION['oneDiscount'] ) ? "\n-------\n".$lang['Info_discount'].''.$config['discount_percent'].'%' : null )."\n\n".( isset(
  22. $aData['iShipping'] ) ? $lang['Order_customer_shipping']." ".$aData['mShipping'].' ('.$aData['mPayment'].') = '.$this->aOrders[$iOrder]['sPaymentShippingPrice'].' '.$config['currency_symbol']."\n\n" : null ).$lang['Order_customer_firma']."\n-----------------------------------------------\n"."Nr zamówienia: 1".$iOrder."\n"."Inteo 50 1020 50 0096 "."\n"."Eyk Zak\nGroa 28\nPań"."\n-----------------------------------------------\n".$lang['Summary_cost'].': '.$this->aOrders[$iOrder]['sOrderSummary'].' '.$config['currency_symbol']."\n-----------------------------------------------\n".$lang['Check_order_status_url']."\n".$sOrderUrlEmail."\n-----------------------------------------------\n".$lang['Order_customer_email_foot']."" );
  23. $aSend['sTopic'] = $lang['Order_customer_info_title'].$iOrder;
  24. $aSend['sSender'] = $GLOBALS['config']['orders_email'];
  25.  
  26. if( $bSendToCustomer === true )
  27. sendEmail( $aSend, null, $aData['sEmail'] );
  28. if( $GLOBALS['config']['order_details_from_customer'] === true )
  29. $aSend['sSender'] = $aData['sEmail'];
  30. sendEmail( $aSend, null, $GLOBALS['config']['orders_email'] );
  31. } // end function sendEmailWithOrderDetails


Ten kawałek odpowiada za generowaną tresc w mailu:
  1. $aSend['sMailContent'] = preg_replace( '/\|n\|/', "\n","\n\n".
  2. $lang['Order_customer_email_head']."".$aData['sFirstName'].' '."\nDziękujemy za złożenie zamówienia w sklepie - sklep z ."."\n\n".
  3. $aData['sFirstName'].' '.$aData['sLastName'].( isset( $aData['sCompanyName'] ) ? "\n".$aData['sCompanyName'] : null )."\n".$aData['sStreet']."\n".$aData['sZipCode'].' '.$aData['sCity']."\n".$aData['sPhone']."\n".$aData['sEmail']."\n\n".
  4. $lang['Order_customer_products']."".$sProducts.( isset( $_SESSION['oneDiscount'] ) ? "\n-------\n".$lang['Info_discount'].''.$config['discount_percent'].'%' : null )."\n\n".( isset(
  5. $aData['iShipping'] ) ? $lang['Order_customer_shipping']." ".$aData['mShipping'].' ('.$aData['mPayment'].') = '.$this->aOrders[$iOrder]['sPaymentShippingPrice'].' '.$config['currency_symbol']."\n\n" : null ).$lang['Order_customer_firma']."\n-----------------------------------------------\n"."Nr zamówienia: 1".$iOrder."\n"."Inteo 50 1020 50 0096 "."\n"."Eyk Zak\nGroa 28\nPań"."\n-----------------------------------------------\n".$lang['Summary_cost'].': '.$this->aOrders[$iOrder]['sOrderSummary'].' '.$config['currency_symbol']."\n-----------------------------------------------\n".$lang['Check_order_status_url']."\n".$sOrderUrlEmail."\n-----------------------------------------------\n".$lang['Order_customer_email_foot']."" );
  6. $aSend['sTopic'] = $lang['Order_customer_info_title'].$iOrder;
  7. $aSend['sSender'] = $GLOBALS['config']['orders_email'];
  8.  
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




To pokaz jak wstawiales ten html czy css, pokaz jakie bledy dostajesz.

ps: przenosze
Go to the top of the page
+Quote Post
Azonic
post
Post #3





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 19.04.2014

Ostrzeżenie: (0%)
-----


Tabelka:


  1. $aSend['sMailContent'] = preg_replace( '/|n|/', "n",
  2.  
  3. $content .= '<tr class="l'.( ( $i == ( $iCount - 1 ) ) ? 'L': $i + 1 ).'">
  4.  
  5. <th><td>
  6. $lang['Order_customer_email_head']."WYSWIETLANA TREŚĆ".
  7. </th></td>
  8. </tr>';

Parse error: syntax error, unexpected 'Order_customer_email_head' (T_STRING) in C:\xampp\htdocs\rsc\core\orders.php on line 540


Kolor tekstu:

  1. $aSend['sMailContent'] = preg_replace( '/|n|/', "n", $lang['Order_customer_email_head']."<span style="color:red">WYSWIETLANA TREŚĆ</span>".

Parse error: syntax error, unexpected 'color' (T_STRING) in C:\xampp\htdocs\rsc\core\orders.php on line 534

Także kombinowałem z zakończeniem kodu php założmy przed $aSend oraz wstawieniu przed $aSend <span style="color:red"> i następnie znowu rozpoczęcie kodu php po $aSend
Coś w tym stylu:
  1. ?> // zakonczenie kodu php
  2. <span style="color:red">
  3. <?php
  4. $aSend['sMailContent'] = preg_replace( '/|n|/', "n", $lang['Order_customer_email_head']."WYSWIETLANA TREŚĆ".
  5. ?> </span>


Niestety za każdym razem błąd

Ten post edytował Azonic 20.04.2014, 19:54:05
Go to the top of the page
+Quote Post
Turson
post
Post #4





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

Ostrzeżenie: (0%)
-----


Problem masz z łączeniem zmiennych, a nie generowaniem treści.


tu robisz dobrze
  1. $content .= '<tr class="l'.( ( $i == ( $iCount - 1 ) ) ? 'L': $i + 1 ).'">

a nizej juz nie
  1. <th><td>
  2. $lang['Order_customer_email_head']."WYSWIETLANA TREŚĆ".
  3. </th></td>


zacznij od podstaw
Go to the top of the page
+Quote Post
Azonic
post
Post #5





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 19.04.2014

Ostrzeżenie: (0%)
-----


Proszę o jakieś rady lub przykład.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 18:33