Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Duplicate order mail


YePix

Recommended Posts

May you should get more familiar with the osC logic. 🤠

check catalog/checkout_process.php
may be the function tep_mail is in a loop

or change the settings in admin/email options configuration

 

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

2.3.4-1 EDGE

this is my mail in checkout_process:
 

  $email_order = EMAIL_CUSTOMER_ORDERINFO . ' ' . STORE_NAME . "\n" . 
                 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                 EMAIL_SEPARATOR . "\n" . 
                 EMAIL_TEXT_INVOICE_URL . "\n" . tep_href_link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n\n" .
                 EMAIL_CUSTOMER .' '. $order->customer['firstname'] . ' ' . $order->customer['lastname']."\n" . 
                 ENTRY_TELEPHONE_NUMBER .' '. $order->customer['telephone']."\n" . 
                 '<font color="#990000"><strong>' . strftime(DATE_FORMAT_LONG) . '&nbsp;' . $datum . '</strong></font><font color="#0099FF"><strong>' . "\n\n";

// PWA guest checkout
  echo $OSCOM_Hooks->call('pwa', 'PwaCheckoutMailMod');

  if ($order->info['comments']) {
    $email_order .= tep_db_output($order->info['comments']) . "\n";
  }

  $email_order .= '</strong></font>' . EMAIL_SEPARATOR . "\n\n" .
//                EMAIL_TEXT_PRODUCTS . "\n" . 
//                EMAIL_SEPARATOR . "\n" . 
                  $products_ordered . 
                  EMAIL_SEPARATOR . "\n";

  for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
    $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
  }

  if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_SEPARATOR . "\n" .
                           '<font color="#990000">' . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                           tep_address_label($customer_id, $sendto, 0, '', "\n") . '</font>' . "\n\n";

if (SHOW_PRODUCTS_SHIPPING_TIME_ON == 'true') { 
                    $today_year = date('Y');                    
                    list($lieferdatum_von,$lieferdatum_bis) = get_lieferzeitraum($order->info['country_id']);
      $email_order .= "\n" . TEXT_LIEFERUNG_PI .  $lieferdatum_von . TEXT_LIEFERUNG_PI_TO . $lieferdatum_bis . $today_year . "\n\n";
}
  }

  if (SEND_IN_MAIL_BILLING_ADDRESS == 'true') { 
  $email_order .= "\n" . EMAIL_SEPARATOR . "\n" .
                         EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                         tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
}

  if (is_object($$payment)) {
    $email_order .= EMAIL_SEPARATOR . "\n" . 
                    EMAIL_TEXT_PAYMENT_METHOD . "\n"; 
                    
    $payment_class = $$payment;
    $email_order .= $order->info['payment_method'] . "\n\n";
    if (isset($payment_class->email_footer)) {
      $email_order .= $payment_class->email_footer . "\n\n";
    }
  }
  if (SEND_EMAIL_TSTM == 'true') { 
      $email_order .= TEXT_INFORMATION_TSTM . "\n";
}

  tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }


// load the after_process function from the payment modules
  $payment_modules->after_process();
  
// remove items from wishlist if customer purchased them
  $wishList->clear();  

  $cart->reset(true);

// unregister session variables used during checkout
  tep_session_unregister('sendto');
  tep_session_unregister('billto');
  tep_session_unregister('shipping');
  tep_session_unregister('payment');
  tep_session_unregister('comments');

// POINTS REWARDS BS
  echo $OSCOM_Hooks->call('checkout_process', 'CheckoutProcessUnregister');


  tep_redirect(tep_href_link('checkout_success.php', '', 'SSL'));

 

Link to comment
Share on other sites

