Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Send_order_html_email


Elazar

Recommended Posts

I just installed this great add-on, but faced with one problem.

 

I'm using PayPal IPN and the order email is sent from a different file (ext\modules\payment\paypal_ipn\ipn.php)

so it's still sending out text emails.

 

Is there a way to overcome this?

 

Thanks,

 

Susan

 

I´m not using ipn but if i´m right, you have to modify the paypal.ipn modules located in the /catalog/ext/modules/payment and /catalog/includes/modules/payment folders directly to work with HTML emails.

Link to comment
Share on other sites

  • Replies 344
  • Created
  • Last Reply

Top Posters In This Topic

The contribution works fine and also the stylesheets maybe that you have made something wrong - but this didnt mean that the contribution sucks ;)

 

 

men i installed ten times, it's not working, it's only the stylesheetmail , even i copy the content of the stylesheet in the html_checkout_process.php ,it's not working men.

 

 

$html_email_order = "<html>";

$html_email_order .= "<head>";

$html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> ";

$html_email_order .= "

 

stylesheetmail.css

 

</head>";

Link to comment
Share on other sites

men i installed ten times, it's not working, it's only the stylesheetmail , even i copy the content of the stylesheet in the html_checkout_process.php ,it's not working men.

 

 

$html_email_order = "<html>";

$html_email_order .= "<head>";

$html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> ";

$html_email_order .= "

 

stylesheetmail.css

 

</head>";

 

That shouldnt work this way - i´m missing the <base> tag also as the right syntax for stylesheet include

 

1. have you defined in languages/YOURLANGUAGE/checkout_process.php

 

define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">'); //location of email css file.

define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'); //Do not change

 

2. in checkout_process.php

something like

$Varhttp = ''.VARHTTP.'';

$Varstyle = ''.VARSTYLE.'';

 

and in the modules/email/html_checkout_process.php something like

 

3. $html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> ";

$html_email_order .= "$Varhttp ";

$html_email_order .= "$Varstyle ";

 

 

If not it will never work the right way

 

4. if you try to include the stylesheet.css directly than try it with something like

$html_email_order .= "<base href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\"><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetmail.css\">";

be aware that you have defined the base element

 

br Frank

 

... i have installed it also 10 times without havong any issue ;)

Link to comment
Share on other sites

That shouldnt work this way - i´m missing the <base> tag also as the right syntax for stylesheet include

 

1. have you defined in languages/YOURLANGUAGE/checkout_process.php

 

define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">'); //location of email css file.

define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'); //Do not change

 

2. in checkout_process.php

something like

$Varhttp = ''.VARHTTP.'';

$Varstyle = ''.VARSTYLE.'';

 

and in the modules/email/html_checkout_process.php something like

 

3. $html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> ";

$html_email_order .= "$Varhttp ";

$html_email_order .= "$Varstyle ";

 

 

If not it will never work the right way

 

4. if you try to include the stylesheet.css directly than try it with something like

$html_email_order .= "<base href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\"><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetmail.css\">";

be aware that you have defined the base element

 

br Frank

 

... i have installed it also 10 times without havong any issue ;)

 

 

 

Thanks men to help me to solve my problem , i'am very grateful to you and i ll send you some royal chocolade of my country, let's give me your address if we find my problem

 

i checked all you write : point 1, 2 and 3, even 4 does not work...

 

1. have you defined in languages/FRENCH/checkout_process.php OK

 

define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">'); //location of email css file. OK

define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'); //Do not change OK

 

 

Here is my configure.php file

 

  
 define('HTTP_SERVER', 'http://localhost');
 define('HTTPS_SERVER', 'http://localhost');
 define('ENABLE_SSL', false);
 define('HTTP_COOKIE_DOMAIN', 'localhost');
 define('HTTPS_COOKIE_DOMAIN', 'localhost');
 define('HTTP_COOKIE_PATH', '/bijoux/osc/');
 define('HTTPS_COOKIE_PATH', '/bijoux/osc/');
 define('DIR_WS_HTTP_CATALOG', '/bijoux/osc/');
 define('DIR_WS_HTTPS_CATALOG', '/bijoux/osc/');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', 'C:/wamp/www/bijoux/osc/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

 

2 .

2. in checkout_process.php

something like

$Varhttp = ''.VARHTTP.''; OK

$Varstyle = ''.VARSTYLE.''; OK

 

3. $html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> "; OK

$html_email_order .= "$Varhttp "; OK

$html_email_order .= "$Varstyle "; OK

 

 

4. if you try to include the stylesheet.css directly than try it with something like

$html_email_order .= "<base href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\"><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetmail.css\">";

be aware that you have defined the base element

 

I CHANGED BUT NOT WORK

 

<?php
$html_email_order = "<html>";
$html_email_order .= "<head>";
$html_email_order .= "<base href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\"><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetmail.css\">";                            OK
$html_email_order .= "$Varhttp ";
$html_email_order .= "$Varstyle ";
$html_email_order .= "</head>";
$html_email_order .= "<body>";
$html_email_order .= "<table width=\"600\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$html_email_order .= "	<tr>";
$html_email_order .= " 		<td><table width=\"600\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$html_email_order .= " 			 <tr> ";
$html_email_order .= "    			<td>$Vartable1";
$html_email_order .= "	    			<tr> ";
$html_email_order .= "		 				<td><font face=\"verdana, arial\" size=\"-1\">$Varlogo</font></td>";
$html_email_order .= "					</tr>";
$html_email_order .= "	 			</table></td>";
$html_email_order .= "  		</tr>";
$html_email_order .= "  		<tr> ";
$html_email_order .= "    			<td>$Vartable2 ";
$html_email_order .= "        	<tr> ";
$html_email_order .= "          	<td class=\"main\">$Vartext1</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr height=\"14\"  class=\"detail\"> ";
$html_email_order .= "          	<td height=\"14\"> </td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr class=\"detail\"> ";
$html_email_order .= "          	<td class=\"main\">$Vartext2</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr height=\"14\"> ";
$html_email_order .= "          	<td height=\"14\"> </td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "		</table></td>";
$html_email_order .= "	</tr>";
$html_email_order .= "	<tr>";
$html_email_order .= "   	<td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "        	<tr> ";
$html_email_order .= "          	<td class=\"boxmail\" align=\"left\" width=\"300\">$VarArticles</td>";
$html_email_order .= "          	<td class=\"boxmail\" align=\"left\" width=\"160\">$VarModele</td>";
$html_email_order .= "          	<td class=\"boxmail\" align=\"center\" width=\"40\">$VarQte</td>";
$html_email_order .= "          	<td class=\"boxmail\" align=\"right\" width=\"100\">$VarTotal</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr> ";
$html_email_order .= "          	<td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_name</td>";
$html_email_order .= "          	<td width=\"160\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_model</td>";
$html_email_order .= "          	<td width=\"40\"  valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_quantity</td>";
$html_email_order .= "          	<td width=\"100\" valign=\"top\" align=\"right\" class=\"boxmailgris\">$products_price</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr height=\"14\"> ";
$html_email_order .= "          	<td height=\"14\" width=\"300\" valign=\"top\" align=\"left\" class=\"tableur\">$Vardetail</td>";
$html_email_order .= "          	<td colspan=\"3\" width=\"300\" valign=\"top\" align=\"right\" class=\"tableur\">$Vartaxe</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "      </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "  <tr>";
$html_email_order .= "      <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "       	<tr> ";
$html_email_order .= "          	<td width=\"300\" class=\"boxmail\">$VarAddresship</td>";
$html_email_order .= "          	<td width=\"300\" class=\"boxmail\">$VarAddressbill</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr> ";
$html_email_order .= "         		<td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$Varshipaddress</td>";
$html_email_order .= "         		<td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$Varadpay</td> ";
$html_email_order .= "        	</tr>";
$html_email_order .= "       </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "  <tr>";
$html_email_order .= "		 <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "        	<tr> ";
$html_email_order .= "         		<td class=\"boxmail\">$Varmetodpaye</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "       	 <tr> ";
$html_email_order .= "          	<td class=\"boxmailgris\">$Varmodpay</td> ";
$html_email_order .= "        	</tr>";
$html_email_order .= "       </table></td>";
$html_email_order .= " 	</tr>";
$html_email_order .= "  <tr>";
$html_email_order .= " 		 <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "       	<tr height=\"14\"> ";
$html_email_order .= "         		<td height=\"14\"> </td>";
$html_email_order .= "       	</tr>";
$html_email_order .= "       	<tr class=\"main\"> ";
$html_email_order .= "          	<td class=\"footer\">$Varmailfooter</td> ";
$html_email_order .= "        	</tr>";
$html_email_order .= "      </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "</table></td>";
$html_email_order .= "</tr>";
$html_email_order .= "</table>";
$html_email_order .= "</body>";
$html_email_order .= "</html>";
?>

 

 

 

The stylesheetmail.css is in /osc/stylesheetmail.css

Link to comment
Share on other sites

Hi,

 

I'm trying to create v2.1.1 of this wonderful contribution by making it compatible with PayPal Website Payments Standard

