Anton_FA Posted March 14, 2003 Share Posted March 14, 2003 Greetings can i get some help on sending an email from the checkout_succes.php page. I've made some changes to the manufacturers page in the admin section. Now the admin can add an email to the manufactures_info table in the database. I would like to have the checkout_success.php send an email to the manufactures of the products which have just been purchased, and list which products, with the quantity, of the products purchased. Can someone please please please help me with this. :?: thanks Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 14, 2003 Share Posted March 14, 2003 Remind me after Friday and I will dig up my code for the loop process of an order to do this. I do not have the email being sent, but I have the info being broken up by manufacturer in the loops and you just need to modify it to make it an email rather than a page display. Just have to figure out where I put the code ... :shock: Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 16, 2003 Author Share Posted March 16, 2003 Hi Linda Just a reminder re the loops Also, I have no idea how to make it send an email - can you advise me of how to do this? thanks heaps! Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 19, 2003 Author Share Posted March 19, 2003 Hi Linda Dont mean to badger you - just a friendly reminder re the loops. thanks Anton Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 19, 2003 Share Posted March 19, 2003 http://www.oscommerce.com/community/contributions,1087 Manufacturers Email per order v0.5 This is just a series of loops to process an order to send an email to all manufacturers of what was ordered. It is a test file, more or less. Read the file, change the order number inside to see it process on screen what should be emailed. Later, it will actually process emails. Quote Link to comment Share on other sites More sharing options...
jgkiefer Posted March 19, 2003 Share Posted March 19, 2003 Manufacturers Email per order v0.5 Great! Looks like this will be just the ticket for those of us using drop shippers. Maybe you could add the ability to specify a different "from" email address. That way when/if the email is responded to it can be sperated from the general emails. just a thought. Looking forward to the completion of this one! Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 20, 2003 Author Share Posted March 20, 2003 thanks Ajeh! You've done an awesome job on this! I've got a few questions for you: 1) do you recommend that this code is inserted into another page like checkout_success.php? 2)in the DB- manufacturers_send_email is set by defualt to 0. Can you tell me what this is for and where it gets set to 1? Apologies if these seem like very simple questions to you. Thanks again for the code. Anton Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 20, 2003 Share Posted March 20, 2003 What I plan to do with it is make an option that this can be done: 1 Automatic process in checkout_process.php 2 Batch New Orders in Admin 3 Individual Order Process in Admin The email From would be a seperate email address so manufacturers have a specific address to email. The way I wrote the loops, the manufucture needed two things. 1 an email address and 2 marked to receive an email with each order. Right now, the loop is made to process 1 order, which is manually changed just to show what information goes to which manufacture. Changing all that output from the screen to individual emails should not be a major ordeal. If you were to set up a dozen test manufacturer emails that you can get on orders, you can actually test this out with orders to see how this works and make sure you have the emails sending only order info to the right manufacture. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 20, 2003 Author Share Posted March 20, 2003 HI Ajeh once again i have another question, which I feel might be really simple for you, but it has me rather confused. For my needs I will need emails sent to maufacturers automatically upon an order being placed, so I realise the code you wrote will need to go in, or be an included file with the order_process.php file. Should I use your file as an include file with order_process.php? With the variable $current_order - how does this, or what do I need to do, to make this automatically pick up the current order without having to manually enter a number? Thanks again for you help, I have learnt a great deal while working on this project, though my knowledge is so limited compared to yours - so I am so very appreciative of your patience and knowledge. Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 21, 2003 Share Posted March 21, 2003 The file I wrote is just a processing sample of what has to be done to an order to send an email to each manufactur of the products. It gathers all the products for each manufacture in the order 1 to however many there are. Then, it does a screen display of what should be put in the email, product name, quantity, model number etc. It does this based on manufacturer_id and checks if there is an email address for the manufacture and if the manufacture is marked to receive an email. This file is just to give you the ground work for automating the process. You can use it to build the full email, and then add that to the checkout_process.php to automate it with each order, or add it to the Admin orders.php for processing orders manually or make a batch processing function on new orders. I just wrote this to provide the ground work needed. I have not completed a full processes automated email system or the Admin side yet. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 23, 2003 Author Share Posted March 23, 2003 HI Ajeh I'm still confused about the variable $current_order. I believe that in your code this is to be entered manually, but which data, from the database, would this use? Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 23, 2003 Author Share Posted March 23, 2003 I'm getting an error when running the page - is anyone else? This is what I get: Fatal error: Failed opening required 'includes/classes/logger.php' (include_path='.;c:php4pear') in C:groundzerostoreadminincludesapplication_top.php on line 160 I'm also interested to hear how other people are going with this? Quote Link to comment Share on other sites More sharing options...
jgkiefer Posted March 24, 2003 Share Posted March 24, 2003 I have been watching this thread because I am very interested in the development of the sending dynamic email mod. As I understand it is still under development and not yet ready for prime time though. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 24, 2003 Author Share Posted March 24, 2003 Changing all that output from the screen to individual emails should not be a major ordeal. Asuming you know something about PHP, which, although i'm learning, I know very little. I apologise for asking what are probably stupid questions. Like I say, I am learning but my level of knowledge is so far below that of Ajeh's and the other developers (much respect to you!) I feeling rather frastrated with my inability to get this figured out! I've been trying to get this sorted for months. There has been some awesome help, especially from Ajeh. A big part of my problem is that OSC is quite complex, from a newbie developers point of view ( very straight forward for a user though). I'm sure it is easy to get Ajeh's script to send emails to the manufactures, probably using existing functions in OSC but I really have know Idea. Are there existing functions in OSC to send a basic, plain text email? Can someone explain how I get the current order to be applied to Ajehs mod? I really dont mind if people reply with help written for an idiot- because I do feel like on at the moment - by hay, you gotta start somewhere. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 24, 2003 Author Share Posted March 24, 2003 wait, wait....I think i'm getting it - the email part that is. But I cant test it because I cant get Ajeh's code to process any orders. the problem is I'm not sure how the $current_order works. I've tried putting in Orders_id and orders_products into $current_order but it still doesnt process anything. If someon can help me with this, I think I might be able to get the emailing bit work on my own Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 25, 2003 Share Posted March 25, 2003 $current_order is nothing more than the orders_id I was testing the code with. I set it in the code to 64 as that was an order I made with multiple products and multiple manufacturers with test email addresses. If you take the code I posted and change $current_order to one of your real orders that has products with manufacturers with email addresses you will see the results. To test this, I had setup all the manufacturer email addresses to 10 of my own email addresses. This way it would process and when I got to the point of testing the actual emails, I would receive the emails for confirmation that it worked. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 25, 2003 Author Share Posted March 25, 2003 OK! great! alright - things are starting to happen now... This is what i'm using to send the email: mail($the_email,"Manufacturers email" , $manufacturers_email_products_attributes['products_options_values']); I'm adding this it the end of your code. Its picking up the manufacturers email but not the rest. Any idea what i'm doing wrong? Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 26, 2003 Share Posted March 26, 2003 The output of each part needs to be added together to make the body of the email. Where you see each of the echo statements that is a part of the email. This should be built into a variable to include in the email with appropriate line breaks between the detail. I have not had time to work with this beyond building the loops to make the output to screen, but you should be able to add all of the information to a variable for the body of the email per manufacture. It takes the whole order, sorted by manufacture. Then, it lists the product detail on quantity, model, name, price, attributes, etc. You are going to have to play with it a bit to get it to look the way you want it to. When I get some time this week I will look at it further to get an actual email composition out of it. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 30, 2003 Author Share Posted March 30, 2003 I'm getting a strange error msg when I try to send the email: this is my code: mail($the_email,"Freedom Air airport order" ,echo '<br>' . ' ' . $manufacturers_email_products_attributes['products_options_values']; and this is the error msg I get: Parse error: parse error, unexpected T_ECHO in C:groundzerostorecatalogmanufactures_email.php on line 63 can anyone see where I'm going wrong? Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 30, 2003 Share Posted March 30, 2003 You cannot just echo in the middle of that function. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted March 30, 2003 Author Share Posted March 30, 2003 thanks Ajeh I can now get the email to send to the correct email address but just cant seem to get the variable to send too. heres my code: mail($the_email,"Freedom Air airport order", $manufacturers_email_products_attributes['products_options_values']); Quote Link to comment Share on other sites More sharing options...
Ajeh Posted March 30, 2003 Share Posted March 30, 2003 When I get some time I will try to look at it further but from what I can see is you may be building the email stuff somewhere, but what does $manufacturers_email_products_attributes['products_options_values'] contain just before the email goes out? Comment that line out and just echo the 3 values to the screen to check. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted April 6, 2003 Author Share Posted April 6, 2003 for the Developers who have been following this thread I have found the problem (not the solution) to the sending of the emails . mail($the_email,"Put the subject here.", ' Qty: ' . $manufacturers_email_products['products_quantity']); I have the above code at the end of Ajeh's code. It seems that php runs right through the code and sends the email but it is sending the email before it has the information from Ajeh's process. Does anyone know how to make the mail wait until it has the values and then send? hope this makes sense. Quote Link to comment Share on other sites More sharing options...
Ajeh Posted April 7, 2003 Share Posted April 7, 2003 Think as the loops as nothing more than building a long sentence. Every time you see the word echo in the original code, that needs to be added to a variable for what gets sent out as the body of the email. Quote Link to comment Share on other sites More sharing options...
Anton_FA Posted April 7, 2003 Author Share Posted April 7, 2003 Hi Ajeh I understand what you are saying - it seems though that the the email is sent before the 'long sentence' can be added to it. I believe this is so because I'm recieving the email (so it is adding my address from the database) And in the body it says " Qty: " and thats all. The code that I use to get the email address is very similar to what is used to get the body content. so it seems, though it may not be, that the script is sending the email before it has finished the processing the loop. is this possible do you know? Quote 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.
Note: Your post will require moderator approval before it will be visible.