Post by Druid_McGrew » Tue May 15, 2012 6:58 pm

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

Newbie

Posts

Joined
Tue Nov 01, 2011 4:39 am

Post by JAY6390 » Tue May 15, 2012 7:01 pm

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

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Druid_McGrew » Tue May 15, 2012 7:46 pm

thanks very much jay.

Newbie

Posts

Joined
Tue Nov 01, 2011 4:39 am

Post by JAY6390 » Tue May 15, 2012 7:48 pm

no problem

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Druid_McGrew » Tue May 22, 2012 5:36 pm

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

Newbie

Posts

Joined
Tue Nov 01, 2011 4:39 am

Post by JAY6390 » Tue May 22, 2012 8:20 pm

Hi Danny

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

instead of the $order_query->row data

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Druid_McGrew » Tue May 29, 2012 6:49 pm

Thanks Jay. Just awaiting an order to come in then ill know if its worked. thank you again for your help

Newbie

Posts

Joined
Tue Nov 01, 2011 4:39 am

Post by digitaltag » Fri Oct 12, 2012 2:40 am

I have just had the same problem and using $order_info['email'] works.

Thanks guys.

Newbie

Posts

Joined
Thu Aug 02, 2012 8:07 pm
Who is online

Users browsing this forum: No registered users and 18 guests