and need help from all of you to finalize it. (I'm almost there)

 

I've come this far: All the information is displayed except for Sub-Total, Shipping Method, Shipping Charge and Total amount.

 

<Exhibit A>: Image for Cash on Delivery purchase where all the necessary information is displayed properly.

ExhibitA.jpg

 

<Exhibit B>: Image for PayPal purchase. Information missing for Sub-Total, Shipping Method, Shipping Charge and Total amount.

ExhibitB.jpg

 

As some of you know already, the file that creates html is html_checkout_process.php.

The corresponding information is written by a single variable $Vartaxe.

Obviously, there's nothing to change in html_checkout_process.php because all it does is just create html tags.

 

$Vartaxe is read from

1. catalog\checkout_process.php when payment is made with means other than PayPal. (This is working properly, corresponds to Exhibit A)

2. catalog\includes\modules\payment\paypal_standard.php when payment is made with PayPal. (For those who've installed PayPal Website Payments Standard)

 

In checkout_process.php (which is working fine so does not need any modification), line 236 (remarked with lots of ***'s) contains the statement related to $Vartaxe. This is the file's only statement associated with $Vartaxe.

<?php
/*
 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [u]www.oscommerce.com[/u]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 if (!tep_session_is_registered('sendto')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
					  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
					  'customers_company' => $order->customer['company'],
					  'customers_street_address' => $order->customer['street_address'],
					  'customers_suburb' => $order->customer['suburb'],
					  'customers_city' => $order->customer['city'],
					  'customers_postcode' => $order->customer['postcode'], 
					  'customers_state' => $order->customer['state'], 
					  'customers_country' => $order->customer['country']['title'], 
					  'customers_telephone' => $order->customer['telephone'], 
					  'customers_email_address' => $order->customer['email_address'],
					  'customers_address_format_id' => $order->customer['format_id'], 
					  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
					  'delivery_company' => $order->delivery['company'],
					  'delivery_street_address' => $order->delivery['street_address'], 
					  'delivery_suburb' => $order->delivery['suburb'], 
					  'delivery_city' => $order->delivery['city'], 
					  'delivery_postcode' => $order->delivery['postcode'], 
					  'delivery_state' => $order->delivery['state'], 
					  'delivery_country' => $order->delivery['country']['title'], 
					  'delivery_address_format_id' => $order->delivery['format_id'], 
					  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
					  'billing_company' => $order->billing['company'],
					  'billing_street_address' => $order->billing['street_address'], 
					  'billing_suburb' => $order->billing['suburb'], 
					  'billing_city' => $order->billing['city'], 
					  'billing_postcode' => $order->billing['postcode'], 
					  'billing_state' => $order->billing['state'], 
					  'billing_country' => $order->billing['country']['title'], 
					  'billing_address_format_id' => $order->billing['format_id'], 
					  'payment_method' => $order->info['payment_method'], 
					  'cc_type' => $order->info['cc_type'], 
					  'cc_owner' => $order->info['cc_owner'], 
					  'cc_number' => $order->info['cc_number'], 
					  'cc_expires' => $order->info['cc_expires'], 
					  'date_purchased' => 'now()', 
					  'orders_status' => $order->info['order_status'], 
					  'currency' => $order->info['currency'], 
					  'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
						'title' => $order_totals[$i]['title'],
						'text' => $order_totals[$i]['text'],
						'value' => $order_totals[$i]['value'], 
						'class' => $order_totals[$i]['code'], 
						'sort_order' => $order_totals[$i]['sort_order']);
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
					  'orders_status_id' => $order->info['order_status'], 
					  'date_added' => 'now()', 
					  'customer_notified' => $customer_notification,
					  'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
  if (DOWNLOAD_ENABLED == 'true') {
	$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
						FROM " . TABLE_PRODUCTS . " p
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						 ON p.products_id=pa.products_id
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						 ON pa.products_attributes_id=pad.products_attributes_id
						WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
	$products_attributes = $order->products[$i]['attributes'];
	if (is_array($products_attributes)) {
	  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	}
	$stock_query = tep_db_query($stock_query_raw);
  } else {
	$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
  }
  if (tep_db_num_rows($stock_query) > 0) {
	$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
	  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	} else {
	  $stock_left = $stock_values['products_quantity'];
	}
	tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
  }
}

// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

$sql_data_array = array('orders_id' => $insert_id, 
						'products_id' => tep_get_prid($order->products[$i]['id']), 
						'products_model' => $order->products[$i]['model'], 
						'products_name' => $order->products[$i]['name'], 
						'products_price' => $order->products[$i]['price'], 
						'final_price' => $order->products[$i]['final_price'], 
						'products_tax' => $order->products[$i]['tax'], 
						'products_quantity' => $order->products[$i]['qty']);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();

//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
  $attributes_exist = '1';
  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	if (DOWNLOAD_ENABLED == 'true') {
	  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
						   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
						   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							on pa.products_attributes_id=pad.products_attributes_id
						   where pa.products_id = '" . $order->products[$i]['id'] . "' 
							and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
							and pa.options_id = popt.products_options_id 
							and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
							and pa.options_values_id = poval.products_options_values_id 
							and popt.language_id = '" . $languages_id . "' 
							and poval.language_id = '" . $languages_id . "'";
	  $attributes = tep_db_query($attributes_query);
	} else {
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
	}
	$attributes_values = tep_db_fetch_array($attributes);

	$sql_data_array = array('orders_id' => $insert_id, 
							'orders_products_id' => $order_products_id, 
							'products_options' => $attributes_values['products_options_name'],
							'products_options_values' => $attributes_values['products_options_values_name'], 
							'options_values_price' => $attributes_values['options_values_price'], 
							'price_prefix' => $attributes_values['price_prefix']);
	tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

	if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
	  $sql_data_array = array('orders_id' => $insert_id, 
							  'orders_products_id' => $order_products_id, 
							  'orders_products_filename' => $attributes_values['products_attributes_filename'], 
							  'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
							  'download_count' => $attributes_values['products_attributes_maxcount']);
	  tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
	}
	$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
  }
}
//------insert customer choosen option eof ----
//BEGIN SEND HTML MAIL//

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
$products_quantity .= nl2br($order->products[$i]['qty'] . "\n");
$products_name .= nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes ."\n");

if (!tep_not_null($order->products[$i]['model'])) {
   $products_model .= ''.EMAIL_NO_MODEL.'';
	 }
else
   $products_model .= nl2br($order->products[$i]['model'] . "\n");


$products_price .= nl2br($currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty']) . "\n");

}


// THIS IS WHERE $Vartaxe IS GENERATED**************

for ($i=0; $i<sizeof($order_totals); $i++) {
$Vartaxe .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

// *********************************************************

if ($order->content_type != 'virtual') {
$Varaddress .= tep_address_label($customer_id, $sendto, 0, '', "\n");
 }

if (is_object($$payment)) {
$Varmodepay .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$Varmodpay .= $payment_class->title . "\n";
if ($payment_class->email_footer) { 
  $Varmodpay .= $payment_class->email_footer . "\n\n";
}
 }

$Varlogo = ''.VARLOGO.'';
$Vartable1 = ''.VARTABLE1.'';
$Vartable2 = ''.VARTABLE2.'';

$Vartext1 = ' <b>' . EMAIL_TEXT_DEAR . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] .' </b><br>' . EMAIL_MESSAGE_GREETING;
$Vartext2 = '	' . EMAIL_TEXT_ORDER_NUMBER . ' <STRONG> ' . $insert_id . '</STRONG><br>' . EMAIL_TEXT_DATE_ORDERED . ': <strong>' . strftime(DATE_FORMAT_LONG) . '</strong><br><a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history_info.php?order_id=' . $insert_id .'">' . EMAIL_TEXT_INVOICE_URL . '</a>'; 

$Varmailfooter = ''.VARMAILFOOTER.'';
$VarArticles= ''.EMAIL_TEXT_PRODUCTS_ARTICLES.'';
$VarModele= ''.EMAIL_TEXT_PRODUCTS_MODELE.'';
$VarQte= ''.EMAIL_TEXT_PRODUCTS_QTY .'';
$VarTotal= ''.EMAIL_TEXT_TOTAL.'';
$VarAddresship = ''.EMAIL_TEXT_DELIVERY_ADDRESS.'';
$VarAddressbill = ''.EMAIL_TEXT_BILLING_ADDRESS.'';
$Varmetodpaye = ''.EMAIL_TEXT_PAYMENT_METHOD.'';
$Vardetail = ''.DETAIL .'';
$Varhttp = ''.VARHTTP.'';
$Varstyle = ''.VARSTYLE.'';
$Varshipaddress =''.tep_address_label($customer_id, $sendto).'';



require(DIR_WS_MODULES . 'email/html_checkout_process.php');
$email_order = $html_email_order;

// lets start with the email confirmation
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}


 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
 $email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $html_email_order;
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
$email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);
 } 

//END SEND HTML MAIL//

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

In paypal_standard.php (which we need to modify), line 515 (remarked with lots of ***'s) contains the statement related to $Vartaxe. This is the file's only statement associated with $Vartaxe.

<?php
/*
 $Id: paypal_standard.php 1803 2008-01-11 18:16:37Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2008 osCommerce

 Released under the GNU General Public License
*/

 class paypal_standard {
var $code, $title, $description, $enabled;

// class constructor
function paypal_standard() {
  global $order;

  $this->signature = 'paypal|paypal_standard|1.0|2.2';

  $this->code = 'paypal_standard';
  $this->title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_TITLE;
  $this->public_title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_PUBLIC_TITLE;
  $this->description = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER;
  $this->enabled = ((MODULE_PAYMENT_PAYPAL_STANDARD_STATUS == 'True') ? true : false);

  if ((int)MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID > 0) {
	$this->order_status = MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID;
  }

  if (is_object($order)) $this->update_status();

  if (MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER == 'Live') {
	$this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
  } else {
	$this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
  }
}

// class methods
function update_status() {
  global $order;

  if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_STANDARD_ZONE > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_STANDARD_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
	while ($check = tep_db_fetch_array($check_query)) {
	  if ($check['zone_id'] < 1) {
		$check_flag = true;
		break;
	  } elseif ($check['zone_id'] == $order->billing['zone_id']) {
		$check_flag = true;
		break;
	  }
	}

	if ($check_flag == false) {
	  $this->enabled = false;
	}
  }
}

function javascript_validation() {
  return false;
}

function selection() {
  global $cart_PayPal_Standard_ID;

  if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
	$order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);

	$check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');

	if (tep_db_num_rows($check_query) < 1) {
	  tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
	  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');

	  tep_session_unregister('cart_PayPal_Standard_ID');
	}
  }

  return array('id' => $this->code,
			   'module' => $this->public_title);
}

function pre_confirmation_check() {
  global $cartID, $cart;

  if (empty($cart->cartID)) {
	$cartID = $cart->cartID = $cart->generate_cart_id();
  }

  if (!tep_session_is_registered('cartID')) {
	tep_session_register('cartID');
  }
}

function confirmation() {
  global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;

  if (tep_session_is_registered('cartID')) {
	$insert_order = false;

	if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
	  $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);

	  $curr_check = tep_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
	  $curr = tep_db_fetch_array($curr_check);

	  if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_Standard_ID, 0, strlen($cartID))) ) {
		$check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');

		if (tep_db_num_rows($check_query) < 1) {
		  tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
		  tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
		}

		$insert_order = true;
	  }
	} else {
	  $insert_order = true;
	}

	if ($insert_order == true) {
	  $order_totals = array();
	  if (is_array($order_total_modules->modules)) {
		reset($order_total_modules->modules);
		while (list(, $value) = each($order_total_modules->modules)) {
		  $class = substr($value, 0, strrpos($value, '.'));
		  if ($GLOBALS[$class]->enabled) {
			for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
			  if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
				$order_totals[] = array('code' => $GLOBALS[$class]->code,
										'title' => $GLOBALS[$class]->output[$i]['title'],
										'text' => $GLOBALS[$class]->output[$i]['text'],
										'value' => $GLOBALS[$class]->output[$i]['value'],
										'sort_order' => $GLOBALS[$class]->sort_order);
			  }
			}
		  }
		}
	  }

	  $sql_data_array = array('customers_id' => $customer_id,
							  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
							  'customers_company' => $order->customer['company'],
							  'customers_street_address' => $order->customer['street_address'],
							  'customers_suburb' => $order->customer['suburb'],
							  'customers_city' => $order->customer['city'],
							  'customers_postcode' => $order->customer['postcode'],
							  'customers_state' => $order->customer['state'],
							  'customers_country' => $order->customer['country']['title'],
							  'customers_telephone' => $order->customer['telephone'],
							  'customers_email_address' => $order->customer['email_address'],
							  'customers_address_format_id' => $order->customer['format_id'],
							  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
							  'delivery_company' => $order->delivery['company'],
							  'delivery_street_address' => $order->delivery['street_address'],
							  'delivery_suburb' => $order->delivery['suburb'],
							  'delivery_city' => $order->delivery['city'],
							  'delivery_postcode' => $order->delivery['postcode'],
							  'delivery_state' => $order->delivery['state'],
							  'delivery_country' => $order->delivery['country']['title'],
							  'delivery_address_format_id' => $order->delivery['format_id'],
							  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
							  'billing_company' => $order->billing['company'],
							  'billing_street_address' => $order->billing['street_address'],
							  'billing_suburb' => $order->billing['suburb'],
							  'billing_city' => $order->billing['city'],
							  'billing_postcode' => $order->billing['postcode'],
							  'billing_state' => $order->billing['state'],
							  'billing_country' => $order->billing['country']['title'],
							  'billing_address_format_id' => $order->billing['format_id'],
							  'payment_method' => $order->info['payment_method'],
							  'cc_type' => $order->info['cc_type'],
							  'cc_owner' => $order->info['cc_owner'],
							  'cc_number' => $order->info['cc_number'],
							  'cc_expires' => $order->info['cc_expires'],
							  'date_purchased' => 'now()',
							  'orders_status' => $order->info['order_status'],
							  'currency' => $order->info['currency'],
							  'currency_value' => $order->info['currency_value']);

	  tep_db_perform(TABLE_ORDERS, $sql_data_array);

	  $insert_id = tep_db_insert_id();

	  for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
		$sql_data_array = array('orders_id' => $insert_id,
								'title' => $order_totals[$i]['title'],
								'text' => $order_totals[$i]['text'],
								'value' => $order_totals[$i]['value'],
								'class' => $order_totals[$i]['code'],
								'sort_order' => $order_totals[$i]['sort_order']);

		tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
	  }

	  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
		$sql_data_array = array('orders_id' => $insert_id,
								'products_id' => tep_get_prid($order->products[$i]['id']),
								'products_model' => $order->products[$i]['model'],
								'products_name' => $order->products[$i]['name'],
								'products_price' => $order->products[$i]['price'],
								'final_price' => $order->products[$i]['final_price'],
								'products_tax' => $order->products[$i]['tax'],
								'products_quantity' => $order->products[$i]['qty']);

		tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

		$order_products_id = tep_db_insert_id();

		$attributes_exist = '0';
		if (isset($order->products[$i]['attributes'])) {
		  $attributes_exist = '1';
		  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
			if (DOWNLOAD_ENABLED == 'true') {
			  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
								   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
								   on pa.products_attributes_id=pad.products_attributes_id
								   where pa.products_id = '" . $order->products[$i]['id'] . "'
								   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $languages_id . "'";
			  $attributes = tep_db_query($attributes_query);
			} else {
			  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
			}
			$attributes_values = tep_db_fetch_array($attributes);

			$sql_data_array = array('orders_id' => $insert_id,
									'orders_products_id' => $order_products_id,
									'products_options' => $attributes_values['products_options_name'],
									'products_options_values' => $attributes_values['products_options_values_name'],
									'options_values_price' => $attributes_values['options_values_price'],
									'price_prefix' => $attributes_values['price_prefix']);

			tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

			if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
			  $sql_data_array = array('orders_id' => $insert_id,
									  'orders_products_id' => $order_products_id,
									  'orders_products_filename' => $attributes_values['products_attributes_filename'],
									  'download_maxdays' => $attributes_values['products_attributes_maxdays'],
									  'download_count' => $attributes_values['products_attributes_maxcount']);

			  tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
			}
		  }
		}
	  }

	  $cart_PayPal_Standard_ID = $cartID . '-' . $insert_id;
	  tep_session_register('cart_PayPal_Standard_ID');
	}
  }

  return false;
}

