+ Reply to Thread
Results 1 to 6 of 6

Thread: Quick Email Regarding Status Update (Similar To Shipping)

  1. #1
    Client
    Join Date
    Mar 2006
    Location
    Ontario, Canada
    Posts
    282
    Squirrelcart version
    v3.4.0

    Quick Email Regarding Status Update (Similar To Shipping)

    Jamie,

    I remember when I purchased a Dell (a few years ago) on line, it sent an email everytime the status of the order changed. This is a simple email similar to the "Shipping Status" email that you have now configured.

    Is it possible that you could write some code that sends an email every time the status changes - based on that status...

    We use "Assembling Order" etc. Sometimes I think our customers feel we're not doing enough between the time they place the order and the time it is shipped. I'd like to be able to keep in touch with them "automatically" to see the process of their order.

    I am aware (and we make them aware) that if they log into their account, they can follow the process with status updates - since those updates currently appear when a user log in to their account. Just thought it a nice touch to send a quick simple email advising of the update...

    I noticed Canada Post sents a similar quick email.

    I hope you can code, since you do already have the code for the shipped status...

    John

  2. #2
    Client coastalrugs's Avatar
    Join Date
    Dec 2007
    Posts
    171
    Squirrelcart version
    v3.2.0
    I like this idea, and would like to propose a slight extension to it:

    Make the option to update status an option on the actual status choice, not holistically. Namely, instead of the user being notified of every change of status, only important status updates warrant notification.

    An order might go through:
    - payment received
    - in processing department
    - assembling item - tagged to send customer email
    - at warehouse
    - shipped - send customer email with tracking info

    So each 'step', as configured in the 'Order Status Options' control panel, each step can be set to send a notification or not. I can see this being pretty convenient for particular options like: On Hold and Canceled, status items with some halt to the normal flow of order progression.

  3. #3
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    Something like this will be coming eventually. For the time being, you could add it custom by modifying the squirrelcart/functions/control_panel/add_record_cb.func.php function which gets called after adding a record to any table.

    The section starting at line #49 already gets executed when an order status is added:
    PHP Code:
        // if order status being added
        
    if ($table == 'REL_Orders__Order_Status' && !empty($data['Orders_rn'])) {
            
            
    // restock items IF Inventory Control is ON and its set to restock when this status is assigned
            
    if ($SC['settings']['Use_Inventory_Control'] && in_array("status:$data[Order_Status_rn]",$SC['settings']['Restock_On'])) restock($data['Orders_rn']);

            
    // send shipment notification if status being set to "Shipped"
            
    if ($data['Order_Status_rn'] == 2) {
                
    // the email_ship_notify() function expects the first parameter to be an array matching the record in the Shipments table
                // There is no matching record in this case, so setup a similar array to satisfy the function
                
    $shipment = array(
                    
    'Shipped_On'    => $data['Record_Date'],
                    
    'Order_Number'    => get_field_val('Orders','Order_Number',"record_number = '$data[Orders_rn]'")
                );
                
                
    // send shipment notification
                
    if ($SC['settings']['Email_Ship']) email_ship_notify($shipment);
            }
            
        } 
    To send an email to a customer, you would need to call the sc_email() function inside that section:
    PHP Code:
    <?php sc_email('bob@example.com','Email subject','Email content'); ?>
    You would need to query the database for some basic order info so you can get the customer's email address, and the name of the status being added.

    There is a little more to it than that, but not much.

  4. #4
    Client
    Join Date
    Mar 2006
    Location
    Ontario, Canada
    Posts
    282
    Squirrelcart version
    v3.4.0
    Thanks Jamie,

    That's a bit over my head so I'll wait. Looking forward to this from you some day!

    John

  5. #5
    Client
    Join Date
    Mar 2006
    Location
    Ontario, Canada
    Posts
    282
    Squirrelcart version
    v3.4.0

    $$$

    Jamie,

    Can you email me so that we can discuss a custom price to get this working...

    John

  6. #6
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    Sure, email on its way.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts