Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

user greeting in order confirmation email


rizrock

Recommended Posts

Hi,

 

If you look in the file "checkout_process.php", line 258 is where the order is emailed (I _think_):

 

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

 

The variable "$email_order" is built by the preceeding lines. As your need is to begin the order with the required text, you will need to change these 2 lines:

 

222  // lets start with the email confirmation
223    $email_order = STORE_NAME . "\n" .

 

....to something like .....

 

222  // lets start with the email confirmation, first line is the greeting
223     $email_order = 'Hello'. $order->customer['firstname'] . ' ' . $order->customer['lastname']. ', thank you for your order!'. "\n";
224    $email_order .= STORE_NAME . "\n" .

 

the syntax for line 223 may be _way_ off, but I think you will get the general idea. There is a change in line 224, to append to the var $email_order, by the use of the ".="

 

I _think_ I have listed the correct file, from the code, it looks like it. :D

 

Peter

Link to comment
Share on other sites

Hi Peter,

 

it works absolutely perfect, just the way you wrote it. Does exactly what I wanted. Thanks very much.

 

Further I'm working on another subject:

 

In checkout_payment.php I need to add several input fields above the comments box. User specified data needs to be entered for my client to cast the customers horoscopes correctly.

 

I guess I'll just do some copy and pasting (from the create_account.php) and add the input data to the order email, almost following your example above. Do have any good clues or hints to do this the most efficient way? That would be cool... B)

 

thanks so far

 

riz

Link to comment
Share on other sites

Hi riz,

 

Further I'm working on another subject:

 

In checkout_payment.php I need to add several input fields above the comments box. User specified data needs to be entered for my client to cast the customers horoscopes correctly.

 

I haven't done any mods in osC where I needed to add extra fields (yet, but needed to do different types of mods), but just did a test 'order' on a website to wait till it got to 'checkout_payment.php', just so I can see what you mean.

 

There are 2 files when you are modifying 'checkout_payment.php', to consider:

 

1. /catalog/checkout_payment.php

 

2. /catalog/includes/languages/english/checkout_payment.php

 

and of course another 2 files (for espanol and german) if you want to mod those. But, I'll stick to the 2 I have mentioned.

 

You need to place it above the comments, see in bold Add Comments About Your Order, just above the comments box, this is done by:

 

/catalog/includes/languages/english/checkout_payment.php - line 27

 

define('TABLE_HEADING_COMMENTS', 'Add Comments About Your Order');

 

.. and

 

/catalog/checkout_payment.php - line 316

 

            <td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>

 

 

To add an input field, firstly study the source code, and then study the generated code. To add a 'simple' input field before the comments box, try the following:

 

<tr>
 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 <td class="main"><?php echo tep_draw_input_field('newinput1', $newinput1); ?></td>
 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>

 

The variable '$newinput1' can be set initially to blank/null, or you may want to assign a value to it ?

 

The trick with doing this, if you haven't done much PHP, is to start off with something very simple, and then add to it. That is, get the form changed how you want it, and _then_ look at how you are going to add the user input to the database..

 

Also, check out the source for /catalog/checkout_payment.php ; there is some Javascript code up the top, to validate input fields. You may want to do some of that on your new fields.

 

Hope that helps a bit,

 

Peter

Link to comment
Share on other sites

Hi Peter,

 

works!!!

 

I used a php validation on checkout_confirmation.php instead checking with javascript.

 

Thanks a lot. If I find the time I will put all the steps here for others to reconstruct.

 

riz

Link to comment
Share on other sites

Hi,

 

I'm trying to do a very similar thing while sending newsletters. I want to make it personal by addressing by their first name.

 

Any suggestions?

 

Thanks :D

Link to comment
Share on other sites

Hi,

 

I'm trying to do a very similar thing while sending newsletters. I want to make it personal by addressing by their first name.

 

Just checkout the post I replied to, it's 5 posts before this one. Something like this

 

222  // lets start with the email confirmation, first line is the greeting
223     $email_order = 'Hello'. $order->customer['firstname'] . ' ' . $order->customer['lastname']. ', thank you for your order!'. "\n";
224    $email_order .= STORE_NAME . "\n" .

 

Is that what you want ? You can put any 'text' in your email newsletter, and just add either :

 

$order->customer['firstname']

 

OR

 

$order->customer['lastname']

 

to personalise it. Don't forget the ". " to concatenate.

 

Peter

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...