function process_button() {
  global $customer_id, $order, $sendto, $currency, $cart_PayPal_Standard_ID, $shipping;

  $process_button_string = '';
  $parameters = array('cmd' => '_xclick',
					  'item_name' => STORE_NAME,
					  'shipping' => $this->format_raw($order->info['shipping_cost']),
					  'tax' => $this->format_raw($order->info['tax']),
					  'business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID,
					  'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']),
					  'currency_code' => $currency,
					  'invoice' => substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1),
					  'custom' => $customer_id,
					  'no_note' => '1',
					  'notify_url' => tep_href_link('ext/modules/payment/paypal/standard_ipn.php', '', 'SSL', false, false),
					  'return' => tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'),
					  'cancel_return' => tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'),
					  'bn' => 'osCommerce22_Default_ST',
					  'paymentaction' => ((MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD == 'Sale') ? 'sale' : 'authorization'));

  if (is_numeric($sendto) && ($sendto > 0)) {
	$parameters['address_override'] = '1';
	$parameters['first_name'] = $order->delivery['firstname'];
	$parameters['last_name'] = $order->delivery['lastname'];
	$parameters['address1'] = $order->delivery['street_address'];
	$parameters['city'] = $order->delivery['city'];
	$parameters['state'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
	$parameters['zip'] = $order->delivery['postcode'];
	$parameters['country'] = $order->delivery['country']['iso_code_2'];
  } else {
	$parameters['no_shipping'] = '1';
	$parameters['first_name'] = $order->billing['firstname'];
	$parameters['last_name'] = $order->billing['lastname'];
	$parameters['address1'] = $order->billing['street_address'];
	$parameters['city'] = $order->billing['city'];
	$parameters['state'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']);
	$parameters['zip'] = $order->billing['postcode'];
	$parameters['country'] = $order->billing['country']['iso_code_2'];
  }

  if (tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE)) {
	$parameters['page_style'] = MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE;
  }

  if (MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS == 'True') {
	$parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID;

	$random_string = rand(100000, 999999) . '-' . $customer_id . '-';

	$data = '';
	reset($parameters);
	while (list($key, $value) = each($parameters)) {
	  $data .= $key . '=' . $value . "\n";
	}

	$fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');
	fwrite($fp, $data);
	fclose($fp);

	unset($data);

	if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
	  openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);

	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');

// remove headers from the signature
	  $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
	  $signed = explode("\n\n", $signed);
	  $signed = base64_decode($signed[1]);

	  $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');
	  fwrite($fp, $signed);
	  fclose($fp);

	  unset($signed);

	  openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);

	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

// remove headers from the encrypted result
	  $data = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	  $data = explode("\n\n", $data);
	  $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';

	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	} else {
	  exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');

	  exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');

	  $fh = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');
	  $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));
	  fclose($fh);

	  unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
	}

	$process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') .
							 tep_draw_hidden_field('encrypted', $data);

	unset($data);
  } else {
	reset($parameters);
	while (list($key, $value) = each($parameters)) {
	  $process_button_string .= tep_draw_hidden_field($key, $value);
	}
  }

  return $process_button_string;
}

function before_process() {
  global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;
  global $$payment;

  $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);

  $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
  if (tep_db_num_rows($check_query)) {
	$check = tep_db_fetch_array($check_query);

	if ($check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
	  $sql_data_array = array('orders_id' => $order_id,
							  'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID,
							  'date_added' => 'now()',
							  'customer_notified' => '0',
							  'comments' => '');

	  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
	}
  }

  tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int)$order_id . "'");

  $sql_data_array = array('orders_id' => $order_id,
						  'orders_status_id' => (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID),
						  'date_added' => 'now()',
						  'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',
						  'comments' => $order->info['comments']);

  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
  $products_ordered = '';
  $subtotal = 0;
  $total_tax = 0;

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
	if (STOCK_LIMITED == 'true') {
	  if (DOWNLOAD_ENABLED == 'true') {
		$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
							FROM " . TABLE_PRODUCTS . " p
							LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
							ON p.products_id=pa.products_id
							LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							ON pa.products_attributes_id=pad.products_attributes_id
							WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
		$products_attributes = $order->products[$i]['attributes'];
		if (is_array($products_attributes)) {
		  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
		}
		$stock_query = tep_db_query($stock_query_raw);
	  } else {
		$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  }
	  if (tep_db_num_rows($stock_query) > 0) {
		$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
		if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
		} else {
		  $stock_left = $stock_values['products_quantity'];
		}
		tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		}
	  }
	}

// Update products_ordered (for bestsellers list)
	tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

//------insert customer choosen option to order--------
	$attributes_exist = '0';
	$products_ordered_attributes = '';
	if (isset($order->products[$i]['attributes'])) {
	  $attributes_exist = '1';
	  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
		if (DOWNLOAD_ENABLED == 'true') {
		  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
							   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
							   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							   on pa.products_attributes_id=pad.products_attributes_id
							   where pa.products_id = '" . $order->products[$i]['id'] . "'
							   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
							   and pa.options_id = popt.products_options_id
							   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
							   and pa.options_values_id = poval.products_options_values_id
							   and popt.language_id = '" . $languages_id . "'
							   and poval.language_id = '" . $languages_id . "'";
		  $attributes = tep_db_query($attributes_query);
		} else {
		  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
		}
		$attributes_values = tep_db_fetch_array($attributes);

		$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
	  }
	}
