Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP Ignoring me?


oscommerce2006

Recommended Posts

I have the following code in admin/includes/languages/english/orders.php

 

 

$email_order = EMAIL_GREETING . '' . $order->customer['firstname'] . ' ' .$order->customer['lastname'] . "\n\n" .

 

 

For some reason the email the customer receives doesn't include their name just Dear and then a space. Can anyone see an error in my code?

 

Many thanks

Link to comment
Share on other sites

The rest of the order e-mail content is in catalog/checkout_process.php, around line 222, down below where it says

 

//let's start with the e-mail confirmation.

 

 

Then, depending on where you put it you might need $email_order.= (.= instead of just =), like this

 

$email_order.= EMAIL_GREETING . '' . $order->customer['firstname'] . ' ' .$order->customer['lastname'] . "\n\n" .

 

Maybe I'm thinking of a different e-mail :unsure:

 

Is it one particular e-mail that does that or all of them (order confirmation/status e-mail, welcome e-mail, etc...?)

Link to comment
Share on other sites

The rest of the order e-mail content is in catalog/checkout_process.php, around line 222, down below where it says

 

//let's start with the e-mail confirmation.

Then, depending on where you put it you might need $email_order.= (.= instead of just =), like this

 

$email_order.= EMAIL_GREETING . '' . $order->customer['firstname'] . ' ' .$order->customer['lastname'] . "\n\n" .

 

Maybe I'm thinking of a different e-mail :unsure:

 

Is it one particular e-mail that does that or all of them (order confirmation/status e-mail, welcome e-mail, etc...?)

 

 

Hi,

 

I have changed the email confirmation to include the first name and last name and all works well. But when I added the abov code into orders.php It jst ignores it. Any ideas?

Link to comment
Share on other sites

$email_order.= EMAIL_GREETING . '' . $order->customer['firstname'] . ' ' .$order->customer['lastname'] . "\n\n" .

 

after EMAIL_GREETING it looks like a quotation mark ('') and after first name it looks like an apostraphes (' ') and then different again after lastname ("). Double check to see they are correct.

Link to comment
Share on other sites

Peter has a good point, and I think you should post more of the surrounding lines, so we can see it in the context of the other code. :thumbsup:

 

Hi it is 2 x 's but the middle one has a sapce in between to seperate the first name and last name.

 

More code:

 

$email_order = EMAIL_GREETING . '' . $order->customer['firstname'] . ' ' .$order->customer['lastname'] . "\n\n" . EMAIL_GREETING1 . '' .STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

Link to comment
Share on other sites

Ok...you've got this in orders.php, correct? As far as I know, the e-mail in that file only goes out when the status is updated in admin. The one that goes out right after their order is specified elsewhere (checkout_process.php, I think). But...that's beside the point :huh:

 

Save what you have and try this, I think it will get you closer to what you want. :)

 

$email = EMAIL_GREETING . '' . $check_status['customers_name'] . "\n\n" . EMAIL_GREETING1 . '' .STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

Link to comment
Share on other sites

I have the following code in admin/includes/languages/english/orders.php

 

Shouldn't it be in admin/includes/orders.php. If this is a mod are you sure you put it in the right place?

Link to comment
Share on other sites

Yes, Java had a good point. I forgot about that. I tested the code I posted...but I should clarify I tested it w/it sitting in admin/orders.php ...not a language file.

 

I put it around line 54 of admin/orders.php, in place of the original code (this:)

 

OLD

 

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

NEW

 

$email = EMAIL_GREETING . '' . $check_status['customers_name'] . "\n\n" . EMAIL_GREETING1 . '' .STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

Link to comment
Share on other sites

Yes, Java had a good point. I forgot about that. I tested the code I posted...but I should clarify I tested it w/it sitting in admin/orders.php ...not a language file.

 

I put it around line 54 of admin/orders.php, in place of the original code (this:)

 

OLD

 

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

NEW

 

$email = EMAIL_GREETING . '' . $check_status['customers_name'] . "\n\n" . EMAIL_GREETING1 . '' .STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

Thank you!

 

This worked a treat!

Link to comment
Share on other sites

Is it possible to put the updated status in the email header? I.e if status is changed to Delivered the email header would read Order Update - Delivered. I have had a go at doing this but i'm now getting Order Update - $orders_status_array[$status]. I entered $orders_status_array[$status] in the orders.php in the language file next to order update but this doesn't work.

Link to comment
Share on other sites

Is it possible to put the updated status in the email header? I.e if status is changed to Delivered the email header would read Order Update - Delivered. I have had a go at doing this but i'm now getting Order Update - $orders_status_array[$status]. I entered $orders_status_array[$status] in the orders.php in the language file next to order update but this doesn't work.

 

For the status in the e-mail subject, try this:

 

In admin/includes/languages/english/orders.php

 

find

 

define('EMAIL_TEXT_SUBJECT', 'Order Update');

 

change it to

 

define('EMAIL_TEXT_SUBJECT', 'Order Update - %s');

 

Then in admin/orders.php

 

find (around line 52)

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

change it to

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], sprintf(EMAIL_TEXT_SUBJECT,$orders_status_array[$status]), $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

 

That should do it. :)

Link to comment
Share on other sites

For the status in the e-mail subject, try this:

 

In admin/includes/languages/english/orders.php

 

find

 

define('EMAIL_TEXT_SUBJECT', 'Order Update');

 

change it to

 

define('EMAIL_TEXT_SUBJECT', 'Order Update - %s');

 

Then in admin/orders.php

 

find (around line 52)

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

change it to

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], sprintf(EMAIL_TEXT_SUBJECT,$orders_status_array[$status]), $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

That should do it. :)

 

Thanks Mark, I've got it working. Cheers

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...