Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Insert Order Number in Email Confirmation Subject (osCom 2.3.4)


ezfindit

Recommended Posts

There was an old contribution I successfully used (for v.2.2-MS2) that allowed me to insert the Order No. into the Email Confirmation Subject.  Hence when the customer placed an order it displayed: "Order Process: 7899."  This was also helpful when the admin got a copy of the order that displayed the order number.

https://www.oscommerce.com/forums/topic/136025-order-number-and-status-in-update-emails/?page=2


I have modified /catalog/checkout_process.php 

from:

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

to:

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

AND

from:

// 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);
  }

to:

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

However, the Order Number is not inserted in the Email Subject!

Instead of seeing: "Order Process: 7899"  I get only "Order Process:" with no order number inserted in the Subject of the email confirmation received.

Any thoughts on why the order number is not displayed?  I think this would be useful mod for all store owners to have.

Chris

Link to comment
Share on other sites

You should read exactly https://www.oscommerce.com/forums/topic/136025-order-number-and-status-in-update-emails/?page=2

Then you will find your misstake.

 

You can not change the variable

EMAIL_TEXT_SUBJECT

to

$new_mail_subject

You should familiar with PHP programming, otherwise you get more problems with this very small changing.

 

  • 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

7 minutes ago, mcmannehan said:

I already tried using that same mod that I previously implemented and it worked fine in v.2.2-MS2 for my current site for 10 years!  I know the coding.  However, that coding does not seem to work the same in 2.3.4 that's why I've tried a slight modification and still no go.  

 

Chris

Link to comment
Share on other sites

The code works for the 2.3.4 too, because no changing between 2.2 and 2.3.4.

I told you already, your variable is wrong, the variable are empty, thats why you cant see the order number.

Check this out:

change from

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

to

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

To know coding and to understand coding is the same like day and night.

  • 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

17 minutes ago, mcmannehan said:

The code works for the 2.3.4 too, because no changing between 2.2 and 2.3.4.

I told you already, your variable is wrong, the variable are empty, thats why you cant see the order number.

Check this out:

change from


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

to


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

To know coding and to understand coding is the same like day and night.

I already tried using $order_id also!  I get back only "Order Process" with no order number displayed.  That's why I was asking for help.

 

Chris

Link to comment
Share on other sites

If $order_id not working, than you have some more bugs. Please posting your checkout_process.php  or send with PM to me

If you use paypal or some other payment modul, you need to change there too.

  • 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

6 minutes ago, mcmannehan said:

If $order_id not working, than you have some more bugs. Please posting your checkout_process.php  or send with PM to me

If you use paypal or some other payment modul, you need to change there too.

I'm using the PayPal App (latest version) with Payments Standard option.  Which file needs to be modified?  I've looked around but did not see the tep_mail code. (In my current v.2.2-MS2 I modified the includes/modules/payment/paypal_ipn.php file, but that no longer exists with the new PayPal App.)

Chris

Link to comment
Share on other sites

Try to change $order_id to $insert_id

for the new paypal app find /includes/modules/payment/paypal_standard.php

  • 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, mcmannehan said:

Try to change $order_id to $insert_id

for the new paypal app find /includes/modules/payment/paypal_standard.php

I've tried both $order_id to $insert_id with the same result.  No go!  That's why I created this thread.  It's so frustrating.  It worked perfectly in v.2.2-MS2 (took me 15 minutes to code and test) and flawlessly for 10+ years!


 

Chris

Link to comment
Share on other sites

5 minutes ago, ezfindit said:

for the new paypal app find /includes/modules/payment/paypal_standard.php

I wonder it that's the culprit.  Let me fiddle with it and see. Thanks!

Chris

Link to comment
Share on other sites

hmmmmmm..... I did test with osC 2.3.4 BS. I change the code to $insert_id and it works. What happens if the Order email send? The link inside show the Order number?

  • 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

1 minute ago, mcmannehan said:

What happens if the Order email send? The link inside show the Order number?

All the information inside the email works perfectly.  Only the darn Email Subject is not displaying.  Editing the paypal_standard.php file now with the same mods and re-testing...

 

Chris

Link to comment
Share on other sites

this is the code for the link:

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n" .

if everything working, than $insert_id should working.

  • 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

1 minute ago, mcmannehan said:

this is the code for the link:


EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $insert_id, 'SSL', false) . "\n" .

if everything working, than $insert_id should working.

Hence my frustration!  :) 

Chris

Link to comment
Share on other sites

This is the answer:

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT. ' ' . $insert_id, $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 . ' ' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

Dont need to change more

  • 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, mcmannehan said:

This is the answer:


tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT. ' ' . $insert_id, $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 . ' ' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

Dont need to change more

That's the first thing I tried, but it didn't work.  See my code I sent via PM.  Then I started trying other mods since that didn't work.  It's driving me nuts!

Chris

Link to comment
Share on other sites

okay, sorry, the same changes at the checkout_process.php works for me. And if everything correct in the e-mail, than i can't help you more, because $insert_id is the right variable.

  • 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

Here's my code:
 

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

Get Email Subject = "Order Process" only!  :(

Chris

Link to comment
Share on other sites

EUREKA!  Finally figured it out!

Using the new PayPal App (v5.010) - Payments Standards means that this file sends out the notification emails (not checkout_process.php): /catalog/includes/modules/payment/paypal_standard.php

Also, you have to use $order_id (NOT $insert_id):

Here's the code for both customer and admin email notifications:
Customer Email Notify

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


Admin Email Notify

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

Phew....

Hope this helps other folks who struggled with this issue or who want to enhance the usability of the emails sent when processing an order by including the Order No information in the Subject.

Chris

Link to comment
Share on other sites

If I am not mistaken  ext/modules/payment/paypal/standard_ipn.php  also includes the same code for sending out email so that needs changing too.

This is because either the ipn or paypal_standard sends out the email depending on which is triggered first when a customer returns to the store or the ipn is sent (please correct me if I am wrong someone)

 

Doug

Link to comment
Share on other sites

Hi there

just tested the above in paypal sandbox

changing both paypal_standard.php and the same code in ext/modules/payment/paypal/standard_ipn.php  

I did not return to the store and let ipn do its work and the emails were sent with order numbers

Link to comment
Share on other sites

9 hours ago, douglaswalker said:

ext/modules/payment/paypal/standard_ipn.php  

Yes, that file also contains the code that sends out the emails.  However, in my extensive Sandbox testing (using multiple coding flags to identify which file sent the emails) that file was not called by the PayPal App.

FYI, There are 3 different files that sent out the confirmation emails.

    /catalog/checkout_process.php
    /catalog/ext/modules/payment/paypal/standard_ipn.php   
    /catalog/includes/modules/payment/paypal_standard.php

 

Chris

Link to comment
Share on other sites

that is interesting.. I made slight differences in the email to see which code sent it. Ipn sent email when it returned first---- standard if it returned first and the slight difference in email showed me which one.

 

Doug

 

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...