//------insert customer choosen option eof ----
//BEGIN SEND HTML MAIL//

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
$products_quantity .= nl2br($order->products[$i]['qty'] . "\n");
$products_name .= nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes ."\n");

if (!tep_not_null($order->products[$i]['model'])) {
   $products_model .= ''.EMAIL_NO_MODEL.'';
	 }
else
   $products_model .= nl2br($order->products[$i]['model'] . "\n");


$products_price .= nl2br($currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty']) . "\n");

}


// THIS IS WHERE $Vartaxe IS GENERATED**************

for ($i=0; $i<sizeof($order_totals); $i++) {
$Vartaxe .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

// *********************************************************  

if ($order->content_type != 'virtual') {
$Varaddress .= tep_address_label($customer_id, $sendto, 0, '', "\n");
 }

if (is_object($$payment)) {
$Varmodepay .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$Varmodpay .= $payment_class->title . "\n";
if ($payment_class->email_footer) { 
  $Varmodpay .= $payment_class->email_footer . "\n\n";
}
 }

$Varlogo = ''.VARLOGO.'';
$Vartable1 = ''.VARTABLE1.'';
$Vartable2 = ''.VARTABLE2.'';

$Vartext1 = ' <b>' . EMAIL_TEXT_DEAR . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] .' </b><br>' . EMAIL_MESSAGE_GREETING;
$Vartext2 = '	' . EMAIL_TEXT_ORDER_NUMBER . ' <STRONG> ' . $order_id . '</STRONG><br>' . EMAIL_TEXT_DATE_ORDERED . ': <strong>' . strftime(DATE_FORMAT_LONG) . '</strong><br><a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history_info.php?order_id=' . $order_id .'">' . EMAIL_TEXT_INVOICE_URL . '</a>'; 

$Varmailfooter = ''.VARMAILFOOTER.'';
$VarArticles= ''.EMAIL_TEXT_PRODUCTS_ARTICLES.'';
$VarModele= ''.EMAIL_TEXT_PRODUCTS_MODELE.'';
$VarQte= ''.EMAIL_TEXT_PRODUCTS_QTY .'';
$VarTotal= ''.EMAIL_TEXT_TOTAL.'';
$VarAddresship = ''.EMAIL_TEXT_DELIVERY_ADDRESS.'';
$VarAddressbill = ''.EMAIL_TEXT_BILLING_ADDRESS.'';
$Varmetodpaye = ''.EMAIL_TEXT_PAYMENT_METHOD.'';
$Vardetail = ''.DETAIL .'';
$Varhttp = ''.VARHTTP.'';
$Varstyle = ''.VARSTYLE.'';
$Varshipaddress =''.tep_address_label($customer_id, $sendto).'';



require(DIR_WS_MODULES . 'email/html_checkout_process.php');
$email_order = $html_email_order;

// lets start with the email confirmation
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }



 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}


 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
 $email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $html_email_order;
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
$email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);
 } 

//END SEND HTML MAIL//

// load the after_process function from the payment modules
  $this->after_process();

  $cart->reset(true);

// unregister session variables used during checkout
  tep_session_unregister('sendto');
  tep_session_unregister('billto');
  tep_session_unregister('shipping');
  tep_session_unregister('payment');
  tep_session_unregister('comments');

  tep_session_unregister('cart_PayPal_Standard_ID');

  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
}

function after_process() {
  return false;
}

function output_error() {
  return false;
}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal Standard]' limit 1");

  if (tep_db_num_rows($check_query) < 1) {
	$status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
	$status = tep_db_fetch_array($status_query);

	$status_id = $status['status_id']+1;

	$languages = tep_get_languages();

	foreach ($languages as $lang) {
	  tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Standard]')");
	}

	$flags_query = tep_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag");
	if (tep_db_num_rows($flags_query) == 1) {
	  tep_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
	}
  } else {
	$check = tep_db_fetch_array($check_query);

	$status_id = $check['orders_status_id'];
  }

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Website Payments Standard', 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'False', 'Do you want to accept PayPal Website Payments Standard payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', '', 'The PayPal seller e-mail address to accept payments for', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set PayPal Acknowledged Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gateway Server', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'Live', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '6', 'tep_cfg_select_option(array(\'Live\', \'Sandbox\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Method', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'Sale', 'The processing method to use for each transaction.', '6', '0', 'tep_cfg_select_option(array(\'Authorization\', \'Sale\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Style', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', '', 'The page style to use for the transaction procedure (defined at your PayPal Profile page)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', '', 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'False', 'Do you want to enable Encrypted Web Payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Private Key', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPals Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your PayPal Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Working Directory', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', '', 'The working directory to use for temporary files. (trailing slash needed)', '6', '4', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '4', now())");
}

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
  return array('MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL');
}

// format prices without currency formatting
function format_raw($number, $currency_code = '', $currency_value = '') {
  global $currencies, $currency;

  if (empty($currency_code) || !$this->is_set($currency_code)) {
	$currency_code = $currency;
  }

  if (empty($currency_value) || !is_numeric($currency_value)) {
	$currency_value = $currencies->currencies[$currency_code]['value'];
  }

  return number_format(tep_round($number * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');
}
 }
?>

 

How can I modify paypal_standard.php to show missing information in the email?

 

It would not seem too complicated because the missing data originates from my store and PayPal doesn't(can't) alter any. So we just need to retrieve the relevant data before they are sent to the PayPal server.

 

My guess is that there are two potential reasons for the problem.

 

1. In lines 50-55 of checkout_process.php, it's calling the before_process() routine before calculating order_totals.

However, in paypal_standard.php, it's trying to use order_totals inside the before_process routine, ie. before they're defined.

 

2. $order_totals is being used differently in two files and the following statements are missing from paypal_standard.php

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 

Maybe order_total.php has to be modified also.

Well, so much for guessing.

I'm hoping that you experts can help so that I can finalize this mini version upgrade and allow many PayPal users to use this wonderful contribution.

 

Any suggestions, advice and opinions on resolving the problem would be highly appreciated.

 

Susan

Edited by Jan Zonjee
Link to comment
Share on other sites

@Dave

 

i couldnt see the define variable for DIR_WS_CATALOG in your configure.php file

 

only found

define('DIR_WS_HTTP_CATALOG', '/bijoux/osc/');

please try following

 

in

languages/FRENCH(OR YOUR LANGUAGE)/checkout_process.php

 

change

 

define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">'); //location of email css file.
define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'); //Do not change

 

to

define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">'); //location of email css file.
define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_HTTP_WS_CATALOG . '">'); //Do not change

 

then check in modules/email/html_checkout_process.php that you have changed back

 

$html_email_order .= "<base href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\"><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetmail.css\">";							OK
$html_email_order .= "$Varhttp ";
$html_email_order .= "$Varstyle ";

 

to

 

$html_email_order .= "$Varhttp ";
$html_email_order .= "$Varstyle ";

 

That should work

Link to comment
Share on other sites

@ Susan

 

for me personel it would make more sense to include the email part into

 

function confirmation() {

 

below

$cart_PayPal_Standard_ID = $cartID . '-' . $insert_id;

tep_session_register('cart_PayPal_Standard_ID');

 

instead of the position where it is located yet

 

But i´m not sure, i´m not using PayPal IPN ;)

Link to comment
Share on other sites

@Dave

 

i couldnt see the define variable for DIR_WS_CATALOG in your configure.php file

 

only found

define('DIR_WS_HTTP_CATALOG', '/bijoux/osc/');

please try following

 

in

languages/FRENCH(OR YOUR LANGUAGE)/checkout_process.php

 

change

 

