Hi all:
  I’ve made a bit of a change to the way people are emailed after they have submitted an order.

  I found that I needed to send an email based on what they purchased.  If they purchased a registration number, the email should contain the registration number immediately.  Here is what I did:

 

In SUBMIT_ORDER, I added the following lines:

 

//get a list of all the SKU's in the basket

                                    $Query = "SELECT SKU, Item from invoice_sku, sku WHERE Invoice = ".$UserInfo['Invoice']." AND sku.ID = SKU";

                                    $DatabaseResult = mysql_query($Query, $DatabaseLink);

                                    while ($Row = mysql_fetch_array($DatabaseResult))

                                    {

                                                $SKU = $Row["SKU"];

                                                $Item = $Row["Item"];

                                                if (file_exists(APPLICATION_ROOT."/modules/email/sku/".$SKU))

                                                {

                                                            $fp = fopen(APPLICATION_ROOT."/modules/email/sku/".$SKU, "r");

                                                            $FileContents = fread($fp, filesize(APPLICATION_ROOT."/modules/email/sku/".$SKU));

                                                            $mail_body .= "\n------------------------------------------------------\n";

                                                            $mail_body .= $FileContents;

                                                            $mail_body .= "\n------------------------------------------------------\n";

                                                }

                                                else if (file_exists(APPLICATION_ROOT."/modules/email/items/".$Item))

                                                {

                                                            $fp = fopen(APPLICATION_ROOT."/modules/email/items/".$Item, "r");

                                                            $FileContents = fread($fp, filesize(APPLICATION_ROOT."/modules/email/items/".$Item));

                                                            $mail_body .= "\n------------------------------------------------------\n";

                                                            $mail_body .= $FileContents;

                                                            $mail_body .= "\n------------------------------------------------------\n";

                                                }

                                    }

This goes through all the SKU’s in the basket, and then adds items to the email being sent to the user.

I made two extra directories under modules.  First, I made a directory called email, and under that two subdirectories named sku and items  If you want to send an email based on a SKU, just add a file with the name being the SKU id to match.  (ie for an email regarding SKU 12, add a file called “12” under email/sku  You can do the same thing for items, but put the  email under items.

Hope this helps some people.  I’m also adding this to the FAQ.

Mike

 

Mike Potter

Owner, InTheHack.com - CCA Internet Webmaster

http://www.inthehack.com - http://www.curling.ca

[EMAIL PROTECTED]

ICQ: 22322292

 

Reply via email to