setFrom("{KT_defaultSender}"); $emailObj->setTo("{SESSION.kt_login_email}"); $emailObj->setCC(""); $emailObj->setBCC("{KT_defaultSender}"); $emailObj->setSubject("Prenotazione acquisto"); //WriteContent method $emailObj->setContent(""); $emailObj->setEncoding("ISO-8859-1"); $emailObj->setFormat("HTML/Text"); $emailObj->setImportance("Normal"); return $emailObj->Execute(); } //end Trigger_SendEmail trigger $subjectMail = $labels['KEY_SUBJECTMAIL']; //start Trigger_Custom trigger function Trigger_Custom(&$tNG) { // Global Variable global $database_database, $database, $subjectMail, $database_catalogo, $catalogo; // Send Email $mail = new PHPMailer(); $mail->Mailer = "smtp"; $mail->Host = "authsmtp.fnm-marine.com"; $mail->SMTPAuth = TRUE; $mail->Username = "smtp@fnm-marine.com"; $mail->Password = "65CLAUDIO"; $mail->From = "noreply@fnm-marine.com"; $mail->FromName = "FNM Marine"; $mail->Sender = "noreply@fnm-marine.com"; $mail->AddAddress($_SESSION['kt_login_email']); $mail->AddAddress("info@cmdengine.com"); $colname_rsLingua = "1"; if (isset($_SESSION['idLanguage'])) { $colname_rsLingua = $_SESSION['idLanguage']; } mysql_select_db($database_database, $database); $query_rsLingua = sprintf("SELECT sitelabels_static.*, sitelabels.* FROM sitelabels_static JOIN sitelabels on sitelabels_static.key_label = sitelabels.id WHERE sitelabels_static.language_label = %s", GetSQLValueString($_SESSION['idLanguage'], "int")); $rsLingua = mysql_query($query_rsLingua, $database) or die(mysql_error()); $row_rsLingua = mysql_fetch_assoc($rsLingua); $totalRows_rsLingua = mysql_num_rows($rsLingua); // Trasformare resultSet in Array $labels = array(); for( $i = 0; $i < $totalRows_rsLingua; $i++ ) { // Array $labels[$row_rsLingua['labelname']] = $row_rsLingua['value_label']; // Go on $row_rsLingua = mysql_fetch_assoc($rsLingua); } // Get Message $fileHandler = fopen("messaggio_".$_SESSION['idLanguage'].".html", "r"); $stringaMessaggio = fread($fileHandler, filesize("messaggio_".$_SESSION['idLanguage'].".html")); // Prepare new Message mysql_select_db($database_database, $database); $query_rsCarrello = sprintf("SELECT * FROM carrello WHERE carrello.utente_carrello = %s", GetSQLValueString($_SESSION['kt_login_id'], "int")); $rsCarrello = mysql_query($query_rsCarrello, $database) or die(mysql_error()); $row_rsCarrello = mysql_fetch_assoc($rsCarrello); $totalRows_rsCarrello = mysql_num_rows($rsCarrello); $newText = ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $totale = 0.00; $totaleA = 0.00; for( $i = 0; $i < $totalRows_rsCarrello; $i++ ) { if( $row_rsCarrello['type_carrello'] == "articoli" ) { mysql_select_db($database_catalogo, $catalogo); $query_rsArticoliCarrello = sprintf("SELECT * FROM articolo WHERE ID = %s", GetSQLValueString($row_rsCarrello['articolo_carrello'], "int")); $rsArticoliCarrello = mysql_query($query_rsArticoliCarrello, $catalogo) or die(mysql_error()); $row_rsArticoliCarrello = mysql_fetch_assoc($rsArticoliCarrello); $totalRows_rsArticoliCarrello = mysql_num_rows($rsArticoliCarrello); $prezzo_unitario = $row_rsArticoliCarrello['prezzo']; $codice = $row_rsArticoliCarrello['codice']; $descrizione = calcolaNome( $row_rsArticoliCarrello['descrizione'] ); $prezzo = $row_rsArticoliCarrello['prezzo']; $totale = number_format( $row_rsCarrello['quantita_carrello'] * $row_rsArticoliCarrello['prezzo'], 2, ".", "," ); } else if( $row_rsCarrello['type_carrello'] == "accessori" ) { mysql_select_db($database_database, $database); $query_rsArticoliCarrello = sprintf("SELECT accessori.*, accessori_details.* FROM accessori JOIN accessori_details ON accessori_details.idaccessori_details = accessori.id_accessori WHERE language_details = %s AND id_accessori = %s", GetSQLValueString($_SESSION['idLanguage'], "int"), GetSQLValueString($row_rsCarrello['articolo_carrello'], "int")); $rsArticoliCarrello = mysql_query($query_rsArticoliCarrello, $database) or die(mysql_error()); $row_rsArticoliCarrello = mysql_fetch_assoc($rsArticoliCarrello); $totalRows_rsArticoliCarrello = mysql_num_rows($rsArticoliCarrello); $prezzo_unitario = $row_rsArticoliCarrello['prezzo_accessori']; $codice = $row_rsArticoliCarrello['codice_accessori']; $descrizione = calcolaNome( $row_rsArticoliCarrello['titolo_details'] ); $prezzo = $row_rsArticoliCarrello['prezzo_accessori']; $totale = number_format( $row_rsCarrello['quantita_carrello'] * $row_rsArticoliCarrello['prezzo_accessori'], 2, ".", "," ); } else if( $row_rsCarrello['type_carrello'] == "motore" ) { mysql_select_db($database_database, $database); $query_rsArticoliCarrello = sprintf("SELECT * FROM motore WHERE ID = %s", GetSQLValueString($row_rsCarrello['articolo_carrello'], "int")); $rsArticoliCarrello = mysql_query($query_rsArticoliCarrello, $database) or die(mysql_error()); $row_rsArticoliCarrello = mysql_fetch_assoc($rsArticoliCarrello); $totalRows_rsArticoliCarrello = mysql_num_rows($rsArticoliCarrello); $prezzo_unitario = $row_rsArticoliCarrello['prezzo_motore']; $codice = $row_rsArticoliCarrello['codice_motore']; $descrizione = calcolaNome( $row_rsArticoliCarrello['nome'] ); $prezzo = $row_rsArticoliCarrello['prezzo_motore']; $totale = number_format( $row_rsCarrello['quantita_carrello'] * $row_rsArticoliCarrello['prezzo_motore'], 2, ".", "," ); } $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $totaleA += $row_rsCarrello['quantita_carrello'] * $prezzo_unitario; $row_rsCarrello = mysql_fetch_assoc($rsCarrello); } $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $iva = $totaleA * 0.20; $tot = $totaleA + $iva; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= ""; $newText .= "
".$labels['KEY_QUANTITA']."".$labels['KEY_CODICE']."".ucfirst($labels['KEY_DESCRIZIONE'])."".$labels['KEY_PREZZO']."".$labels['KEY_TOTALE']."
".$row_rsCarrello['quantita_carrello']."".$codice."".$descrizione."€ ".$prezzo_unitario."€ ".$totale."

 ".$labels['KEY_SUBTOTALE']."€ ".number_format($totaleA, 2, ",", ".")."
 ".$labels['KEY_IVA']."€ ".number_format($iva, 2, ",", ".")."
 ".$labels['KEY_TOTALE']."€ ".number_format($tot, 2, ",", ".")."
