Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with my custom modification


compwhizmm90

Recommended Posts

I have installed and modified the batch order status update contribution. I have modified it so that if the order status is a certain status, it send a different email then the other emails. I also wanted it just to include the first name in the email. If I set it to $check_status['customers_name'], it included the first and last name. So I modified it to make a call to the customers table and get only the first name. Anyway, with batch order status update, you can update the status of multiple orders. So my modification only puts the first name of the first email, and puts nothing on any of the other emails. Here is a piece of my code so you can see what I'm doing. I bolded the parts that deal with getting the first name

 

 

$check_status_query = tep_db_query("select customers_id, customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$this_orderID . "'");

$check_status = tep_db_fetch_array($check_status_query);

$comments = "";

if ($check_status['orders_status'] != $status) {

tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$this_orderID . "'");

$customer_notified ='0';

if (isset($HTTP_POST_VARS['notify'])) {

$notify_comments = '';

 

 

if($HTTP_POST_VARS['new_status'] == '8') {

 

//get first name!

 

//the id

$customerid = $check_status["customers_id"];

//sql query

 

$getid_query = tep_db_query("SELECT customers_firstname FROM customers WHERE customers_id = " . $customerid . "");

$getid = tep_db_fetch_array($getid_query);

 

// end get first name

 

//add From: header

$headers = "From: Summer Hill Seeds <ro**n@summe****lseeds.com> \r\n";

 

//specify MIME version 1.0

$headers .= "MIME-Version: 1.0\r\n";

 

//unique boundary

$boundary = uniqid("HTMLDEMO");

 

//tell e-mail client this e-mail contains//alternate versions

$headers .= "Content-Type: multipart/alternative" .

"; boundary = $boundary\r\n\r\n";

 

//message to people with clients who don't

//understand MIME

$headers .= "This is a MIME encoded message.\r\n\r\n";

 

//plain text version of message

$headers .= "--$boundary\r\n" .

"Content-Type: text/plain; charset=ISO-8859-1\r\n" .

"Content-Transfer-Encoding: base64\r\n\r\n";

$headers .= chunk_split(base64_encode("Hi, I would like to let you know that your order #" . $this_orderID . " has been shipped. You may view more information about this order by going here: " . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, "order_id=" . $this_orderID, 'SSL') . "I would like to thank you for shopping with us, and I hope you come back soon. If you have any questions, please reply to this email. \n\n Best Regards, \n\n Robin Bennett \n Summer Hill Seeds"));

 

//HTML version of message

$headers .= "--$boundary\r\n" .

"Content-Type: text/html; charset=ISO-8859-1\r\n" .

"Content-Transfer-Encoding: base64\r\n\r\n";

$headers .= chunk_split(base64_encode('<html>

 

<head>

<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Order Update</title>

</head>

 

<body>

 

<p>Hi ' . $getid["customers_firstname"] . ',</p>

<p>I would like to let you know that your order #' . $this_orderID . ' has been shipped. I would like

to thank you for shopping at Summer Hill Seeds, and hope you come back soon. If

you have any questions or concerns, please do not hesitate to reply to this

email. </p>

<p>For more information about your order, click here: ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $this_orderID, 'SSL') . '</p>

<p>Best Regards,</p>

<p>Robin Bennett<br>

Summer Hill Seeds<br>

<a href="http://www.summerhillseeds.com">www.summerhillseeds.com</a><br>

 

</body>

 

</html>

'));

 

 

 

if(mail($check_status['customers_email_address'], "Order Update", "", $headers))

$customer_notified = '1';

else

$customer_notified = '0';

 

 

 

 

} else {

 

 

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $this_orderID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $this_orderID, '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]);

 

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

$customer_notified = '1';

 

}

 

}

 

 

 

Thanks for any Help :)

Edited by compwhizmm90
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...