ldavies83 Posted July 15, 2003 Share Posted July 15, 2003 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 More sharing options...
ldavies83 Posted July 15, 2003 Author Share Posted July 15, 2003 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 More sharing options...
wizardsandwars Posted July 15, 2003 Share Posted July 15, 2003 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 More sharing options...
ldavies83 Posted July 15, 2003 Author Share Posted July 15, 2003 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 More sharing options...
wizardsandwars Posted July 15, 2003 Share Posted July 15, 2003 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 More sharing options...
ldavies83 Posted July 15, 2003 Author Share Posted July 15, 2003 Cool, Well I'll be downloading that one then!!! Thanks W&W 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 More sharing options...
Stephan Gebbers Posted July 15, 2003 Share Posted July 15, 2003 I like your contribution.. :D I have this new feature now.. Thx! Link to comment Share on other sites More sharing options...
garyidweb Posted July 15, 2003 Share Posted July 15, 2003 Thanks for this tip, the contribution mentioned above is slightly more advanced with cron to set up etc. This is far quicker and easier to install, thanks Link to comment Share on other sites More sharing options...
ldavies83 Posted July 28, 2003 Author Share Posted July 28, 2003 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 More sharing options...
wizardsandwars Posted July 28, 2003 Share Posted July 28, 2003 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 More sharing options...
Priest Posted July 29, 2003 Share Posted July 29, 2003 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 More sharing options...
wizardsandwars Posted July 29, 2003 Share Posted July 29, 2003 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 More sharing options...
Priest Posted July 29, 2003 Share Posted July 29, 2003 Thanks! It really does sound GREAT. ~P~ Link to comment Share on other sites More sharing options...
lopes_andre Posted July 30, 2003 Share Posted July 30, 2003 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 More sharing options...
wizardsandwars Posted July 30, 2003 Share Posted July 30, 2003 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 More sharing options...
Priest Posted August 1, 2003 Share Posted August 1, 2003 I have an update to the contribution that will be uploaded very, very soon, and will include new functionality. Done yet? ~P~ Link to comment Share on other sites More sharing options...
wizardsandwars Posted August 1, 2003 Share Posted August 1, 2003 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 More sharing options...
Guest Posted September 1, 2003 Share Posted September 1, 2003 thanks for this great added feature... i have just implemented it! Link to comment Share on other sites More sharing options...
azer Posted September 7, 2003 Share Posted September 7, 2003 did someone has succeded making the contribution or the tips on a ms1 version ! MS2 Link to comment Share on other sites More sharing options...
Priest Posted September 7, 2003 Share Posted September 7, 2003 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.