"; fclose($fileHandler); // Cliente mysql_select_db($database_database, $database); $query_rsUtente = sprintf("SELECT * FROM utenti WHERE id = %s", GetSQLValueString($_SESSION['kt_login_id'], "int")); $rsUtente = mysql_query($query_rsUtente, $database) or die(mysql_error()); $row_rsUtente = mysql_fetch_assoc($rsUtente); $totalRows_rsUtente = mysql_num_rows($rsUtente); // Substitute new Message $stringaMessaggio = str_replace("[CLIENTE_HERE]", $row_rsUtente['cognome_utente']." ".$row_rsUtente['nome_utente'], $stringaMessaggio); $stringaMessaggio = str_replace("[INDIRIZZO_HERE]", $row_rsUtente['indirizzo_utente'], $stringaMessaggio); $stringaMessaggio = str_replace("[CITTA_HERE]", $row_rsUtente['citta_utente']." (".$row_rsUtente['provincia_utente'].")", $stringaMessaggio); $htmlBody = str_replace("[MESSAGE_HERE]", $newText, $stringaMessaggio); // Message $mail->Subject = $subjectMail; $mail->MsgHTML($htmlBody); if( $mail->Send() ) { // Prepare new Message mysql_select_db($database_database, $database); $query_rsCarrello = sprintf("DELETE FROM carrello WHERE carrello.utente_carrello = %s", GetSQLValueString($_SESSION['kt_login_id'], "int")); mysql_query($query_rsCarrello, $database) or die(mysql_error()); } } //end Trigger_Custom trigger // Make a custom transaction instance $customTransaction = new tNG_custom($conn_database); $tNGs->addTransaction($customTransaction); // Register triggers $customTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "GET", "op"); $customTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "ok.php"); $customTransaction->registerTrigger("AFTER", "Trigger_Custom", 50); // Add columns // End of custom transaction instance // Execute all the registered transactions $tNGs->executeTransactions(); // Get the transaction recordset $rscustom = $tNGs->getRecordset("custom"); $row_rscustom = mysql_fetch_assoc($rscustom); $totalRows_rscustom = mysql_num_rows($rscustom); ?> Documento senza titolo getErrorMsg(); ?>