gennady

Ошибка в HTML письме подтверждения заказа

Рекомендуемые сообщения

gennady    2

Версия 1.3.2

Ошибка не напрягает, но имеет место быть. Проявляется только при оплате PayPal.

В письме нет данных о покупателе.

error.log

2012-02-05 20:42:59 - PHP Notice:  Undefined index:  shipping_address_id in *catalog/model/checkout/order.php on line 72
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant firstname - assumed 'firstname' in *catalog/model/checkout/order.php on line 80
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  firstname in *catalog/model/checkout/order.php on line 80
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant lastname - assumed 'lastname' in *catalog/model/checkout/order.php on line 80
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  lastname in *catalog/model/checkout/order.php on line 80
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant address_1 - assumed 'address_1' in *catalog/model/checkout/order.php on line 81
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  address_1 in *catalog/model/checkout/order.php on line 81
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant address_2 - assumed 'address_2' in *catalog/model/checkout/order.php on line 81
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  address_2 in *catalog/model/checkout/order.php on line 81
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant city - assumed 'city' in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  city in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant zone - assumed 'zone' in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  zone in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant postcode - assumed 'postcode' in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  postcode in *catalog/model/checkout/order.php on line 82
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant country - assumed 'country' in *catalog/model/checkout/order.php on line 83
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  country in *catalog/model/checkout/order.php on line 83
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant firstname - assumed 'firstname' in *catalog/model/checkout/order.php on line 147
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  firstname in *catalog/model/checkout/order.php on line 147
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant lastname - assumed 'lastname' in *catalog/model/checkout/order.php on line 147
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  lastname in *catalog/model/checkout/order.php on line 147
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant address_1 - assumed 'address_1' in *catalog/model/checkout/order.php on line 152
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  address_1 in *catalog/model/checkout/order.php on line 152
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant address_2 - assumed 'address_2' in *catalog/model/checkout/order.php on line 152
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  address_2 in *catalog/model/checkout/order.php on line 152
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant city - assumed 'city' in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  city in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant zone - assumed 'zone' in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  zone in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant postcode - assumed 'postcode' in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  postcode in *catalog/model/checkout/order.php on line 153
2012-02-05 20:42:59 - PHP Notice:  Use of undefined constant country - assumed 'country' in *catalog/model/checkout/order.php on line 154
2012-02-05 20:42:59 - PHP Notice:  Undefined index:  country in *catalog/model/checkout/order.php on line 154

Order.php

<?php
class ModelCheckoutOrder extends Model {
public function getOrder($order_id) {
  $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$order_id . "'");

  return $query->row;
}

