Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Admin Tip: Send Email to Customers who havent purchased yet


ldavies83

Recommended Posts

I have quite a new site (www.starchsupplies.co.uk) and as usual I had a couple of teething problems with the ordering system. Now I had customers details, but no orders. I wanted to send all customers who hadnt ordered yet a 10% off discount voucher via the Admin > Send Email page, but not the ones who have ordered. Solution? Remarkably easy actually, first open your admin/mail.php and just after:

      case '**D':

       $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

       $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;

       break;

insert the following lines:

// NEW EMAIL OPTION - START

case '**F':

  $mail_query = tep_db_query("SELECT " . TABLE_CUSTOMERS . ".customers_firstname, " . TABLE_CUSTOMERS . ".customers_lastname, " . TABLE_CUSTOMERS . ".customers_email_address FROM " . TABLE_CUSTOMERS . " LEFT JOIN " . TABLE_ORDERS . " ON " . TABLE_CUSTOMERS . ".customers_id = " . TABLE_ORDERS . ".customers_id WHERE " . TABLE_ORDERS . ".customers_id Is Null");

  $mail_sent_to = TEXT_CUSTOMERSNOTORDEREDYET;

  break;

// NEW EMAIL OPTION - FINISH

 

Next, further down the file look for:

 

  

if ( ($HTTP_GET_VARS['action'] == 'preview') && ($HTTP_POST_VARS['customers_email_address']) ) {

   switch ($HTTP_POST_VARS['customers_email_address']) {

     case '***':

       $mail_sent_to = TEXT_ALL_CUSTOMERS;

       break;

     case '**D':

       $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;

       break;

 

Insert the following:

 

// NEW EMAIL OPTION - START

case '**F':

  $mail_sent_to = TEXT_CUSTOMERSNOTORDEREDYET;

  break;

// NEW EMAIL OPTION - FINISH

 

Lastly in this file, find:

 

    $customers = array();

   $customers[] = array('id' => '', 'text' => TEXT_SELECT_CUSTOMER);

   $customers[] = array('id' => '***', 'text' => TEXT_ALL_CUSTOMERS);

   $customers[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_CUSTOMERS);

 

and insert after that:

 

// NEW EMAIL OPTION - START

   $customers[] = array('id' => '**F', 'text' => TEXT_CUSTOMERSNOTORDEREDYET);

// NEW EMAIL OPTION - FINISH

 

Right, Next file! goto admin/includes/languages/english/mail.php and add:

// NEW EMAIL OPTION - START

define('TEXT_CUSTOMERSNOTORDEREDYET','To Customers who have not placed an order');

// NEW EMAIL OPTION - FINISH

 

in the text definitions.

 

After you've made these changes, you will have another dropdown menu choice on the Admin > Tools > Send Email page in "Customer" combo

 

This is my first tip contributed, so I would apreciate any pointers on making things easier to read. Grammer was never my forte! :oops:

Contribs Written: Nochex APC Payment Module, Cheque Payment Module

Contribs Updated: Information Pages Unlimited, Latest News V1

You've gotta be Quick on the Draw in this game!

Link to comment
Share on other sites

I forgot to say, my OSC build is MS1 so the code may be slightly different in currect CVS. Further, this is my first bit of custom written PHP code, so if I have screwed up the syntax or conventions for the languages, please let me know and I'm happy to be corrected!

Contribs Written: Nochex APC Payment Module, Cheque Payment Module

Contribs Updated: Information Pages Unlimited, Latest News V1

You've gotta be Quick on the Draw in this game!

Link to comment
Share on other sites

Also, there is a contribution that I wrote that will automate this process, and send the email within 15 after the customer leave the store.

 

http://www.oscommerce.com/community/contributions,860

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Cool, I like that. Sods law always states, if you dont look carefully enough, there is always a contrib out there already doing what you want it to do!!!

Contribs Written: Nochex APC Payment Module, Cheque Payment Module

Contribs Updated: Information Pages Unlimited, Latest News V1

You've gotta be Quick on the Draw in this game!

Link to comment
Share on other sites

Yeah, also, in your SQL, you leave out customers that might have an 'paypal' status of PayPal Processing. Meaning they never actually finished an order. You also include customers that might currently be in the process of odering.

 

Anyway, my contributions takes care of all of that.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

  • 2 weeks later...

Glad you like it, I found with the other contrib, in order to effectively run it, you need a dedicated server for running the jobs, as my web hosting company will not allow me to run scheduled jobs on their server (Which I perfectly understand!). Tweaking the SQL will quite happily allow you to exclude certain status's and user online settings. I have not bothered so far, however if anyone wants some help customising it, I am happy to be of some help. :P

 

Thanks,

 

L.

Contribs Written: Nochex APC Payment Module, Cheque Payment Module

Contribs Updated: Information Pages Unlimited, Latest News V1

You've gotta be Quick on the Draw in this game!

Link to comment
Share on other sites

I'm not certain if you are talking about my feedback request contribution or not, but I can assure you that you do *not* need to have a dedicated server in order to run it. You do need to be allowed to run scheduled jobs, however most hosts have no problem whatsoever with that.

 

Also, it's nice for the customer to receive the email within 15 minuts of leaving your site, as you still might catch them before they purchase elsewhere. The aforementioned contribution does that for you.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

wizardsandwars, the email that is sent to them, is it customizable? Can I put a Coupon Code in it to tell them basically that they can come back and get 10% off or whatever?

 

Also, does this only send the email once - after they sign up for the first time and then leave the site? Or does it send the email everytime they sign in, or visit the site and then leave?

 

Thanks,

Priest

Link to comment
Share on other sites

My contribution only emails people only after they sign up, and they are no longer in the "whoes_online" table anymore, and they have not made a purchase.

 

It only sends them one email, and it is fully customizable through the languages include.

 

I have an update to the contribution that will be uploaded very, very soon, and will include new functionality.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

My contribution only emails people only after they sign up, and they are no longer in the "whoes_online" table anymore, and they have not made a purchase.

 

It only sends them one email, and it is fully customizable through the languages include.

 

I have an update to the contribution that will be uploaded very, very soon, and will include new functionality.

 

This contribution will work in MS2?

 

Thks.

 

Andre'.

Link to comment
Share on other sites

Hmmn, I'm pretty sure it will.

 

Basically, its a 'bolt on' application. It doesn't really touch any of the core file. I does use a couple of the configure.php variables, so I guess I should check in there before I give the 100% MS2 compatible, but Im pretty sure.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Nope.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

  • 1 month later...
I have an update to the contribution that will be uploaded very, very soon, and will include new functionality.

Hi Chris,

 

I was just wondering if you could update us as to the new update. Will is be available anytime soon? Should I just go ahead and install the current version?

 

Thanks,

Priest

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...