define('VARMAILFOOTER', '' . EMAIL_TEXT_FOOTER . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a><br>' . EMAIL_TEXT_COPYRIGHT . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'. STORE_NAME .'</a> ');  //footer
define('VARLOGO', '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><IMG src="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . STORE_LOGO .'" border=0></a> ');   //logo
define('VARTABLE1', '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="' . COLOR_TOP_EMAIL . '"   background="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . BG_TOP_EMAIL . '"> ');   //Header table formatting
define('VARTABLE2', '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="' . COLOR_TABLE . '"   background="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . BG_TABLE . '">');

 

i can change the logo, the colors but i don't no why , i can't access the stylesheetmail ...

 

Can you show how to put the stylesheetmail in the checkout_process ? (fuck i'am sure the problem is so weak but i can't put my finger on it....)

Link to comment
Share on other sites

  • 1 month later...

The shipping and billing adresses are swapped in the confirmation email (V2). The values are right (i.e. when I print the bill/label the shipping adress, really is in the shipping address) but they are displayed incorrectly in the confirmation email. This leads to many customers calling in and asking us to switch them back.

Where do I change the "headings" around so, that the shipping adress is displayed below the heading "shipping adress"?

 

Thank you for help, I have real trouble solving this!

Open Source Newsletter: PhPList

Open Source Questionnaire: Lime Survey

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Hello! Great contribution! I've installed and all seems to be working well, except the item name, quantity, and price don't show up in the order confirmation email. However, the attributes do. Here is my code:

 

checkout_process.php

 

<?php
/*
 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 if (!tep_session_is_registered('sendto')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 if ($credit_covers) $payment=''; // CCGV
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;



 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 // load the before_process function from the payment modules
 $payment_modules->before_process();



 $sql_data_array = array('customers_id' => $customer_id,
					  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
					  'customers_company' => $order->customer['company'],
					  'customers_street_address' => $order->customer['street_address'],
					  'customers_suburb' => $order->customer['suburb'],
					  'customers_city' => $order->customer['city'],
					  'customers_postcode' => $order->customer['postcode'], 
					  'customers_state' => $order->customer['state'], 
					  'customers_country' => $order->customer['country']['title'], 
					  'customers_telephone' => $order->customer['telephone'], 
					  'customers_email_address' => $order->customer['email_address'],
					  'customers_address_format_id' => $order->customer['format_id'], 
					  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
					  'delivery_company' => $order->delivery['company'],
					  'delivery_street_address' => $order->delivery['street_address'], 
					  'delivery_suburb' => $order->delivery['suburb'], 
					  'delivery_city' => $order->delivery['city'], 
					  'delivery_postcode' => $order->delivery['postcode'], 
					  'delivery_state' => $order->delivery['state'], 
					  'delivery_country' => $order->delivery['country']['title'], 
					  'delivery_address_format_id' => $order->delivery['format_id'], 
					  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
					  'billing_company' => $order->billing['company'],
					  'billing_street_address' => $order->billing['street_address'], 
					  'billing_suburb' => $order->billing['suburb'], 
					  'billing_city' => $order->billing['city'], 
					  'billing_postcode' => $order->billing['postcode'], 
					  'billing_state' => $order->billing['state'], 
					  'billing_country' => $order->billing['country']['title'], 
					  'billing_address_format_id' => $order->billing['format_id'], 
					  'payment_method' => $order->info['payment_method'], 
					  'cc_type' => $order->info['cc_type'], 
					  'cc_owner' => $order->info['cc_owner'], 
					  'cc_number' => (substr_replace($order->info['cc_number'], ' XXXX XXXX ', 4, -4)),
					  'cc_expires' => $order->info['cc_expires'], 
					  'date_purchased' => 'now()', 
					  'orders_status' => $order->info['order_status'], 
					  'currency' => $order->info['currency'], 
					  'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
						'title' => $order_totals[$i]['title'],
						'text' => $order_totals[$i]['text'],
						'value' => $order_totals[$i]['value'], 
						'class' => $order_totals[$i]['code'], 
						'sort_order' => $order_totals[$i]['sort_order']);
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
					  'orders_status_id' => $order->info['order_status'], 
					  'date_added' => 'now()', 
					  'customer_notified' => $customer_notification,
					  'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
  if (DOWNLOAD_ENABLED == 'true') {
	$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
						FROM " . TABLE_PRODUCTS . " p
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						 ON p.products_id=pa.products_id
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						 ON pa.products_attributes_id=pad.products_attributes_id
						WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
	$products_attributes = $order->products[$i]['attributes'];
	if (is_array($products_attributes)) {
	  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	}
	$stock_query = tep_db_query($stock_query_raw);
  } else {
	$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
  }
  if (tep_db_num_rows($stock_query) > 0) {
	$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
	  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	} else {
	  $stock_left = $stock_values['products_quantity'];
	}
	tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
  }
}

// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

$sql_data_array = array('orders_id' => $insert_id, 
						'products_id' => tep_get_prid($order->products[$i]['id']), 
						'products_model' => $order->products[$i]['model'], 
						'products_name' => $order->products[$i]['name'], 
						'products_price' => $order->products[$i]['price'], 
						'final_price' => $order->products[$i]['final_price'], 
						'products_tax' => $order->products[$i]['tax'], 
						'products_quantity' => $order->products[$i]['qty']);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
$order_total_modules->update_credit_account($i);// CCGV
//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
  $attributes_exist = '1';
  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	if (DOWNLOAD_ENABLED == 'true') {
	  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
						   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
						   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							on pa.products_attributes_id=pad.products_attributes_id
						   where pa.products_id = '" . $order->products[$i]['id'] . "' 
							and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
							and pa.options_id = popt.products_options_id 
							and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
							and pa.options_values_id = poval.products_options_values_id 
							and popt.language_id = '" . $languages_id . "' 
							and poval.language_id = '" . $languages_id . "'";
	  $attributes = tep_db_query($attributes_query);
	} else {
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
	}
	$attributes_values = tep_db_fetch_array($attributes);

	$sql_data_array = array('orders_id' => $insert_id, 
							'orders_products_id' => $order_products_id, 
							'products_options' => $attributes_values['products_options_name'],
							'products_options_values' => $attributes_values['products_options_values_name'], 
							'options_values_price' => $attributes_values['options_values_price'], 
							'price_prefix' => $attributes_values['price_prefix']);
	tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

	if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
	  $sql_data_array = array('orders_id' => $insert_id, 
							  'orders_products_id' => $order_products_id, 
							  'orders_products_filename' => $attributes_values['products_attributes_filename'], 
							  'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
							  'download_count' => $attributes_values['products_attributes_maxcount']);
	  tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
	}
	$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
  }
}
//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }
$order_total_modules->apply_credit();// CCGV
//BEGIN SEND HTML MAIL//

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
$products_quantity .= nl2br($order->products[$i]['qty'] . "\n");
$products_name .= nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes ."\n");

if (!tep_not_null($order->products[$i]['model'])) {

   $products_model .= ''.EMAIL_NO_MODEL.'';

	 }

else

   $products_model .= nl2br($order->products[$i]['model'] . "\n");





$products_price .= nl2br($currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty']) . "\n");






for ($i=0; $i<sizeof($order_totals); $i++) {
$Vartaxe .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }


if ($order->content_type != 'virtual') {
$Varaddress .= tep_address_label($customer_id, $sendto, 0, '', "\n");
 }

if (is_object($$payment)) {
$Varmodepay .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$Varmodpay .= $payment_class->title . "\n";
if ($payment_class->email_footer) { 
  $Varmodpay .= $payment_class->email_footer . "\n\n";
}
 }

$Varlogo = ''.VARLOGO.'';
$Vartable1 = ''.VARTABLE1.'';
$Vartable2 = ''.VARTABLE2.'';

$Vartext1 = ' ' . EMAIL_TEXT_DEAR . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] .':<br>' . EMAIL_MESSAGE_GREETING;
$Vartext2 = '	' . EMAIL_TEXT_ORDER_NUMBER . ' <STRONG> ' . $insert_id . '</STRONG><br>' . EMAIL_TEXT_DATE_ORDERED . ': <strong>' . strftime(DATE_FORMAT_LONG) . '</strong><br><a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history_info.php?order_id=' . $insert_id .'">' . EMAIL_TEXT_INVOICE_URL . '</a>'; 

$Varmailfooter = ''.VARMAILFOOTER.'';
$VarArticles= ''.EMAIL_TEXT_PRODUCTS_ARTICLES.'';
$VarModele= ''.EMAIL_TEXT_PRODUCTS_MODELE.'';
$VarQte= ''.EMAIL_TEXT_PRODUCTS_QTY .'';
$VarTotal= ''.EMAIL_TEXT_TOTAL.'';
$VarAddresship = ''.EMAIL_TEXT_DELIVERY_ADDRESS.'';
$VarAddressbill = ''.EMAIL_TEXT_BILLING_ADDRESS.'';
$Varmetodpaye = ''.EMAIL_TEXT_PAYMENT_METHOD.'';
$Vardetail = ''.DETAIL .'';
$Varhttp = ''.VARHTTP.'';
$Varstyle = ''.VARSTYLE.'';
$Varshipaddress =''.tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>').'';

$Varadpay =''.tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>').'';



require(DIR_WS_MODULES . 'email/html_checkout_process.php');
$email_order = $html_email_order;

// lets start with the email confirmation
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}


$new_mail_subject = EMAIL_TEXT_SUBJECT . ' ' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id;
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], $new_mail_subject, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);




 $email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $html_email_order;
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+	$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n\n\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
					HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
					EMAIL_TEXT_FOOTERR . "\n";

}
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT .' [NEW ORDER] ' .EMAIL_TEXT_ORDER_NUMBER.' '. $insert_id ,
nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
$email_order=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $email_order);
 } 

//END SEND HTML MAIL//

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');
 if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');// CCGV
 $order_total_modules->clear_posts();// CCGV

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

html_checkout_process.php

 

<?php
$html_email_order = "<html>";
$html_email_order .= "<head>";
$html_email_order .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> ";
$html_email_order .= "$Varhttp ";
$html_email_order .= "$Varstyle ";
$html_email_order .= "</head>";
$html_email_order .= "<body>";
$html_email_order .= "<table width=\"600\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$html_email_order .= "	<tr>";
$html_email_order .= " 		<td><table width=\"600\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$html_email_order .= " 			 <tr> ";
$html_email_order .= "				<td>$Vartable1";
$html_email_order .= "					<tr> ";
$html_email_order .= "		 				<td><font face=\"verdana, arial\" size=\"-1\">$Varlogo</font></td>";
$html_email_order .= "					</tr>";
$html_email_order .= "	 			</table></td>";
$html_email_order .= "		  </tr>";
$html_email_order .= "		  <tr> ";
$html_email_order .= "				<td>$Vartable2 ";
$html_email_order .= "			<tr> ";
$html_email_order .= "			  <td class=\"main\">$Vartext1</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr height=\"14\"  class=\"detail\"> ";
$html_email_order .= "			  <td height=\"14\"> </td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr class=\"detail\"> ";
$html_email_order .= "			  <td class=\"main\">$Vartext2</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr height=\"14\"> ";
$html_email_order .= "			  <td height=\"14\"> </td>";
$html_email_order .= "			</tr>";
$html_email_order .= "		</table></td>";
$html_email_order .= "	</tr>";
$html_email_order .= "	<tr>";
$html_email_order .= "   	<td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "			<tr> ";
$html_email_order .= "			  <td class=\"boxmail\" align=\"left\" width=\"300\">$VarArticles</td>";
$html_email_order .= "			  <td class=\"boxmail\" align=\"left\" width=\"160\">$VarModele</td>";
$html_email_order .= "			  <td class=\"boxmail\" align=\"center\" width=\"40\">$VarQte</td>";
$html_email_order .= "			  <td class=\"boxmail\" align=\"right\" width=\"100\">$VarTotal</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr> ";
$html_email_order .= "			  <td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_name</td>";
$html_email_order .= "			  <td width=\"160\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_model</td>";
$html_email_order .= "			  <td width=\"40\"  valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_quantity</td>";
$html_email_order .= "			  <td width=\"100\" valign=\"top\" align=\"right\" class=\"boxmailgris\">$products_price</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr height=\"14\"> ";
$html_email_order .= "			  <td height=\"14\" width=\"300\" valign=\"top\" align=\"left\" class=\"tableur\">$Vardetail</td>";
$html_email_order .= "			  <td colspan=\"3\" width=\"300\" valign=\"top\" align=\"right\" class=\"tableur\">$Vartaxe</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "	  </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "  <tr>";
$html_email_order .= "	  <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "	   	<tr> ";
$html_email_order .= "			  <td width=\"300\" class=\"boxmail\">$VarAddresship</td>";
$html_email_order .= "			  <td width=\"300\" class=\"boxmail\">$VarAddressbill</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "			<tr> ";
$html_email_order .= "		 		<td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$Varshipaddress</td>";
$html_email_order .= "		 		<td width=\"300\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$Varadpay</td> ";
$html_email_order .= "			</tr>";
$html_email_order .= "	   </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "  <tr>";
$html_email_order .= "		 <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "			<tr> ";
$html_email_order .= "		 		<td class=\"boxmail\">$Varmetodpaye</td>";
$html_email_order .= "			</tr>";
$html_email_order .= "	   	 <tr> ";
$html_email_order .= "			  <td class=\"boxmailgris\">$Varmodpay</td> ";
$html_email_order .= "			</tr>";
$html_email_order .= "	   </table></td>";
$html_email_order .= " 	</tr>";
$html_email_order .= "  <tr>";
$html_email_order .= " 		 <td><table width=\"600\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=white>";
$html_email_order .= "	   	<tr height=\"14\"> ";
$html_email_order .= "		 		<td height=\"14\"> </td>";
$html_email_order .= "	   	</tr>";
$html_email_order .= "	   	<tr class=\"main\"> ";
$html_email_order .= "			  <td class=\"footer\">$Varmailfooter</td> ";
$html_email_order .= "			</tr>";
$html_email_order .= "	  </table></td>";
$html_email_order .= "  </tr>";
$html_email_order .= "</table></td>";
$html_email_order .= "</tr>";
$html_email_order .= "</table>";
$html_email_order .= "</body>";
$html_email_order .= "</html>";
?>

 

Any help would be appreciated! Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I've just installed the latest version of this module and although the emails are much better than the stock OSCommerce output, I'm having problems with the stylesheet - no matter what changes I make to it, there's no change to the email that is sent out - the column headings and background colour remain the same, as do the font and font size. I tried using a different browser because I thought my browser may be storing the stylesheet settings somewhere, but no luck. I've even tried totally deleting the stylesheetmail.css file and I still get a formatted email!!! Is there something I'm missing here?

 

Also, having tussled with HTML emails in the past I have some concerns about compatibility - I'm given to understand that using CSS in emails is a no-no and a lot of web-based email viewers will ignore this information totally. Does anyone have any information on how cross-compatible this contribution is, will it render as well in Outlook, Mac Mail, Thunderbird and also in Hotmail, GMail etc etc?

Link to comment
Share on other sites

UPDATE - I've just checked an order confirmation using me.com browser webmail (Apple's mac.com system) and it's not rendering properly - no background colours in the table headings. I think this module might work better with inline CSS?

Link to comment
Share on other sites

  • 3 months later...

Wow this is a great contribution. I have 2 little issues. The first one is when I update an order the company logo doesn't show up in the email, just a RED "X".

 

The other issue is that at the bottom of the email is show a copyright notice and then a link to my site. The link doesn't work. It gives this

http://www.mysite.comdir_ws_http_catalog/

 

How do I fix these.

 

Thanks

Edited by Zachary
Link to comment
Share on other sites

Ok, got it fixed. My php prof. looked at my admin config file, and said I needed to add

 

define('DIR_WS_HTTP_CATALOG', '/YOUR-CATALOG'S-FOLDER-NAME/');

 

I added it to the file and did an update to the order and all is working now.

Link to comment
Share on other sites

  • 4 weeks later...

Hi All,

 

Anyone else had the product image missing in email only every now and then seems the . is missing between name and extension ie imagejpg

 

doesnt do this all the time i installed the additional row mods addtions

 

Anyone able to help out on this strange bug?

 

Steve

Link to comment
Share on other sites

Instaled:

+ Order Editor (orders.php + edit_orders.php)

+ Manual Order Maker

+ Send HTML Email V2.

 

little problems when receiving emails text:

 

On email invoive link (EMAIL_TEXT_INVOICE_URL):

The link is incorrect.

Or the order status update http://www.myweb.com/account_history_info.php?order_id= (without the order number)

or the new order-made http://www.myweb.com/admin/FILENAME_ACCOUNT_HISTORY_INFO?order_id=59 (without the define)

 

twice bad.

 

these corresponds to vartex2:

$Vartext2 = '    ' . EMAIL_TEXT_ORDER_NUMBER . ' <STRONG> ' . $oID . '</STRONG><br>' . EMAIL_TEXT_DATE_ORDERED . ': <strong>' . strftime(DATE_FORMAT_LONG) . '</strong><br><a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history_info.php?order_id=' . $insert_id .'">' . EMAIL_TEXT_INVOICE_URL . '</a>' ; 

 

Also down a extrange simbol %s.

 

Other time the comments dissapear for the text EMAIL_TEXT_COMMENTS_UPDATE

 

Can anyone help me.

Link to comment
Share on other sites

Corrected in admin/includes/languages/xxx/order.php and edit_order.php: (the simbol %s)

Replaced

define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are' . "\n\n%s\n\n");

for

define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are' . "\n\n");

 

 

 

 

 

Corrected in admin/order.php and edit_order.php: (appears as EMAIL_TEXT_COMMENTS_UPDATE)

Replaced

$Varbody = EMAIL_TEXT_COMMENTS_UPDATE . ' ' . $comments . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

for

$Varbody = EMAIL_TEXT_COMMENTS_UPDATE_HTML . ' ' . $comments . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

 

 

 

Corrected not to receive the followin rare text:

VARTABLE1

VARLOGO

VARTABLE2 EMAILGREET_MS

EMAILWELCOMEEMAILTEXTEMAILCONTACTEMAILWARNING

EMAIL_TEXT_FOOTER

 

Copied the following text in admin/includes/languages/xxx/order.php and edit_order.php(before the ?> tag):

 

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT', 'Su pedido ha cambiado de estado.');
define('EMAIL_TEXT_ORDER_NUMBER', 'Pedido Nº:');
define('EMAIL_TEXT_INVOICE_URL', 'Pedido Detallado:');
define('EMAIL_TEXT_DATE_ORDERED', 'Fecha del Pedido');
define('EMAIL_TEXT_STATUS_UPDATE', 'Su pedido ha sido actualizado al siguiente estado.' . "\n\n" . '<font color="#ff6600"><b>Nuevo estado: %s</b></font>' . "\n\n" . 'Por favor responda a este email si tiene alguna pregunta que hacer.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE', '<b>Comentarios del Sr.José Manuel:</b>' . "\n\n%s\n\n");

//BEGIN SEND HTML MAIL//

// Email style
define('STORE_LOGO', 'BLACKHOLE_BILBAO.jpg'); // Your shop logo (location: /catalog/images).
define('BG_TOP_EMAIL', 'pixel_trans.gif');    //Header background image.
define('COLOR_TOP_EMAIL', '#ffffff');         //Background color of the email header (only visible if no background image)
define('BG_TABLE', 'carta.gif');         //background image of the email body
define('COLOR_TABLE', '#f9f9f9');         //background color of the email body (only visible if no background image)

//First section of text
define('EMAIL_TEXT_DEAR', '<br><br>Notificación para');        
define('EMAIL_MESSAGE_GREETING', 'Queremos notificarle que su pedido ha cambiado de estado.'); 

//Email Footer
define('EMAIL_TEXT_FOOTER', 'Este email nos lo proporciono uno de nuestros clientes. Si cree que ha recibido este email por error, por favor mande un email a ');    
define('EMAIL_TEXT_COPYRIGHT', 'Blackhole Bilbao © 2009 ');


//Define Variables
define('VARSTYLE', '<link rel="stylesheet" type="text/css" href="stylesheetmail.css">');   //location of email css file.
define('VARHTTP', '<base href="' . HTTP_SERVER . DIR_WS_CATALOG . '">');   //Do not change
define('VARMAILFOOTER', '' . EMAIL_TEXT_FOOTER . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a><br>' . EMAIL_TEXT_COPYRIGHT . '<a align="center" href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'. STORE_NAME .'</a> ');  //footer
define('VARLOGO', '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><IMG src="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . STORE_LOGO .'" border=0></a> ');   //logo
define('VARTABLE1', '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="' . COLOR_TOP_EMAIL . '"   background="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . BG_TOP_EMAIL . '"> ');   //Header table formatting

define('VARTABLE2', '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="' . COLOR_TABLE . '"   background="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . BG_TABLE . '">');   //Body table formatting

//END SEND HTML MAIL//

 

P.d: also looked to have installed the database tables eorder_text

 

CREATE TABLE IF NOT EXISTS `eorder_text` (
 `eorder_text_id` tinyint(3) unsigned NOT NULL default '0',
 `language_id` tinyint(3) unsigned NOT NULL default '1',
 `eorder_text_one` text NOT NULL,
 PRIMARY KEY  (`eorder_text_id`,`language_id`)
) ;

INSERT INTO `eorder_text` VALUES (1, 1, '<-STORE_NAME->\r\n------------------------------------------------------\r\nOrder number: <-insert_id->\r\n(Please quote this number in any enquiries)\r\n\r\nInvoice details: \r\n<-INVOICE_URL->\r\n\r\nDate ordered: <-DATE_ORDERED->\r\n\r\nComments: <-Customer_Comments->\r\n\r\nItems\r\n------------------------------------------------------\r\n<-Item_List->\r\n\r\n------------------------------------------------------\r\n<-List_Total->\r\n\r\nBilling Address\r\n------------------------------------------------------\r\n<-BILL_Adress->\r\n\r\nDelivery Address\r\n------------------------------------------------------\r\n<-DELIVERY_Adress->\r\n\r\nPayment Method\r\n------------------------------------------------------\r\n<-Payment_Modul_Text->\r\n\r\n<-Payment_Modul_Text_Footer->');
INSERT INTO `eorder_text` VALUES (1, 2, '<-STORE_NAME->\r\n------------------------------------------------------\r\nBestellnummer: <-insert_id->\r\n(Bitte bei Zahlungen und Anfragen stets angeben)\r\n\r\nDetailierte Bestellbersicht: \r\n<-INVOICE_URL->\r\n\r\nBestelldatum: <-DATE_ORDERED->\r\n\r\nKommentar: <-Customer_Comments->\r\n\r\nArtikel\r\n------------------------------------------------------\r\n<-Item_List->\r\n\r\n------------------------------------------------------\r\n<-List_Total->\r\n\r\nRechnungsanschrift\r\n------------------------------------------------------\r\n<-BILL_Adress->\r\n\r\nLieferung\r\n------------------------------------------------------\r\n<-DELIVERY_Adress->\r\n\r\nZahlungsweise\r\n------------------------------------------------------\r\n<-Payment_Modul_Text->\r\n\r\n<-Payment_Modul_Text_Footer->');
INSERT INTO `eorder_text` VALUES (1, 3, '<-STORE_NAME->\r\n------------------------------------------------------\r\nBestellnummer: <-insert_id->\r\n(Bitte bei Zahlungen und Anfragen stets angeben)\r\n\r\nDetailierte Bestellbersicht: \r\n<-INVOICE_URL->\r\n\r\nBestelldatum: <-DATE_ORDERED->\r\n\r\nKommentar: <-Customer_Comments->\r\n\r\nArtikel\r\n------------------------------------------------------\r\n<-Item_List->\r\n\r\n------------------------------------------------------\r\n<-List_Total->\r\n\r\nRechnungsanschrift\r\n------------------------------------------------------\r\n<-BILL_Adress->\r\n\r\nLieferung\r\n------------------------------------------------------\r\n<-DELIVERY_Adress->\r\n\r\nZahlungsweise\r\n------------------------------------------------------\r\n<-Payment_Modul_Text->\r\n\r\n<-Payment_Modul_Text_Footer->');
INSERT INTO `eorder_text` VALUES (2, 1, '<table id="AutoNumber3" cellspacing="0" cellpadding="10" width="100%" border="0" style="border-collapse: collapse"><tbody><tr><td width="100%"><font face="Arial"><strong><-STORE_NAME-><br /><br /><font size="2">Thank you for your custom!</font></strong></font><hr align="left" color="#000000" style="width: 281px; height: 1px" /> <p><font face="Arial"><font size="2">Your order number:</font> <strong><font size="2"><-insert_id-></font><br /></strong><em><font size="1">(Please quote your order number in any enquiry)</font></em></font></p><p><font face="Arial"><font size="2">Order Details: </font><br /><strong><font size="1"><-INVOICE_URL-></font></strong></font></p><p><font face="Arial" size="2">Date Ordered: <strong><-DATE_ORDERED-></strong></font></p><p><strong><font face="Arial" color="#ff0000"><br /><font size="2">Items ordered:</font></font></strong></p><table id="AutoNumber2" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse"><tbody><tr><td width="100%" style="border-top-width: 1px; border-left-width: 1px; border-bottom: 1px solid; border-right-width: 1px"><font face="Arial"><-Item_List-></font></td></tr><tr><td width="100%"><b><font face="Arial"><-List_Total-></font></b></td></tr> </tbody></table><p> Comments: <-Customer_Comments-></p></td></tr></tbody> </table> <table id="AutoNumber1" cellspacing="0" cellpadding="10" border="0" style="border-collapse: collapse">     <tbody><tr><td valign="top" width="50%"><font face="Arial" size="2"><b><font color="#ff0000">Billing Address:<br />             </font></b></font><font face="Arial" size="2"><-BILL_Adress-></font></td><td valign="top" width="50%"><font face="Arial" color="#ff0000"><b><font size="2">Delivery Address:<br /></font></b></font><font face="Arial" size="2"><-DELIVERY_Adress-></font></td></tr></tbody> </table> <table id="AutoNumber4" cellspacing="0" cellpadding="10" width="100%" border="0" style="border-collapse: collapse"><tbody><tr><td width="100%"><font face="Arial" size="2"><b><font color="#ff0000">Payment Method:</font></b><br /><-Payment_Modul_Text-></font><p><font face="Arial" size="2"><-Payment_Modul_Text_Footer-></font></p></td></tr></tbody></table><table><tbody><tr><td><b>Terms and conditions</b><br /><font size="1">Your right to cancel:<p>We hope you will be happy with the products you have ordered, but in case you would like to return anything, these are your cancellation rights:</p><p>Under the United Kingdom''s Distance Selling Regulations, you generally have the right to cancel the contract and ask for a refund for items bought online within a period of 7 working days, beginning with the day after the day on which the item is delivered. This does not apply to video, DVD, audio, video games and software products where the item has been unsealed. Downloadable digital items cannot be cancelled or returned once downloading has commenced.</p><p>If you wish to cancel this contract, please pack the relevant item securely and send it back to us so that we receive it within 7 working days after the day of the date that the item was delivered to you. We recommend that you use a recorded-delivery service as if we do not receive them we will be unable to offer you a refund. Please note that you are responsible for the cost of return postage unless we sent you the wrong item or it is faulty.</p><p>We will refund the relevant part of the purchase price for the returned items provided they arrive within the cancellation period and, in the case of music, software and games have not been unsealed or opened.</p></p></font></td></tr><tr><td align="center"><font size="2"><p><-STORE_NAME-><br />Your store Address<br />Store Town<br />Store Postcode<br /><br />Store Tel<br />Store Email <br /> </p></font></td></tr></tbody> </table>');
INSERT INTO `eorder_text` VALUES (2, 3, '<TABLE id=AutoNumber3 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 width="100%" border=0> <TBODY> <TR> <TD width="100%"><FONT face=Arial><STRONG><-STORE_NAME-><BR><BR><FONT size=2>Vielen Dank fr Ihre Bestellung!</FONT></STRONG></FONT>  <HR style="WIDTH: 281px; HEIGHT: 1px" align=left color=#000000>  <P><FONT face=Arial size=2></FONT><FONT face=Arial><FONT size=2>  Ihre Bestellnummer:</FONT> <STRONG><FONT size=2><-insert_id-></FONT><BR></STRONG><EM><FONT size=1>(Bitte bei Zahlungen und Anfragen stets angeben)</FONT></EM></FONT></P> <P><FONT face=Arial size=2></FONT><FONT face=Arial><FONT size=2>  Ihre Detailierte Bestellbersicht: </FONT><BR><STRONG><FONT size=1><-INVOICE_URL-></FONT></STRONG></FONT></P> <P><FONT face=Arial size=2>  Ihr Bestelldatum: <STRONG><-DATE_ORDERED-></STRONG></FONT></P> <P><STRONG><FONT face=Arial color=#ff0000><BR><FONT size=2>Ihre bestellten Artikel:</FONT></FONT></STRONG></P> <TABLE id=AutoNumber2 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD style="BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-BOTTOM: 1px solid; BORDER-RIGHT-WIDTH: 1px" width="100%"><FONT face=Arial><-Item_List-></FONT></TD></TR> <TR> <TD width="100%"><B><FONT face=Arial><-List_Total-></FONT></B></TD></TR></TBODY></TABLE> <P> </P></TD></TR></TBODY></TABLE> <TABLE id=AutoNumber1 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 border=0> <TBODY> <TR> <TD vAlign=top width="50%"><FONT face=Arial size=2><B><FONT color=#ff0000>Ihre Rechnungsanschrift:<BR></FONT></B></FONT><FONT face=Arial size=2><B><FONT color=#ff0000><BR><BR></FONT></B><-BILL_Adress-></FONT></TD> <TD vAlign=top width="50%"><FONT face=Arial color=#ff0000><B><FONT size=2>Ihre Lieferanschrift:<BR></FONT></B></FONT><FONT face=Arial color=#ff0000><B><FONT size=2><BR><BR></FONT></B></FONT><FONT face=Arial size=2><-DELIVERY_Adress-></FONT></TD></TR></TBODY></TABLE> <TABLE id=AutoNumber4 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 width="100%" border=0> <TBODY> <TR> <TD width="100%"><FONT face=Arial size=2><B><FONT color=#ff0000>Zahlungsweise:<BR><BR></FONT></B><BR><BR><BR><-Payment_Modul_Text-></FONT>  <P><FONT face=Arial size=2><-Payment_Modul_Text_Footer-></FONT></P></TD></TR></TBODY></TABLE>');
INSERT INTO `eorder_text` VALUES (2, 2, '<TABLE id=AutoNumber3 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 width="100%" border=0> <TBODY> <TR> <TD width="100%"><FONT face=Arial><STRONG><-STORE_NAME-><BR><BR><FONT size=2>Vielen Dank fr Ihre Bestellung!</FONT></STRONG></FONT>  <HR style="WIDTH: 281px; HEIGHT: 1px" align=left color=#000000>  <P><FONT face=Arial size=2></FONT><FONT face=Arial><FONT size=2>  Ihre Bestellnummer:</FONT> <STRONG><FONT size=2><-insert_id-></FONT><BR></STRONG><EM><FONT size=1>(Bitte bei Zahlungen und Anfragen stets angeben)</FONT></EM></FONT></P> <P><FONT face=Arial size=2></FONT><FONT face=Arial><FONT size=2>  Ihre Detailierte Bestellbersicht: </FONT><BR><STRONG><FONT size=1><-INVOICE_URL-></FONT></STRONG></FONT></P> <P><FONT face=Arial size=2>  Ihr Bestelldatum: <STRONG><-DATE_ORDERED-></STRONG></FONT></P> <P><FONT face=Arial size=2>  Kommentar: <STRONG><-Customer_Comments-></STRONG></FONT></P> <P><STRONG><FONT face=Arial color=#ff0000><BR><FONT size=2>Ihre bestellten Artikel:</FONT></FONT></STRONG></P> <TABLE id=AutoNumber2 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD style="BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-BOTTOM: 1px solid; BORDER-RIGHT-WIDTH: 1px" width="100%"><FONT face=Arial><-Item_List-></FONT></TD></TR> <TR> <TD width="100%"><B><FONT face=Arial><-List_Total-></FONT></B></TD></TR></TBODY></TABLE> <P> </P></TD></TR></TBODY></TABLE> <TABLE id=AutoNumber1 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 border=0> <TBODY> <TR> <TD vAlign=top width="50%"><FONT face=Arial size=2><B><FONT color=#ff0000>Ihre Rechnungsanschrift:<BR></FONT></B></FONT><FONT face=Arial size=2><B><FONT color=#ff0000><BR><BR></FONT></B><-BILL_Adress-></FONT></TD> <TD vAlign=top width="50%"><FONT face=Arial color=#ff0000><B><FONT size=2>Ihre Lieferanschrift:<BR></FONT></B></FONT><FONT face=Arial color=#ff0000><B><FONT size=2><BR><BR></FONT></B></FONT><FONT face=Arial size=2><-DELIVERY_Adress-></FONT></TD></TR></TBODY></TABLE> <TABLE id=AutoNumber4 style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=10 width="100%" border=0> <TBODY> <TR> <TD width="100%"><FONT face=Arial size=2><B><FONT color=#ff0000>Zahlungsweise:<BR><BR></FONT></B><BR><BR><BR><-Payment_Modul_Text-></FONT>  <P><FONT face=Arial size=2><-Payment_Modul_Text_Footer-></FONT></P></TD></TR></TBODY></TABLE>');

 

Remains the EMAIL_TEXT_INVOICE_URL bug.

Can anyone help me?

Link to comment
Share on other sites

The above solutions are DISABLING USE HTML AJAX in configuration (using edit_orders.php).

 

If I ENABLE USE HTML AJAX (edit_orders_ajax.php) this doesn´t work. The email is send but the queries are blank. ¿?

 

Example:

Dear JOSE GARCIA

We would like to notify you that the status of your order has been update.

 

Order Number:

Date Ordered:: Wednesday 23 December, 2009

Detailed Invoice:

 

EMAIL_TEXT_COMMENTS_UPDATE_HTML

 

Thank you so much for your order with us!

 

The status of your order has been updated.

 

New status:

 

 

.......

Link to comment
Share on other sites

Thanks for taking a look at this people! Im a bit overwhelmed with this installation. I have a heavily modified shop, and the checkout_process editing is getting the best of me. Ill post my code below, could someone edit this or help in some other way. I simply cant handle this myself, apparently.

 

   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
   $total_cost += $total_products_price;

   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
// GOOGLE ANALYTICS  BOF

session_register('google_analytics');

$_SESSION['google_analytics'] = 'UTM:T|'. 
$insert_id .
'|Web Sales|'.$order->info['total'].'|'.
$order->info['tax'].'|'.
$order->info['shipping_cost'].'|'.
$order->customer['city'].'|'.
$order->customer['state'].'|'.
$order->customer['country']['iso_code_2']."\n".$google_analytics; 


// GOOGLE ANALYTICS  EOF

 }

// Start - CREDIT CLASS Gift Voucher Contribution
 $order_total_modules->apply_credit();
// End - CREDIT CLASS Gift Voucher Contribution

// lets start with the email confirmation
// START HTML Invoice
 if (EMAIL_INVOICE == 'true') {
   require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE);
 } else {
// END HTML Invoice
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }
/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */
 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                    $sendToFormatted . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $order->info['payment_method'] . "\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 

Hopefully you can see why Im frustrated. My eyes feel like they are bleeding from staring at this for so long. Any help is appreciated. Thanks again!

Link to comment
Share on other sites

The above solutions are DISABLING USE HTML AJAX in configuration (using edit_orders.php).

 

If I ENABLE USE HTML AJAX (edit_orders_ajax.php) this doesn´t work. The email is send but the queries are blank. ¿?

 

Example:

Dear JOSE GARCIA

We would like to notify you that the status of your order has been update.

 

Order Number:

Date Ordered:: Wednesday 23 December, 2009

Detailed Invoice:

 

EMAIL_TEXT_COMMENTS_UPDATE_HTML

 

Thank you so much for your order with us!

 

The status of your order has been updated.

 

New status:

 

 

.......

Hi

 

you dont have a define for EMAIL_TEXT_COMMENTS_UPDATE_HTML add that in order.php and order.php to the language files

 

Steve

Link to comment
Share on other sites

Thanks for taking a look at this people! Im a bit overwhelmed with this installation. I have a heavily modified shop, and the checkout_process editing is getting the best of me. Ill post my code below, could someone edit this or help in some other way. I simply cant handle this myself, apparently.

 

   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
   $total_cost += $total_products_price;

   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
// GOOGLE ANALYTICS  BOF

session_register('google_analytics');

$_SESSION['google_analytics'] = 'UTM:T|'. 
$insert_id .
'|Web Sales|'.$order->info['total'].'|'.
$order->info['tax'].'|'.
$order->info['shipping_cost'].'|'.
$order->customer['city'].'|'.
$order->customer['state'].'|'.
$order->customer['country']['iso_code_2']."\n".$google_analytics; 


// GOOGLE ANALYTICS  EOF

 }

// Start - CREDIT CLASS Gift Voucher Contribution
 $order_total_modules->apply_credit();
// End - CREDIT CLASS Gift Voucher Contribution

// lets start with the email confirmation
// START HTML Invoice
 if (EMAIL_INVOICE == 'true') {
   require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE);
 } else {
// END HTML Invoice
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }
/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */
 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                    $sendToFormatted . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $order->info['payment_method'] . "\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 

Hopefully you can see why Im frustrated. My eyes feel like they are bleeding from staring at this for so long. Any help is appreciated. Thanks again!

 

Hi

this is my heavily modified checkout_process.php simply copy it and use winmerge etc to do a file compare you will see where to change for html email, it statrts from the begining of html email

i also have one page checkout installed

 

$Varlogo = ''.VARLOGO.'' ;
$Vartable1 = ''.VARTABLE1.'' ;
$Vartable2 = ''.VARTABLE2.'' ;

$Vartext1 = ' <b>' . EMAIL_TEXT_DEAR . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] .' </b><br>' . EMAIL_MESSAGE_GREETING ;
$Vartext2 = '    ' . EMAIL_TEXT_ORDER_NUMBER . ' <STRONG> ' . $insert_id . '</STRONG><br>' . EMAIL_TEXT_DATE_ORDERED . ': <strong>' . strftime(DATE_FORMAT_LONG) . '</strong><br><a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history_info.php?order_id=' . $insert_id .'">' . EMAIL_TEXT_INVOICE_URL . '</a>' ; 

