Post by visitor » Thu Mar 25, 2010 3:33 pm

I like to have the same order E-Mail which the customer gets also for the cart admin.
On this board i read somethings about it, but its for 1.4.0 and it did not work in 1.4.4.
Can someone tell me what is to do?

Newbie

Posts

Joined
Tue Mar 23, 2010 3:20 am

Post by i2Paq » Thu Mar 25, 2010 4:26 pm

If you would give me a link to that topic?

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by imaginetech » Thu Mar 25, 2010 4:43 pm

Look in catalog/model/cart/order.php.

You'll see the mail send code for the customer and admin. Simply copy the customer email object and change the sendto property to the shop config email and then send both. If you don't w
ant the standard admin email comment out that code.

From memory that's how I did it.

Image
www.opencartstore.com
Get OpenCart Templates and OpenCart Modules.


User avatar
Active Member

Posts

Joined
Fri Sep 04, 2009 12:25 pm
Location - Darwin, Australia

Post by Wade C » Fri Mar 26, 2010 2:17 am

i2Paq,
I think he is referencing Qphoria's Enhanced Order Email.

Wade

Oooppps, did I do that?


New member

Posts

Joined
Sat Apr 11, 2009 1:12 am

Post by i2Paq » Fri Mar 26, 2010 2:27 am

Aha, I see.

Thanks!

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by visitor » Fri Mar 26, 2010 4:37 pm

thx for the info @ imaginetech...i going to try it

Newbie

Posts

Joined
Tue Mar 23, 2010 3:20 am

Post by pvtsales » Fri Apr 02, 2010 10:40 pm

imaginetech wrote:Look in catalog/model/cart/order.php.

You'll see the mail send code for the customer and admin. Simply copy the customer email object and change the sendto property to the shop config email and then send both. If you don't w
ant the standard admin email comment out that code.

From memory that's how I did it.

Could you please tell the exact line to modify?

Vers. 1.4.6

Newbie

Posts

Joined
Sat Jan 16, 2010 1:50 am

Post by luiseduardo » Sat Apr 03, 2010 6:09 am

Theres no catalog/model/cart/order.php in any oc version :S

New member

Posts

Joined
Sat Mar 06, 2010 6:09 pm

Post by Qphoria » Sat Apr 03, 2010 7:50 am

catalog/model/checkout/order.php

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by maxisgsm » Fri May 14, 2010 11:46 am

it is this line ??

Code: Select all

$mail->setTo($order_query->row['email']);
$mail->setFrom($this->config->get('config_email'));

New member

Posts

Joined
Tue May 11, 2010 8:44 am

Post by Wade C » Fri May 14, 2010 11:33 pm

Im not saying I did it right, or "cleanly" but it works... here is the last bit of the order.php file from mine, and it works for me. Im sure its an ugly hack compared to what it should really look like. :D
Its version 1.4.7

Basically, I copied the customer email code, commented out the text admin email code, added in the cust email code and changed the email to in the new admin part. If that makes sense.

Code: Select all

			// Text Mail
			$text  = sprintf($language->get('text_greeting'), html_entity_decode($order_query->row['store_name'], ENT_QUOTES, 'UTF-8')) . "\n\n";
			$text .= $language->get('text_order_id') . ' ' . $order_id . "\n";
			$text .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_query->row['date_added'])) . "\n";
			$text .= $language->get('text_order_status') . ' ' . $order_status_query->row['name'] . "\n\n";
			$text .= $language->get('text_product') . "\n";
			
			foreach ($order_product_query->rows as $result) {
				$text .= $result['quantity'] . 'x ' . $result['name'] . ' (' . $result['model'] . ') ' . html_entity_decode($this->currency->format($result['total'], $order_query->row['currency'], $order_query->row['value']), ENT_NOQUOTES, 'UTF-8') . "\n";
			}
			
			$text .= "\n";
			
			$text .= $language->get('text_total') . "\n";
			
			foreach ($order_total_query->rows as $result) {
				$text .= $result['title'] . ' ' . html_entity_decode($result['text'], ENT_NOQUOTES, 'UTF-8') . "\n";
			}			
			
			$text .= "\n";
			
			if ($order_query->row['customer_id']) {
				$text .= $language->get('text_invoice') . "\n";
				$text .= $order_query->row['store_url'] . 'index.php?route=account/invoice&order_id=' . $order_id . "\n\n";
			}
		
			if ($order_download_query->num_rows) {
				$text .= $language->get('text_download') . "\n";
				$text .= $order_query->row['store_url'] . 'index.php?route=account/download' . "\n\n";
			}
			
			if ($comment) {
				$text .= $language->get('text_comment') . "\n\n";
				$text .= $comment . "\n\n";
			}
			
			$text .= $language->get('text_footer');
						
			$mail = new Mail(); 
			$mail->protocol = $this->config->get('config_mail_protocol');
			$mail->hostname = $this->config->get('config_smtp_host');
			$mail->username = $this->config->get('config_smtp_username');
			$mail->password = $this->config->get('config_smtp_password');
			$mail->port = $this->config->get('config_smtp_port');
			$mail->timeout = $this->config->get('config_smtp_timeout');			
			$mail->setTo($order_query->row['email']);
			$mail->setFrom($this->config->get('config_email'));
			$mail->setSender($order_query->row['store_name']);
			$mail->setSubject($subject);
			$mail->setHtml($html);
			$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
			$mail->addAttachment(DIR_IMAGE . $this->config->get('config_logo'));
			$mail->send();