and this my classes/mail
 

  require_once 'ext/modules/PHPMailer/class.phpmailer.php';
  $phpMail = new PHPMailer();
  class email {
    var $html;
    var $text;
    var $html_text;
    var $lf;
    var $debug = 0;
    var $debug_output = 'error_log';
    function email($headers = '') {
      global $phpMail;
      $phpMail->XMailer = 'osCommerce Mailer ' . tep_get_version();
      $phpMail->SMTPDebug = $this->debug;
      $phpMail->Debugoutput = $this->debug_output;
      $phpMail->CharSet = CHARSET;
      $phpMail->WordWrap = 998;
      if (EMAIL_LINEFEED == 'CRLF') {
        $this->lf = "\r\n";
      } else {
        $this->lf = "\n";
      }
    }
    function add_text($text = '') {
      global $phpMail;
      $phpMail->IsHTML(false);
      $this->text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
    }
    function add_html($html, $text = NULL, $images_dir = NULL) {
      global $phpMail;
      $phpMail->IsHTML(true);
      $this->html = tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br />', $html);
      $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
      if (isset($images_dir)) $this->html = $phpMail->msgHTML($this->html, $images_dir);
    }
    function add_attachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') {
      global $phpMail;
      $phpMail->AddAttachment($path, $name, $encoding, $type, $disposition);
    }
    function build_message() {
      //out of work function
    }
    function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $reply_to = false) {
      global $phpMail;
      if ((strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false)) {
        return false;
      }
      if ((strstr($to_addr, "\n") != false) || (strstr($to_addr, "\r") != false)) {
        return false;
      }
      if ((strstr($subject, "\n") != false) || (strstr($subject, "\r") != false)) {
        return false;
      }
      if ((strstr($from_name, "\n") != false) || (strstr($from_name, "\r") != false)) {
        return false;
      }
      if ((strstr($from_addr, "\n") != false) || (strstr($from_addr, "\r") != false)) {
        return false;
      }
      $phpMail->From = $from_addr;
      $phpMail->FromName = $from_name;
      $phpMail->AddAddress($to_addr, $to_name);
      if ($reply_to) {
        $phpMail->AddReplyTo(EMAIL_SMTP_REPLYTO, STORE_NAME);
      } else {
        $phpMail->AddReplyTo($from_addr, $from_name);
      }
      $phpMail->Subject = $subject;
      if (!empty($this->html)) {
        $phpMail->Body = $this->html;
        $phpMail->AltBody = $this->html_text;
      } else {
        $phpMail->Body = $this->text;
      }
      if (EMAIL_TRANSPORT == 'smtp' || EMAIL_TRANSPORT == 'gmail') {
        $phpMail->IsSMTP();
        $phpMail->Host = EMAIL_SMTP_HOSTS;
        $phpMail->SMTPAuth = EMAIL_SMTP_AUTHENTICATION;
        $phpMail->Username = EMAIL_SMTP_USER;
        $phpMail->Password = EMAIL_SMTP_PASSWORD;
        if (EMAIL_TRANSPORT == 'gmail') {
          $phpMail->Port = 465;
          $phpMail->SMTPSecure = 'ssl';
        }
      } else {
        $phpMail->isSendmail();
      }
      if (!$phpMail->Send()) {
        return false;
      }
      return true;
    }
  }
/* ** Altered for Mail Manager ** */
// eliminate line feeds as <br>
  class emailMailManager extends email { 
	function add_html($html, $text = NULL, $images_dir = NULL) {
	  $this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
	  $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
	  if (isset($images_dir)) $this->find_html_images($images_dir);
	}
  }
/* ** EOF alterations for Mail Manager ** */

 

Link to comment
Share on other sites

...............................

//------insert customer choosen option eof ----
    $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
  } // <--------------------------- this is an end of a for loop
                                    // make shure the following code is is not inside

