azer Posted December 25, 2005 Share Posted December 25, 2005 well here is some example of the text is not hard coded auto_emailer_customers.php : <tr class="smallText"> <td width="10%">Customer: </td><td width="30%" align="left"><?php echo tep_draw_checkbox_field('customer', '', $switch['customer'], ''); ?> </td> </tr> <tr class="smallText"> <td width="10%">Member Since: </td><td width="30%" align="left"><?php echo tep_draw_checkbox_field('member_since', '', $switch['member_since'], ''); ?> </td> </tr> <tr class="smallText"> <td width="10%">Last Logon: </td><td width="30%" align="left"><?php echo tep_draw_checkbox_field('last_logon', '', $switch['last_logon'], ''); ?> </td> </tr> <tr class="smallText"> <td width="10%">Number of Logons: </td><td width="30%" align="left"><?php echo tep_draw_checkbox_field('number_logons', '', $switch['number_logons'], ''); ?> </td> </tr> auto_emailer_orders.php : <td width="10%">Order ID: </td><td width="30%" align="left"><?php echo tep_draw_checkbox_field('order', '', $switch['order'], ''); ?> </td> Quote MS2 Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 25, 2005 Author Share Posted December 25, 2005 Yep, just what a said. A handlful of words. But you are correct, they probably should be automatic. I will add that to the list. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
culturebee Posted December 30, 2005 Share Posted December 30, 2005 I've uploaded a new version. I Jack Thank's Jack, this is a PLUS! I only have to study this great mod and how to set up a cron job. my host did it the first time, I don't know what they did, how to read it or where it is installed or anything. NEED TO LEARN CRON I,m hosting with I powerweb I try there control panel setup but was not must options. I installed a few contribritions that needs a cron job Please Help Thanks :thumbsup: Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 30, 2005 Author Share Posted December 30, 2005 Did you read the instructions in the readme? There is not much involved in setting up cron. You need to enter the command. I have included a sample but it is not the same on all hosts since it needs your path. Once you do that, you just enter the time values for when you want the script to run. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
culturebee Posted December 30, 2005 Share Posted December 30, 2005 Did you read the instructions in the readme? There is not much involved in setting up cron. You need to enter the command. I have included a sample but it is not the same on all hosts since it needs your path. Once you do that, you just enter the time values for when you want the script to run. Jack How do I enter the time say every friday at 6 am and where to exactly place this file my root reads /home/public_html/index.php Thanks Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 30, 2005 Author Share Posted December 30, 2005 As mentioned in the readme, there should also be settings for Minute, Hour, Day, Month, Weekday. Set the Time to 06:00, the Day to 6 aand the rest to *. You place the files into the admin directory as mentioned in the readme. Change your path to include the admin directory and file name as shown in the readme. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
culturebee Posted December 30, 2005 Share Posted December 30, 2005 As mentioned in the readme, there should also be settings for Minute, Hour, Day, Month, Weekday. Set the Time to 06:00, the Day to 6 aand the rest to *. You place the files into the admin directory as mentioned in the readme. Change your path to include the admin directory and file name as shown in the readme. Jack I,ll have to go over the readme and study the cron and how it all works together Thanks Jack ;) Quote Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 3, 2006 Share Posted January 3, 2006 Jack, well done, good contribution as usual. My guess is that files in auto_emailer folder need to be CHMOD to 777 otherwise it's impossiple to update - if I'm right, you should perhaps include it in install instructions. This code needs to be in /admin/includes/boxes/auto_emailer.php '<a href="' . tep_href_link(FILENAME_AUTO_EMAILER_NEWPRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_AUTO_EMAILER_NEWPRODUCTS . '</a><br>' . Also these two defines should be added to admin/includes/languages/english.php before the closing ?>: define('HEADING_TITLE_AUTO_EMAILER_NEWPRODUCTS', 'New Products'); define('TEXT_AUTO_EMAILER_NEWPRODUCTS', 'Send notifications about new products.'); I have one questin - in announce section - Number of Days - if I type 1 and hit update, the number 1 is there, however if I leave the page and come back it is empty - any idea? Thank you, Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 4, 2006 Author Share Posted January 4, 2006 Thanks for the bug fixes Alex. I will fix those in the next version. As for the last problem, it appears I somehow deleted the code that handles that. It is there in the previous version but not in this last one. To fix it, find this line of code in admin/auto_announce.php if ($diff >= 0 && $diff < 18)and replace it with // Start Date Difference if ($diff >= 0 && $diff < 18) // Stop Date Difference I think that should fix it. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 4, 2006 Share Posted January 4, 2006 Jack, thanks that seems to do the trick (it is actually admin/auto_emailer/auto_announce.php). However I have a problem with the cron - or with the script itself. When I use php -q /home/USER_NAME/public_html/admin/auto_emailer/auto_emailer.php and replace USER_NAME with my database user name, I receive this email from cron: No input file specified. Same message when I replace USER_NAME with my control panel user name. When I change the path to: php -q /home/httpd/vhosts/mywebsite.com/httpdocs/admin/auto_emailer/auto_emailer.php nothing happens, however all of my crons use the absolute path. I tried to call admin/auto_emailer/auto_emailer.php in my browser but it didn't work. Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 4, 2006 Author Share Posted January 4, 2006 If you go to admin->Auto Emailer->Settings, is there at least one box checked? I take it, from your statement, that you have other cron jobs that work? If you delete the auto_emailer.php file (or just rename it), then cron should send you an error message. Do you receive that? Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 4, 2006 Share Posted January 4, 2006 In settings, all boxes are checked. I have few cron jobs that work just fine. When I use this path php -q /home/CP_USER_NAME/public_html/admin/auto_emailer/auto_emailer.php and rename the admin/auto_emailer/auto_emailer.php, I get this message: No input file specified. Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 4, 2006 Author Share Posted January 4, 2006 What happens when you try to run the script from your browser - http://yoursite.com/admin/auto_emailer/auto_emailer.php? It should execture the script and send you the emails. There won't be any output in the browser though. Did you change the email addresses in the scripts? Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 4, 2006 Share Posted January 4, 2006 It kept loading via browser so I did the following changes: // include('../includes/configure.php'); - commented out // Define the database details define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'user'); define('DB_SERVER_PASSWORD', 'password'); define('DB_DATABASE', 'database'); With the above changes, the script is executed (via browser only!) however no email is received. I have checked announce box only in settings. I have also double checked the email setting: //Set some common items $Sender = '[email protected]'; $Recipiant = '[email protected]'; $Cc = ''; $Bcc = ''; $currentDate = date('Y-m-d'); //or enter a date in the form of yyyy-mm-dd Such a great contribution, I've no idea what could be wrong... :( Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 5, 2006 Author Share Posted January 5, 2006 Did you upload all of the files for the email class? I'm sure you did but thought I should ask. If you place an echo statement in one of the files, the output of that statemetn should be sent to you as a separate email. You could try that. echo 'test emial'."\n"; If you are still not getting any emails, then it would have to be somthing related to cron. I suggest asking your host to be sure cron is running properly. They can also test the script to make sure if it is running without errors. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 5, 2006 Share Posted January 5, 2006 Jack, Slowly it is beginning to work... I'll list all changes later. I have the following problems now: 1/ I have finally received the message with subject Happy Birthday jesus only because there is a real customer named Jesus in database having birthday today. If there was nobody with the birthday, I would not receive test message. 2/ if I select Customers & Announce in settings and call the script from my browser, I receive the birthday message for Jesus (she's having birthday) and I can see that customers.csv is being written in auto_emailer folder. However one hour later the file contains only 20 records and browser is still working / loading - the script is not executed yet. We only have about 3000 customers in shop. 3/ if I select Customers & New Products and set the date in New Products to 1st November 2005, I received about 1800 emails (one for each customer) with the list of products - and because we use four languages in our shop, each product description is repeated 4 times in the message body - which could be considered as spam by many. Is there a way to a/ receive 1 email only for testing purposes? b/ use 1 description from 1 language only? c/ use title and shorter description (cca 150-200)? Something that would look like: Product title Description, bla, blah, blah... click here for more - this could be the link to a product Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 5, 2006 Author Share Posted January 5, 2006 1 - That's correct. No emails will be sent if no one has a birthday. 2 - I don't know what this might be. It shouldn't take that long. I suppose it may be timing out due to a limit on how long a script can run on yur server. If you can create a test site and only run with a few customers, that might help find the problem. 3 - To only send one email, in the auto_emailer/auto_newproducts.php file, after $tmessage->Send(); add breakl Yes. The product link is already planned for the next release. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 5, 2006 Share Posted January 5, 2006 After inserting breakl I received no emails at all. When I select Orders and Announce in settings, no email for orders is received when I call the script from my browser, I receive Happy Birthday email only. I have inserted echo 'test emial'."\n"; in auto_orders.php but still, received no message. New Products - is there any chance of including description in one language only? Just for verification, when I'm done with testing, do I keep the recepiant's email address in auto_emailer.php empty as follows? Or both empty? //Set some common items $Sender = '[email protected]'; $Recipiant = ''; Thanks for your time. Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 5, 2006 Author Share Posted January 5, 2006 Oops, that should be break; not breakl. For the orders problem, be sure to insert the echo statement somewhere outside of any conditions code. For example, find this line: $total = 0; and place teh echo statement after it. If that doesn't work, create a test file containing the following: <?php echo 'test'."\r\n"; ?> Name it whatever you want and create a cron job for it. If you don't receive an eamil, then you have some other problem not related to AutoEmailer and you will need to fix that first. For the language problem, find this line in auto_newproducts.php $new_products_query = mysql_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_id, pd.products_name, pd.products_description, p.products_date_added, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join products_description pd on p.products_id = pd.products_id left join specials s on p.products_id = s.products_id where products_status = '1' and p.products_date_added >= ' . $date_added . ' order by p.products_date_added desc"); and change it to $new_products_query = mysql_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_id, pd.products_name, pd.products_description, p.products_date_added, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join products_description pd on p.products_id = pd.products_id left join specials s on p.products_id = s.products_id where products_status = '1' and p.products_date_added >= ' . $date_added . ' and language_id = ' . 1 . ' order by p.products_date_added desc"); I haven't tested this but it should work. Change the 1 to whatever language you want. That recepiate is a global one meant for all modules. It is overridden in the modules that send out emails to customers. In modules like auto_orders.php, it is used snce the email is only going to you. So it should be set to your email address (or wherever you want). Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 6, 2006 Share Posted January 6, 2006 OK, I created test.php with the following: <?php echo 'test'."\r\n"; ?> When I call it from browser, it displays test on the screen. I created cron job for it and received email from cron with "test" in the message body. Therefore cron job is fine and only this path is working for me (I use plesk): php -q /home/httpd/vhosts/mysite.com/httpdocs/admin/auto_emailer/auto_emailer.php However when I insert echo 'test emial'."\n"; in auto_orders.php after $total = 0; it does nothing nor I receive any email with orders. When I insert break; after $tmessage->Send(); in auto_emailer/auto_newproducts.php, I receive no email. When I delete it, I receive one for each customer, which is annoying, even if I set the date in New Products to yesterday, I still receive hundreds of emails. After inserting language_id = ' . 1 . ' in mysql_query produced no products nor descriptions in email. I have tried to change it to pd.language_id = ' . 1 . ' and p.language_id = ' . 1 . ' and pd.language_id = '" . (int)$languages_id . "' but nothing works. All I receive is the following message: Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <html> <head> <title>New products</title> </head> <body> <p>Hello Justin,<br><br> <!-- start message //--> We are just letting you know of the great new products that recently arrived. Just look at some of the <strong>great items</strong> we now offer: <!-- stop message //--> <br><br> <br> </p> </body> </html> Note that the above message is not html formated. I receive it exactly as it looks. I have also received the following message from cron, I think it might be related to auto_orders.php PHP Parse error: parse error, unexpected ',' in /home/httpd/vhosts/mysite.com/httpdocs/admin/auto_emailer/auto_orders.php on line 28 I am aware Jack that this is time consuming for you, I'm just trying to help making this good contribution better, if it doesn't work for me, I'm sure it will not work for many others. I'll be therefore more than happy to help debugging it. Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 7, 2006 Author Share Posted January 7, 2006 Ahh, you have an error in the script. You need to find out what that is before you can do anything else. What's on line 28 of your auto_orders file? If you have a file that is working with cron, test.php, try changing the cron job back to calling auto_emailer.php and in that script, have only one includes statement and make that includes for the text.php file. Do you still get the test message? If so, then the auto_emailer.php file is fine and it is on one of the other files. If not, then something is failing in that script. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 7, 2006 Share Posted January 7, 2006 auto_emailer.php with include('test.php'); works fine, message received. auto_emailer.php with include('auto_orders.php'); produced the following error: PHP Parse error: parse error, unexpected ',' in /home/httpd/vhosts/mysite.com/httpdocs/admin/auto_emailer/auto_orders.php on line 28 this is line 28 of auto_orders.php // Start csv header $_csv_data='.','.'Order Status'.','.'Customer'.','.'Quantity'.','.'Product'.','.'Price' ."\n"; It doesn't look right to me... that line is being changed when selecting boxes in admin/auto_emailer_orders.php. When I used clean file from install package, I received no more erros, however if I call the script from my browser, it keeps loading, orders.csv is being written in a folder on the server, but it only contains headers of columns... same problem as I have with customers. It should take few seconds to execute that script, but it's taking ages and it's never finished. Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 7, 2006 Author Share Posted January 7, 2006 Well, that is progress at least. So the auto_emailer.php file is fine and cron is working correctly. I would elimiate as much as I could from the auto_orders.php file to try to find the problem. For example, remove all references to csv code. If it works after that, then that is where the problem is at. If not, remove some other parts. Here is a cut down version. There is not much left and it won't do anything but send you one email but that might indicate something. <?php /* $Id$ AutoEmailer by Jack_mcs at www.oscommerce-solution.com osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ $message = ' <html> <head> <title>Orders Report</title> </head> <body> <p><table width="100%" border="1"> <tr> <!-- Start Header //--> <th width="15%">Customer</th><th width="15%">Quantity</th><th width="15%">Product</th><th width="15%">Price</th><th width="15%">Weight</th> <!-- Stop Header //--> </tr>'; $Subject = 'Orders Report for ' . $currentDate; $tmessage = new Email($Recipiant, $Sender, $Subject, $CustomHeaders); $tmessage->Cc = $Cc; $tmessage->Bcc = $Bcc; // Start Order Status $ordersStatus = 'Processing'; // Stop Order Status $total = 0; $customers_query = mysql_query("select customers_id from customers") or die(mysql_error()); $message .= '</tr> <tr> <!-- Start Totals //--> <td>Total </td> <!-- Stop Totals //--> </p> </body> </html> '; $tmessage->SetHtmlContent($message); $pathToServerFile = $_file; $serverFileMimeType = 'application/excel'; $tmessage->SetFileContent($pathToServerFile, $serverFileMimeType); $tmessage->Send(); fclose( $_fp ); ?> Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mr_absinthe Posted January 8, 2006 Share Posted January 8, 2006 Jack, I tested it with the above file and it works fine, a message with subject "Orders Report for 2006-01-08" was received. This is the body: Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <html> <head> <title>Orders Report</title> </head> <body> <p><table width="100%" border="1"> <tr> <!-- Start Header //--> <th width="15%">Customer</th><th width="15%">Quantity</th><th width="15%">Product</th><th width="15%">Price</th><th width="15%">Weight</th> <!-- Stop Header //--> </tr></tr> <tr> <!-- Start Totals //--> <td>Total </td> <!-- Stop Totals //--> </p> </body> </html> Alex Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 8, 2006 Author Share Posted January 8, 2006 When you say that is the body, do you mean that is the what the email looks like that you received? If so, that is not correct. The html shouldn't be printed out like that. Of course, I didn't test it so maybe I made a mistake on the file I pointed. You will need to play with it. Cut it down to just a few lines. Maybe this one <?php/* $Id$ AutoEmailer by Jack_mcs at www.oscommerce-solution.com osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ $message = ' <html> <head> <title>Orders Report</title> </head> <body> <p><table width="100%" border="1"><tr><td>Hello</td></tr></table> </body> </html> '; $Subject = 'Orders Report for ' . $currentDate; $tmessage = new Email($Recipiant, $Sender, $Subject, $CustomHeaders); $tmessage->Cc = $Cc; $tmessage->Bcc = $Bcc; $tmessage->SetHtmlContent($message); $serverFileMimeType = 'application/excel'; $tmessage->SetFileContent($pathToServerFile, $serverFileMimeType); $tmessage->Send(); ?> Once you get a working html message, start building it back up. It sounds like it will work for you but there is something that still not quite right. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.