$Varmailfooter = ''.VARMAILFOOTER.'' ;
$VarArticles= ''.EMAIL_TEXT_PRODUCTS_ARTICLES.'' ;
$VarModele= ''.EMAIL_TEXT_PRODUCTS_MODELE.'' ;
$VarQte= ''.EMAIL_TEXT_PRODUCTS_QTY .'' ;
$VarTotal= ''.EMAIL_TEXT_TOTAL.'' ;
$VarAddresship = ''.EMAIL_TEXT_DELIVERY_ADDRESS.'' ;
$VarAddressbill = ''.EMAIL_TEXT_BILLING_ADDRESS.'' ;
$Varmetodpaye = ''.EMAIL_TEXT_PAYMENT_METHOD.'' ;
$Vardetail = ''.DETAIL .'' ;
$Varhttp = ''.VARHTTP.'';
$Varstyle = ''.VARSTYLE.'';
$Varshipaddress =''.tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>').'';
$Varadpay =''.tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>').'';



require(DIR_WS_MODULES . 'email/html_checkout_process.php');
$email_order = $html_email_order ;

// lets start with the email confirmation
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

/* One Page Checkout - BEGIN */
 $sendToFormatted = tep_address_label($customer_id, $sendto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $sendToFormatted = $onePageCheckout->getAddressFormatted('sendto');
 }

 $billToFormatted = tep_address_label($customer_id, $billto, 0, '', "\n");
 if (ONEPAGE_CHECKOUT_ENABLED == 'True'){
     $billToFormatted = $onePageCheckout->getAddressFormatted('billto');
 }