public function create($data) {
  $query = $this->db->query("SELECT order_id FROM `" . DB_PREFIX . "order` WHERE date_added < '" . date('Y-m-d', strtotime('-1 month')) . "' AND order_status_id = '0'");

  foreach ($query->rows as $result) {
   $this->db->query("DELETE FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$result['order_id'] . "'");
		$this->db->query("DELETE FROM " . DB_PREFIX . "order_history WHERE order_id = '" . (int)$result['order_id'] . "'");
		$this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$result['order_id'] . "'");
		$this->db->query("DELETE FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$result['order_id'] . "'");
	 $this->db->query("DELETE FROM " . DB_PREFIX . "order_download WHERE order_id = '" . (int)$result['order_id'] . "'");
		$this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$result['order_id'] . "'");
  }

  $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET customer_id = '" . (int)$data['customer_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', total = '" . (float)$data['total'] . "', language_id = '" . (int)$data['language_id'] . "', currency = '" . $this->db->escape($data['currency']) . "', currency_id = '" . (int)$data['currency_id'] . "', value = '" . (float)$data['value'] . "', coupon_id = '" . (int)$data['coupon_id'] . "', ip = '" . $this->db->escape($data['ip']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', comment = '" . $this->db->escape($data['comment']) . "', date_modified = NOW(), date_added = NOW()");
  $order_id = $this->db->getLastId();
  foreach ($data['products'] as $product) {
   $this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product['model']) . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', tax = '" . (float)$product['tax'] . "', quantity = '" . (int)$product['quantity'] . "'");

   $order_product_id = $this->db->getLastId();
   foreach ($product['option'] as $option) {
	$this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', name = '" . $this->db->escape($option['name']) . "', `value` = '" . $this->db->escape($option['value']) . "', price = '" . (float)$product['price'] . "', prefix = '" . $this->db->escape($option['prefix']) . "'");
   }
  
   foreach ($product['download'] as $download) {
	$this->db->query("INSERT INTO " . DB_PREFIX . "order_download SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', name = '" . $this->db->escape($download['name']) . "', filename = '" . $this->db->escape($download['filename']) . "', mask = '" . $this->db->escape($download['mask']) . "', remaining = '" . (int)($download['remaining'] * $product['quantity']) . "'");
   }
  }

  foreach ($data['totals'] as $total) {
   $this->db->query("INSERT INTO " . DB_PREFIX . "order_total SET order_id = '" . (int)$order_id . "', title = '" . $this->db->escape($total['title']) . "', text = '" . $this->db->escape($total['text']) . "', `value` = '" . (float)$total['value'] . "', sort_order = '" . (int)$total['sort_order'] . "'");
  }
  return $order_id;
}
public function confirm($order_id, $order_status_id, $comment = '') {
  $order_query = $this->db->query("SELECT *, l.code AS language 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 ($this->config->get('config_stock_subtract')) {
				$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
			
				foreach ($order_product_query->rows as $result) {
				   $this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$result['quantity'] . ") WHERE product_id = '" . (int)$result['product_id'] . "'");
				}
			 }
  if ($order_query->num_rows) {
   $this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int)$order_status_id . "' 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 = '1', comment = '" . $this->db->escape($comment) . "', date_added = NOW()");
  
   $language = new Language($order_query->row['language']);
   $language->load('checkout/confirm');
  
   $this->load->model('localisation/currency');
  
   $subject = sprintf($language->get('mail_new_order_subject'), $this->config->get('config_store'), $order_id) ;
   $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'] . "'");
   $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
   $order_total_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "' ORDER BY sort_order ASC");
   $order_download_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_download WHERE order_id = '" . (int)$order_id . "'");
  
		
	/*Get user info*/ $addressEmail= $this->customer->getAddress($this->session->data['shipping_address_id']);
	// Mail to Custumer   -----------------------------------------------------------	
	/* message start ->*/ $message =""
	/*Logo*/		."<div style='text-align:left'><img src='http://hobby-miracle.com/image/logo-miracle.PNG'align='center'alt='Hobby-Miracle'/></a></div>"
	/*Order */	  ."<h2>".$language->get('mail_new_order_order')."<span style='color:red;'>".$order_id."</span></h2>"
				."<div style='color:blue;text-align:center'>".sprintf($language->get('mail_new_order_greeting'),$this->config->get('config_store'))."</div><br>"
				."<table border 1 cellpadding='3' cellspacing='0' width='250' bgcolor='#e6edff'>"
				.$addressEmail[firstname]." ".$addressEmail[lastname]."<br>"
				.$addressEmail[address_1]." - ".$addressEmail[address_2]."<br>"
				.$addressEmail[city]." ".$addressEmail[zone]." ".$addressEmail[postcode]."<br>"
				.$addressEmail[country]."</table>"
			  
	/*date/status*/   ."<table border='0' cellpadding='3' cellspacing='0' width='500'>"."<tr>"
				."<td>".$language->get('mail_new_order_date_added').' '.date($language->get('date_format_short'), strtotime($order_query->row['date_added']))."</td>"
				."<td align='right' >".$language->get('mail_new_order_order_status') . ' ' . $order_status_query->row['name']."</td>"."</tr>"."</table>"
			  
	/*PRODUCTS:*/   ."<strong>".$language->get('mail_new_order_product')."</strong>"
			  
	/*Prod. loop*/  ."<table border='1' cellpadding='3' cellspacing='0'  width='500' bgcolor='#f4fdd9'>"."<tr>";
				foreach ($order_product_query->rows as $result) {
				$message .="<tr>"
				   ."<td>".$result['quantity'].'x '."</td>"
				   ."<td>".$result['name'].' ('.$result['model'].')'."</td>"
				   ."<td  width='100'>".$this->currency->format($result['total'], $order_query->row['currency'], $order_query->row['value'])."</td>"
				   ."</tr>";};
				$message .="</table>"
	/*TOTAL:*/	  ."<strong>".$language->get('mail_new_order_total')."</strong>"
			  
	/*Total loop*/   ."<table border='0' cellpadding='3' cellspacing='0'  width='500'>";
					foreach ($order_total_query->rows as $result) {
				$message .= "<tr><td width='400' align='right'><b>".$result['title']."</b></td><td width='100' border='1' bgcolor='#d9fde3'> ".$result['text']."</td></tr>";};
				$message .= "</table>";
			  
	/*invoice link*/ //$message .= $language->get('mail_new_order_invoice') . "<br>"
				   $message .="<a href='".html_entity_decode($this->url->http('account/invoice&order_id='.$order_id))."'><b color='red'>ONLINE INVOICE</b></a><br><br>";
			  
	/*Download info*/   if ($order_download_query->num_rows) {
				   $message .=""
				   ."<strong>".$language->get('mail_new_order_download') ."</strong><br>"
				   ."<table border='1' cellpadding='3' cellspacing='0'  width='500'>"
				   .$this->url->http('account/download')."</table>";
				}
			  
	/*Comments*/  if ($comment) {
				   $message .=""
				   ."<strong>".$language->get('mail_new_order_comment') . "</strong><br>"
				   ."<table border='1' cellpadding='3' cellspacing='0'  width='500'>"
				   .$comment."</table>";
				}

			  
			
			 $message .= $language->get('mail_new_order_footer');
			 $mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password')), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
			 $mail->setTo($order_query->row['email']);
			 $mail->setFrom($this->config->get('config_email'));
			 $mail->setSender($this->config->get('config_store'));
			 $mail->setSubject($subject);
	/* html */   $mail->setHtml($message);
			 $mail->send();
	// Mail to Administrator---------------------------------------------
		  if ($this->config->get('config_alert_mail')) {
	/* message start ->*/ $message =""
	/*Logo*/		 ."<div style='text-align:left'><img src='http://hobby-miracle.com/image/logo-miracle.PNG'align='center'body='0'alt='Hobby-Miracle'/></a></div>"
	/*Order recived*/ ."<h2>".$language->get('mail_new_order_received')."<br>".$language->get('mail_new_order_order')."<span style='color:red;'>".$order_id."</span></h2><br>"
				."<table border 1 cellpadding='3' cellspacing='0' width='250' bgcolor='#e6edff'>"
				.$addressEmail[firstname]." ".$addressEmail[lastname]."<br>"
	/*Email*/   ."<td>". ' E-mail : ' .' '. $order_query->row['email']."</td>"."</tr>"
	/*Phone*/   ."<td>".' Phone : '.' '. $order_query->row['telephone']."</td>"."</tr>"
				.$addressEmail[address_1]." - ".$addressEmail[address_2]."<br>"
				.$addressEmail[city]." ".$addressEmail[zone]." ".$addressEmail[postcode]."<br>"
				.$addressEmail[country]."</table>"  
			  
	/*date/status*/   ."<table border='0' cellpadding='3' cellspacing='0' width='500'>"."<tr>"
				."<td>".$language->get('mail_new_order_date_added').' '.date($language->get('date_format_short'), strtotime($order_query->row['date_added']))."</td>"
				."<td align='right' >".$language->get('mail_new_order_order_status') . ' ' . $order_status_query->row['name']."</td>"."</tr>"."</table>"
	/*Payment Method*/   ."<table border='0' cellpadding='3' cellspacing='0' width='500'>"."<tr>"
				."<td>".$language->get('text_payment_method').' ' . $order_query->row['payment_method']."</td>"."</tr>"."</table>"
	/*Delivery Method*/   ."<table border='0' cellpadding='3' cellspacing='0' width='500'>"."<tr>"
				."<td>".$language->get('text_shipping_method').' ' . $order_query->row['shipping_method']."</td>"."</tr>"."</table>"
			  
	/*PRODUCTS:*/   ."<strong>".$language->get('mail_new_order_product')."</strong>"
			  
	/*Prod. loop*/  ."<table border='1' cellpadding='3' cellspacing='0'  width='500' bgcolor='#f4fdd9' >"."<tr>";
				foreach ($order_product_query->rows as $result) {
				$message .="<tr>"
				   ."<td>".$result['quantity'].'x '."</td>"
				   ."<td>".$result['name'].' ('.$result['model'].')'."</td>"
				   ."<td  width='100'>".$this->currency->format($result['total'], $order_query->row['currency'], $order_query->row['value'])."</td>"
				   ."</tr>";};
				$message .="</table>"
	/*TOTAL:*/	  ."<strong>".$language->get('mail_new_order_total')."</strong>"
			  
	/*Total loop*/   ."<table border='0' cellpadding='3' cellspacing='0'  width='500'>";
					foreach ($order_total_query->rows as $result) {
				$message .= "<tr><td width='400' align='right'><b>".$result['title']."</b></td><td width='100' border='1' bgcolor='#d9fde3'> ".$result['text']."</td></tr>";};
				$message .= "</table>";
			  
	/*Download info*/   if ($order_download_query->num_rows) {
				   $message .=""
				   ."<strong>".$language->get('mail_new_order_download') ."</strong><br>"
				   ."<table border='1' cellpadding='3' cellspacing='0'  width='500'>"
				   .$this->url->http('account/download')."</table>";
				}
			  
	/*Comments*/  if ($comment) {
				   $message .=""
				   ."<strong>".$language->get('mail_new_order_comment') . "</strong><br>"
				   ."<table border='1' cellpadding='3' cellspacing='0'  width='500'>"
				   .$comment."</table>";
				}
			
				$mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), $this->config->get('config_smtp_password'), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
				$mail->setTo($this->config->get('config_email'));
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender($this->config->get('config_store'));
				$mail->setSubject($subject);
	/* html */	  $mail->setHtml($message);
				$mail->send();		  
			 }
			
					
		  }
	   }
	  
	   public function update($order_id, $order_status_id, $comment = '', $notifiy = FALSE) {
		  $order_query = $this->db->query("SELECT *, o.language_id, l.code AS language 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)$notifiy . "', comment = '" . $this->db->escape($comment) . "', date_added = NOW()");
	  
			 if ($notifiy) {
				$language = new Language($order_query->row['language']);
				$language->load('checkout/confirm');
	  
				$subject = sprintf($language->get('mail_update_order_subject'), $this->config->get('config_store'), $order_id);
	  
				$message  = $language->get('mail_update_order_order') . ' ' . $order_id ."n";
				$message .= $language->get('mail_update_order_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_query->row['date_added'])) . "nn";
				$message .= $language->get('mail_update_order_order_status') . "nn";
			  
				$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'] . "'");
			  
				$message .= $order_status_query->row['name'] . "nn THIS IS THE ONE";
				  
				$message .= $language->get('mail_update_order_invoice') . "n";
				$message .= html_entity_decode($this->url->http('account/invoice&order_id=' . $order_id)) . "nn";
				  
				if ($comment) {
				   $message .= $language->get('mail_update_order_comment') . "nn";
				   $message .= $comment . "nn";
				}
				  
				$message .= $language->get('mail_update_order_footer');
				$mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password')), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
				$mail->setTo($order_query->row['email']);
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender($this->config->get('config_store'));
				$mail->setSubject($subject);
				$mail->setText($message);
				$mail->send();
			 }
		  }
	   }
	}
?>

post-3020-0-93913000-1328634023_thumb.png

Изменено пользователем afwollis
прячьте полотна свои в spoiler. спасибо

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти


  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу