Page 1 of 1

Admin product confirm email issue

Posted: Tue May 15, 2012 6:58 pm
by Druid_McGrew
Hi. I have an opencart shop. It works great. However I'd like to add something to one of the files but I dont know where it is.

When a member places an order an email is sent to the admin account with the order number, product id etc. I would like to know where the config for this file is so I can add The username, email and a few other details of the person that placed the order so I can email them straight back from my phone.

Please can anybody help? I just need the path to the file. I can do the rest I think.

Thanks

Re: Admin product confirm email issue

Posted: Tue May 15, 2012 7:01 pm
by JAY6390
Hi Druid_McGrew

The email that gets sent to you is actually a copy of the one sent to the customer, so you'll need to add in a bit of logic to the code in order to send only to the admin. The file you're looking for is
/catalog/model/checkout/order.php, specifically the "confirm" method in there

Kind regards
Jay

Re: Admin product confirm email issue

Posted: Tue May 15, 2012 7:46 pm
by Druid_McGrew
thanks very much jay.

Re: Admin product confirm email issue

Posted: Tue May 15, 2012 7:48 pm
by JAY6390
no problem

Re: Admin product confirm email issue

Posted: Tue May 22, 2012 5:36 pm
by Druid_McGrew
Ok I have found the code where an email is sent to the administrator with the order id and a few details. Its found round line 439 of order.php see below

Code: Select all

$text  = $language->get('text_new_received') . "\n\n";
				$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
				
				$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
				$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
				$text .= $language->get('text_new_products') . "\n";
Now I want to add just the forename, surname and email of the user that bought something. I changed to code to

Code: Select all

// Text 
				$text  = $language->get('text_new_received') . "\n\n";
				$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
				
				$text = $language->get('text_new_name') . ' ' . $order_query->row['firstname'] . $order_query->row['lastname']. "\n";
				$text = $language->get('text_new_email') . ' ' . $order_query->row['email'] . "\n";
				
				$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
				$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
				$text .= $language->get('text_new_products') . "\n";
				
				foreach ($order_product_query->rows as $result) {
Both the text_new_name and the text_new_email texts where added to the other order.php as needed and the row['firstname'] row['lastname'] row['email'] was taken from lines 91, 92, 95.

Now the problem is the name and email are still coming through blank. Obviously the row['firstname'] variable Im using is wrong. Can anyone help me with adding the correct variable to this mail query to get these details to show?

Thanks

Danny

Re: Admin product confirm email issue

Posted: Tue May 22, 2012 8:20 pm
by JAY6390
Hi Danny

Try using
$order_info['email']
$order_info['firstname']
$order_info['lastname']

instead of the $order_query->row data

Re: Admin product confirm email issue

Posted: Tue May 29, 2012 6:49 pm
by Druid_McGrew
Thanks Jay. Just awaiting an order to come in then ill know if its worked. thank you again for your help

Re: Admin product confirm email issue

Posted: Fri Oct 12, 2012 2:40 am
by digitaltag
I have just had the same problem and using $order_info['email'] works.

Thanks guys.