/* One Page Checkout - END */

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                     $sendToFormatted . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n\n\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
                       HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
                       EMAIL_TEXT_FOOTERR . "\n" ;

}


 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
      count_store_orders();
 $email_order=preg_replace("/[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]/","<a href=\"\\0\">\\0</a>", $email_order);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $html_email_order ;
if (EMAIL_USE_HTML == 'true') {

$email_order;

} 
else

{

$email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
+    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0; $i<sizeof($order_totals); $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                   tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

                 EMAIL_SEPARATOR . "\n" .
                   $billToFormatted . "\n";

 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n\n\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }

 $email_order .= "\n" . EMAIL_TEXT_FOOTER . "\n" .
                       HTTP_SERVER . DIR_WS_CATALOG . "\n" . 
                       EMAIL_TEXT_FOOTERR . "\n" ;

}
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
   $email_order=preg_replace("|[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]|","<a href=\"\\0\">\\0</a>", $email_order);
 } 

//END SEND HTML MAIL//

 

Steve

Link to comment
Share on other sites

OK, looks like I did a pretty good job of editing checkout_process. Thanks for your reply steve. My next issue is related to eorder_text. Im getting this error when I try to send a new order confirmation:

 

1146 - Table 'XXXXXX.eorder_text' doesn't exist

 

