Radical Hacks : StepCast Wishlist for WebStore sent in the following hack... Hi,

I know that I've seen a hack to place the customers email address as the sender of an email Web Store order but I can not find one now. So I dug in and did it myself. I've included two attachments to this message. One is a plain text version of the hack instructions. The other is a HTML version. I don't have a clue as to which you prefer, I've seen both in your hack pages.

Many thanks for the fine shopping cart,

Dale Harper


Source and Instructions:

Use customers email address as return address of email order

The first step is to find this section in web_store_order_lib.pl

$required_fields_filled_in = "yes";
foreach $required_field (@sc_order_form_required_fields) {

    if ($form_data{$required_field} eq "") {
    $required_fields_filled_in = "no";
     print "<H2>You forgot to fill in " .
       $sc_order_form_array{$required_field} . ".</H2>\n";
   }
} # End of checking required fields
and place the following code below it. (code above checks for required fields) The new code will place customer's email address into $custmail var. Email var has to be exactly as it is listed in @sc_order_form_required_fields in your setup file. Mine, listed below, is 09-e-mail. Of course this will only work if the customers email address is a required field.
     $custmail = $form_data{'09-e-mail'};

Next, find the following section in the same file, web_store_order_lib.pl

   if ($sc_send_order_to_email =~ /yes/i) {
     &send_mail($sc_order_email,$sc_order_email, 
     "Web Store Order", $text_of_cart);

and replace it with the following

   if ($sc_send_order_to_email =~ /yes/i) {
     &send_mail($custmail,$sc_order_email,    #New Code, customers email addr as sender
     "Online Parts Order", $text_of_cart);    #New Code, changed "Web Store Order" to "Online Parts Order"

You can change Online Parts Order to whatever you like. This will be the subject of the email order

That's it for web_store_order_lib.pl.

In mail-lib.pl find the real_send_mail routine and replace

     print MAIL qq!To: $touser

From: $fromuser

Subject: $subject

$messagebody

!;

with the following code

print MAIL "To: $touser\n";
print MAIL "From: $fromuser\n";
print MAIL "Subject: $subject\n";
print MAIL "$messagebody\n";

That's it, I don't know enough about sendmail to know why it want's the "\n", return, at the end of each line but this did not work until I put them there. Hopefully your orders will be many and will come in with a nice subject and return email address.