eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
cool hacks
Order Number and Email enhancements for WebStore  

sent in this nice hack...

Update! November 2, 2001!

This is the old hack. Please find the new code here.

Hacks to email the customer and insert an order number!

######this inserts an order number into the text of the cart

#### these lines
  $grand_total = &display_price($grand_total);
  print "Grand Total: $grand_total<P>";
  $text_of_cart .= &format_text_field("Grand Total:") .
   "= $grand_total\n\n";
########insert this
##############m gray edition#######

  $text_of_cart .= "Order Number is '$cart_id' \n\n";

###################################end

This sends email to the customer

after these lines

                #
                # If we are sending the order through
                # email, then we use the mail-lib.pl
                # send_mail routine.
                #
  if ($sc_send_order_to_email =~ /yes/i) {
     &send_mail($sc_order_email,$sc_order_email,"FlynFish Order number '$cart_id'", $text_of_cart);

#################insert this


################micks edition###########################
#########  The $form_data[-9] refers to the array from the order form
#########  the -9 refers to the ninth from last element of the order form
#########  (which in this case is the customers email address)
#########  you will need to count backwards the number of <INPUTs on the order form from the end
#########  to the email address of the customer
#########  There must be a much more elegant way of doing this
########send an email to the customer too #############

    $customer_email_field = "$form_data[-9]";
    @customer_email_array = split(/=/,$customer_email_field);
    $customer_email_address = "$customer_email_array[1]";

    $text_of_customer_email = "Thank you for your order at ..........";
    $text_of_customer_email .= "\n";
    $text_of_customer_email .= "Your Order Number is '$cart_id'.";
    $text_of_customer_email .= "\n";
    $text_of_customer_email .= "Please quote this in any correspondence you may have with us regarding your order.";
    $text_of_customer_email .= "\n";
    $text_of_customer_email .= "\n";
    $text_of_customer_email .= "Thank you again for shopping at ...............";#

     &send_mail($sc_order_email,  $customer_email_address, "Your Order", $text_of_customer_email);#

########################################################