SELECT * FROM eorder_text where eorder_text_id = '1' and language_id = '1'

 

As far as I can tell, this is related to "email order text" which I dont have installed. I do have "Send Html Email v2" installed which is referred to in the order editor install directions. Maybe im reading the code wrong, but shouldnt eorder_text not come into play if its not installed? Do I have remnants of other contribs interfering? Am I too strung out with this install to make sense of it? I feel like this is a fairly simple install, and im missing something.

 

Maybe I should start over, its kinda depressing, lol

Edited by Steelworks
Link to comment
Share on other sites

OK, looks like I did a pretty good job of editing checkout_process. Thanks for your reply steve. My next issue is related to eorder_text. Im getting this error when I try to send a new order confirmation:

 

1146 - Table 'XXXXXX.eorder_text' doesn't exist

 

SELECT * FROM eorder_text where eorder_text_id = '1' and language_id = '1'

 

As far as I can tell, this is related to "email order text" which I dont have installed. I do have "Send Html Email v2" installed which is referred to in the order editor install directions. Maybe im reading the code wrong, but shouldnt eorder_text not come into play if its not installed? Do I have remnants of other contribs interfering? Am I too strung out with this install to make sense of it? I feel like this is a fairly simple install, and im missing something.

 

Maybe I should start over, its kinda depressing, lol

Im using 2.1 and i don't see any reference to that, simply upload order.php or use a file compare tool

 

Steve

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...