// lets start with the email confirmation
  $email_order = STORE_NAME . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
  if ($order->info['comments']) {
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
  }
  $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                  EMAIL_SEPARATOR . "\n" . 
                  $products_ordered . 
                  EMAIL_SEPARATOR . "\n";

  for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
    $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
  }

  if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                    EMAIL_SEPARATOR . "\n" .
                    tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
  }

  $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                  EMAIL_SEPARATOR . "\n" .
                  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
  if (is_object($$payment)) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                    EMAIL_SEPARATOR . "\n";
    $payment_class = $$payment;
    $email_order .= $order->info['payment_method'] . "\n\n";
    if (isset($payment_class->email_footer)) {
      $email_order .= $payment_class->email_footer . "\n\n";
    }
  }
  tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

// load the after_process function from the payment modules
  $payment_modules->after_process();

  $cart->reset(true);

...............................

in catalog/checkout_process.php

Check also the class file of the email.
Check all files for the checkout!

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

Did you have the mail manager add-on installed? This add-on disables the stock tep_mail function and uses its own. If you have not disabled or forgot to disable the stock tep_mail, then it is likely to send out twice.

Link to comment
Share on other sites

// PWA guest checkout
  echo $OSCOM_Hooks->call('pwa', 'PwaCheckoutMailMod');

commend this out for to check!

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

commend this out and try

// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

Get the latest Responsive osCommerce CE (community edition) here .

Link to comment
Share on other sites

vor 6 Minuten schrieb Omar_one:

commend this out and try


// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

Yes that was it. Thanks. But now I need the order mail for the admin

Link to comment
Share on other sites

9 minutes ago, Omar_one said:

commend this out and try


// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

 

@Omar_oneThis can configure in the admin area. The SEND_EXTRA_ORDER_EMAILS_TO variable dosen't contain the customer email, so this can't be the issue!

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

If the customer get the order e-mail twice than why the SEND_EXTRA_ORDER_EMAILS_TO is filled with the customer e-mail address???

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

2 minutes ago, kgtee said:

You must be doing some test pretending yourself as the customer....🤣 That code actually send extra emails to store owner.

i think that too... 🤣🤣 some people are very clever! 🤣🤣
see my signature: 99.9% of the bugs sit in front of the computer! 🤣🤣

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

You probably have the test account setup with the same mail like the store owners mail. That's because you get it twice, one for the customer another for the store owner.

Link to comment
Share on other sites

1 minute ago, raiwa said:

You probably have the test account setup with the same mail like the store owners mail. That's because you get it twice, one for the customer another for the store owner.

that's right .. try different mail account then admin email account

Get the latest Responsive osCommerce CE (community edition) here .

Link to comment
Share on other sites

vor 8 Minuten schrieb raiwa:

You probably have the test account setup with the same mail like the store owners mail. That's because you get it twice, one for the customer another for the store owner.

Hello Rainer, unfortunately not. the order mails arrive twice at all mail accounts

Link to comment
Share on other sites

so you get 4 order emails???

24 minutes ago, Omar_one said:

commend this out and try


// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

If this the proplem, so why the SEND_EXTRA_ORDER_EMAILS_TO is filled with the customer e-mail address???

May be some issue elsewhere...

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

20 minutes ago, YePix said:

Yes that was it. Thanks. But now I need the order mail for the admin

If it was the extra order mail in this snippet:

26 minutes ago, Omar_one said:

commend this out and try


// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

then it must be related to the store owners mail/extra order mail. Do you have more than one mail entered in Admin for to send extra order mail?

Link to comment
Share on other sites

14 minutes ago, raiwa said:

You probably have the test account setup with the same mail like the store owners mail. That's because you get it twice, one for the customer another for the store owner.

If no issue in the code, than this is the only logical answer.

27 minutes ago, Omar_one said:

commend this out and try


// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

 

If this fix the problem, so i ask again:  why the SEND_EXTRA_ORDER_EMAILS_TO is filled with the customer e-mail address??? 

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

vor 3 Minuten schrieb raiwa:

If it was the extra order mail in this snippet, then it must be related to the store owners mail/extra order mail. Do you have more than one mail entered in Admin for to send extra order mail? 

No.

Shop email address
Email from
and additional order mail to admin is always the same email address

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...