//  admin email mod

$mail = new Mail(); 
			$mail->protocol = $this->config->get('config_mail_protocol');
			$mail->hostname = $this->config->get('config_smtp_host');
			$mail->username = $this->config->get('config_smtp_username');
			$mail->password = $this->config->get('config_smtp_password');
			$mail->port = $this->config->get('config_smtp_port');
			$mail->timeout = $this->config->get('config_smtp_timeout');			
			$mail->setTo($this->config->get('config_email'));
			$mail->setFrom($this->config->get('config_email'));
			$mail->setSender($order_query->row['store_name']);
			$mail->setSubject($subject);
			$mail->setHtml($html);
			$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
			$mail->addAttachment(DIR_IMAGE . $this->config->get('config_logo'));
			$mail->send();


// end email mod


			
			if ($this->config->get('config_alert_mail')) {
				$text  = $language->get('text_received') . "\n\n";
				$text .= $language->get('text_order_id') . ' ' . $order_id . "\n";
				$text .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_query->row['date_added'])) . "\n";
				$text .= $language->get('text_order_status') . ' ' . $order_status_query->row['name'] . "\n\n";
				$text .= $language->get('text_product') . "\n";
				
				foreach ($order_product_query->rows as $result) {
					$text .= $result['quantity'] . 'x ' . $result['name'] . ' (' . $result['model'] . ') ' . html_entity_decode($this->currency->format($result['total'], $order_query->row['currency'], $order_query->row['value']), ENT_NOQUOTES, 'UTF-8') . "\n";
				}
				
				$text .= "\n";

				$text.= $language->get('text_total') . "\n";
				
				foreach ($order_total_query->rows as $result) {
					$text .= $result['title'] . ' ' . html_entity_decode($result['text'], ENT_NOQUOTES, 'UTF-8') . "\n";
				}			
				
				$text .= "\n";
				
				if ($comment) {
					$text .= $language->get('text_comment') . "\n\n";
					$text .= $comment . "\n\n";
				}
			
/*				$mail = new Mail(); 
				$mail->protocol = $this->config->get('config_mail_protocol');
				$mail->hostname = $this->config->get('config_smtp_host');
				$mail->username = $this->config->get('config_smtp_username');
				$mail->password = $this->config->get('config_smtp_password');
				$mail->port = $this->config->get('config_smtp_port');
				$mail->timeout = $this->config->get('config_smtp_timeout');
				$mail->setTo($this->config->get('config_email'));
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender($order_query->row['store_name']);
				$mail->setSubject($subject);
				$mail->setText($text);
				$mail->send();	
*/
			}		
		}
	}
	
	public function update($order_id, $order_status_id, $comment = '', $notify = FALSE) {
		$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "language l ON (o.language_id = l.language_id) WHERE o.order_id = '" . (int)$order_id . "' AND o.order_status_id > '0'");
		
		if ($order_query->num_rows) {
			$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int)$order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");
		
			$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int)$order_id . "', order_status_id = '" . (int)$order_status_id . "', notify = '" . (int)$notify . "', comment = '" . $this->db->escape($comment) . "', date_added = NOW()");
	
			if ($notify) {
				$language = new Language($order_query->row['directory']);
				$language->load($order_query->row['filename']);
				$language->load('mail/order_update');
			
				$subject = sprintf($language->get('text_subject'), html_entity_decode($order_query->row['store_name'], ENT_QUOTES, 'UTF-8'), $order_id);
	
				$message  = $language->get('text_order') . ' ' . $order_id . "\n";
				$message .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_query->row['date_added'])) . "\n\n";
				
				$order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "' AND language_id = '" . (int)$order_query->row['language_id'] . "'");
				
				if ($order_status_query->num_rows) {
					$message .= $language->get('text_order_status') . "\n\n";
					$message .= $order_status_query->row['name'] . "\n\n";
				}
				
				$message .= $language->get('text_invoice') . "\n";
				$message .= $order_query->row['store_url'] . 'index.php?route=account/invoice&order_id=' . $order_id . "\n\n";
					
				if ($comment) { 
					$message .= $language->get('text_comment') . "\n\n";
					$message .= $comment . "\n\n";
				}
					
				$message .= $language->get('text_footer');

				$mail = new Mail();
				$mail->protocol = $this->config->get('config_mail_protocol');
				$mail->hostname = $this->config->get('config_smtp_host');
				$mail->username = $this->config->get('config_smtp_username');
				$mail->password = $this->config->get('config_smtp_password');
				$mail->port = $this->config->get('config_smtp_port');
				$mail->timeout = $this->config->get('config_smtp_timeout');				
				$mail->setTo($order_query->row['email']);
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender($order_query->row['store_name']);
				$mail->setSubject($subject);
				$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
				$mail->send();
			}
		}
	}
}
?>

Oooppps, did I do that?


New member

Posts

Joined
Sat Apr 11, 2009 1:12 am

Post by Purebeads » Thu May 20, 2010 9:30 pm

You know, I really want to do this, but I'm just not willing to copy code written by a customer and not a developer. Qphoria, would you please look over this code and tell us if it is written correctly?

Never mind. According to another thread, you're adding this feature to 1.4.8.

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm
Who is online

Users browsing this forum: No registered users and 40 guests