[TEP-COMMIT] [CVS catalog] the new checkout process module to handle the processing logic

hpdl-OfajU3CKLf1/[email protected] 30 Mar 2005 00:11:05 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes/modules/checkout</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1"><span id="added">process.php</span></a></tt></td><td align="right" id="added">+352</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/process.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
</table>
<pre class="comment">
the new checkout process module to handle the processing logic
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules">modules</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout">checkout</a><br /></span>
<div class="fileheader" id="added"><big><b>process.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/process.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N process.php
--- /dev/null	Wed Mar 30 02:10:48 2005
+++ /tmp/cvsAAAbhaqa6	Wed Mar 30 02:10:59 2005
@@ -0,0 +1,352 @@
</small></pre><pre class="diff" id="added">+&lt;?php
+/*
+  $Id$
+
+  osCommerce, Open Source E-Commerce Solutions
+  http://www.oscommerce.com
+
+  Copyright (c) 2005 osCommerce
+
+  Released under the GNU General Public License
+*/
+
+  class osC_Checkout_Process {
+
+/* Public variables */
+
+    var $page_contents = 'shopping_cart.php';
+
+/* Private variables */
+
+    var $_module = 'process';
+
+/* Class constructor */
+
+    function osC_Checkout_Process() {
+      global $osC_Session, $cart;
+
+      if ($cart-&gt;count_contents() &lt; 1) {
+        tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
+      }
+
+// avoid hack attempts during the checkout procedure by checking the internal cartID
+      if (isset($cart-&gt;cartID) &amp;&amp; $osC_Session-&gt;exists('cartID')) {
+        if ($cart-&gt;cartID != $osC_Session-&gt;value('cartID')) {
+          tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+        }
+      }
+
+// if no shipping method has been selected, redirect the customer to the shipping method selection page
+      if ($osC_Session-&gt;exists('sendto') == false) {
+        tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+      }
+
+      if (tep_not_null(MODULE_PAYMENT_INSTALLED) &amp;&amp; ($osC_Session-&gt;exists('payment') == false)) {
+        tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
+      }
+
+      $this-&gt;_process();
+    }
+
+/* Public methods */
+
+    function getPageContentsFile() {
+      return $this-&gt;page_contents;
+    }
+
+/* Private methods */
+
+    function _process() {
+      global $osC_Database, $osC_Session, $osC_Customer, $osC_Currencies, $cart, $order, $payment_modules, $shipping_modules, $order_total_modules;
+
+// load selected payment module
+      require(DIR_WS_CLASSES . 'payment.php');
+      $payment_modules = new payment($osC_Session-&gt;value('payment'));
+
+// load the selected shipping module
+      require(DIR_WS_CLASSES . 'shipping.php');
+      $shipping_modules = new shipping($osC_Session-&gt;value('shipping'));
+
+      $order = new order;
+
+// load the before_process function from the payment modules
+      $payment_modules-&gt;before_process();
+
+      require(DIR_WS_CLASSES . 'order_total.php');
+      $order_total_modules = new order_total;
+
+      $order_totals = $order_total_modules-&gt;process();
+
+      $Qorder = $osC_Database-&gt;query('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city
 , :customers_postcode, :customers_state, :customers_country, :customers_telephone, :custom
 ers_email_addr<strong class="error">[...]</strong>
+      $Qorder-&gt;bindTable(':table_orders', TABLE_ORDERS);
+      $Qorder-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qorder-&gt;bindValue(':customers_name', $order-&gt;customer['firstname'] . ' ' . $order-&gt;customer['lastname']);
+      $Qorder-&gt;bindValue(':customers_company', $order-&gt;customer['company']);
+      $Qorder-&gt;bindValue(':customers_street_address', $order-&gt;customer['street_address']);
+      $Qorder-&gt;bindValue(':customers_suburb', $order-&gt;customer['suburb']);
+      $Qorder-&gt;bindValue(':customers_city', $order-&gt;customer['city']);
+      $Qorder-&gt;bindValue(':customers_postcode', $order-&gt;customer['postcode']);
+      $Qorder-&gt;bindValue(':customers_state', $order-&gt;customer['state']);
+      $Qorder-&gt;bindValue(':customers_country', $order-&gt;customer['country']['title']);
+      $Qorder-&gt;bindValue(':customers_telephone', $order-&gt;customer['telephone']);
+      $Qorder-&gt;bindValue(':customers_email_address', $order-&gt;customer['email_address']);
+      $Qorder-&gt;bindInt(':customers_address_format_id', $order-&gt;customer['format_id']);
+      $Qorder-&gt;bindValue(':customers_ip_address', tep_get_ip_address());
+      $Qorder-&gt;bindValue(':delivery_name', $order-&gt;delivery['firstname'] . ' ' . $order-&gt;delivery['lastname']);
+      $Qorder-&gt;bindValue(':delivery_company', $order-&gt;delivery['company']);
+      $Qorder-&gt;bindValue(':delivery_street_address', $order-&gt;delivery['street_address']);
+      $Qorder-&gt;bindValue(':delivery_suburb', $order-&gt;delivery['suburb']);
+      $Qorder-&gt;bindValue(':delivery_city', $order-&gt;delivery['city']);
+      $Qorder-&gt;bindValue(':delivery_postcode', $order-&gt;delivery['postcode']);
+      $Qorder-&gt;bindValue(':delivery_state', $order-&gt;delivery['state']);
+      $Qorder-&gt;bindValue(':delivery_country', $order-&gt;delivery['country']['title']);
+      $Qorder-&gt;bindInt(':delivery_address_format_id', $order-&gt;delivery['format_id']);
+      $Qorder-&gt;bindValue(':billing_name', $order-&gt;billing['firstname'] . ' ' . $order-&gt;billing['lastname']);
+      $Qorder-&gt;bindValue(':billing_company', $order-&gt;billing['company']);
+      $Qorder-&gt;bindValue(':billing_street_address', $order-&gt;billing['street_address']);
+      $Qorder-&gt;bindValue(':billing_suburb', $order-&gt;billing['suburb']);
+      $Qorder-&gt;bindValue(':billing_city', $order-&gt;billing['city']);
+      $Qorder-&gt;bindValue(':billing_postcode', $order-&gt;billing['postcode']);
+      $Qorder-&gt;bindValue(':billing_state', $order-&gt;billing['state']);
+      $Qorder-&gt;bindValue(':billing_country', $order-&gt;billing['country']['title']);
+      $Qorder-&gt;bindInt(':billing_address_format_id', $order-&gt;billing['format_id']);
+      $Qorder-&gt;bindValue(':payment_method', $order-&gt;info['payment_method']);
+      $Qorder-&gt;bindValue(':cc_type', $order-&gt;info['cc_type']);
+      $Qorder-&gt;bindValue(':cc_owner', $order-&gt;info['cc_owner']);
+      $Qorder-&gt;bindValue(':cc_number', $order-&gt;info['cc_number']);
+      $Qorder-&gt;bindValue(':cc_expires', $order-&gt;info['cc_expires']);
+      $Qorder-&gt;bindRaw(':date_purchased', 'now()');
+      $Qorder-&gt;bindValue(':orders_status', $order-&gt;info['order_status']);
+      $Qorder-&gt;bindValue(':currency', $order-&gt;info['currency']);
+      $Qorder-&gt;bindValue(':currency_value', $order-&gt;info['currency_value']);
+      $Qorder-&gt;execute();
+
+      $insert_id = $osC_Database-&gt;nextID();
+
+      for ($i=0, $n=sizeof($order_totals); $i&lt;$n; $i++) {
+        $Qtotals = $osC_Database-&gt;query('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
+        $Qtotals-&gt;bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
+        $Qtotals-&gt;bindInt(':orders_id', $insert_id);
+        $Qtotals-&gt;bindValue(':title', $order_totals[$i]['title']);
+        $Qtotals-&gt;bindValue(':text', $order_totals[$i]['text']);
+        $Qtotals-&gt;bindValue(':value', $order_totals[$i]['value']);
+        $Qtotals-&gt;bindValue(':class', $order_totals[$i]['code']);
+        $Qtotals-&gt;bindInt(':sort_order', $order_totals[$i]['sort_order']);
+        $Qtotals-&gt;execute();
+      }
+
+      $Qstatus = $osC_Database-&gt;query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, :date_added, :customer_notified, :comments)');
+      $Qstatus-&gt;bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
+      $Qstatus-&gt;bindInt(':orders_id', $insert_id);
+      $Qstatus-&gt;bindInt(':orders_status_id', $order-&gt;info['order_status']);
+      $Qstatus-&gt;bindRaw(':date_added', 'now()');
+      $Qstatus-&gt;bindInt(':customer_notified', (SEND_EMAILS == 'true') ? '1' : '0');
+      $Qstatus-&gt;bindValue(':comments', $order-&gt;info['comments']);
+      $Qstatus-&gt;execute();
+
+// initialized for the email confirmation
+      $products_ordered = '';
+      $subtotal = 0;
+      $total_tax = 0;
+      $total_weight = 0;
+      $total_cost = 0;
+
+      for ($i=0, $n=sizeof($order-&gt;products); $i&lt;$n; $i++) {
+// Stock Update - Joao Correia
+        if (STOCK_LIMITED == 'true') {
+          if (DOWNLOAD_ENABLED == 'true') {
+            $Qstock = $osC_Database-&gt;query('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 = :products_id');
+            $Qstock-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+            $Qstock-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+            $Qstock-&gt;bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
+            $Qstock-&gt;bindInt(':products_id', tep_get_prid($order-&gt;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-&gt;products[$i]['attributes'];
+
+            if (is_array($products_attributes)) {
+              $Qstock-&gt;appendQuery('and pa.options_id = :options_id and pa.options_values_id = :options_values_id');
+              $Qstock-&gt;bindInt(':options_id', $products_attributes[0]['option_id']);
+              $Qstock-&gt;bindInt(':options_values_id', $products_attributes[0]['value_id']);
+            }
+          } else {
+            $Qstock = $osC_Database-&gt;query('select products_quantity from :table_products where products_id = :products_id');
+            $Qstock-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+            $Qstock-&gt;bindInt(':products_id', tep_get_prid($order-&gt;products[$i]['id']));
+          }
+
+          $Qstock-&gt;execute();
+
+          if ($Qstock-&gt;numberOfRows() &gt; 0) {
+            $stock_left = $Qstock-&gt;valueInt('products_quantity');
+
+// do not decrement quantities if products_attributes_filename exists
+            if ((DOWNLOAD_ENABLED != 'true') || ((DOWNLOAD_ENABLED == 'true') &amp;&amp; (strlen($Qstock-&gt;value('products_attributes_filename')) &lt; 1))) {
+              $stock_left = $stock_left - $order-&gt;products[$i]['qty'];
+
+              $Qupdate = $osC_Database-&gt;query('update :table_products set products_quantity = :products_quantity where products_id = :products_id');
+              $Qupdate-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+              $Qupdate-&gt;bindInt(':products_quantity', $stock_left);
+              $Qupdate-&gt;bindInt(':products_id', tep_get_prid($order-&gt;products[$i]['id']));
+              $Qupdate-&gt;execute();
+            }
+
+            if ((STOCK_ALLOW_CHECKOUT == 'false') &amp;&amp; ($stock_left &lt; 1)) {
+              $Qupdate = $osC_Database-&gt;query('update :table_products set products_status = :products_status where products_id = :products_id');
+              $Qupdate-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+              $Qupdate-&gt;bindInt(':products_status', 0);
+              $Qupdate-&gt;bindInt(':products_id', tep_get_prid($order-&gt;products[$i]['id']));
+              $Qupdate-&gt;execute();
+            }
+          }
+        }
+
+// Update products_ordered (for bestsellers list)
+        $Qupdate = $osC_Database-&gt;query('update :table_products set products_ordered = products_ordered + :products_ordered where products_id = :products_id');
+        $Qupdate-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+        $Qupdate-&gt;bindInt(':products_ordered', $order-&gt;products[$i]['qty']);
+        $Qupdate-&gt;bindInt(':products_id', tep_get_prid($order-&gt;products[$i]['id']));
+        $Qupdate-&gt;execute();
+
+        $Qproducts = $osC_Database-&gt;query('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :final_price, :products_tax, :products_quantity)');
+        $Qproducts-&gt;bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
+        $Qproducts-&gt;bindInt(':orders_id', $insert_id);
+        $Qproducts-&gt;bindInt(':products_id', tep_get_prid($order-&gt;products[$i]['id']));
+        $Qproducts-&gt;bindValue(':products_model', $order-&gt;products[$i]['model']);
+        $Qproducts-&gt;bindValue(':products_name', $order-&gt;products[$i]['name']);
+        $Qproducts-&gt;bindValue(':products_price', $order-&gt;products[$i]['price']);
+        $Qproducts-&gt;bindValue(':final_price', $order-&gt;products[$i]['final_price']);
+        $Qproducts-&gt;bindValue(':products_tax', $order-&gt;products[$i]['tax']);
+        $Qproducts-&gt;bindInt(':products_quantity', $order-&gt;products[$i]['qty']);
+        $Qproducts-&gt;execute();
+
+        $order_products_id = $osC_Database-&gt;nextID();
+
+//------insert customer choosen option to order--------
+        $attributes_exist = '0';
+        $products_ordered_attributes = '';
+
+        if (isset($order-&gt;products[$i]['attributes'])) {
+          $attributes_exist = '1';
+
+          for ($j=0, $n2=sizeof($order-&gt;products[$i]['attributes']); $j&lt;$n2; $j++) {
+            if (DOWNLOAD_ENABLED == 'true') {
+              $Qattributes = $osC_Database-&gt;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 = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
+              $Qattributes-&gt;bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+              $Qattributes-&gt;bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+              $Qattributes-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+              $Qattributes-&gt;bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
+              $Qattributes-&gt;bindInt(':products_id', $order-&gt;products[$i]['id']);
+              $Qattributes-&gt;bindInt(':options_id', $order-&gt;products[$i]['attributes'][$j]['option_id']);
+              $Qattributes-&gt;bindInt(':options_values_id', $order-&gt;products[$i]['attributes'][$j]['value_id']);
+              $Qattributes-&gt;bindInt(':popt_language_id', $osC_Session-&gt;value('languages_id'));
+              $Qattributes-&gt;bindInt(':poval_language_id', $osC_Session-&gt;value('languages_id'));
+            } else {
+              $Qattributes = $osC_Database-&gt;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 = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
+              $Qattributes-&gt;bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+              $Qattributes-&gt;bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+              $Qattributes-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+              $Qattributes-&gt;bindInt(':products_id', $order-&gt;products[$i]['id']);
+              $Qattributes-&gt;bindInt(':options_id', $order-&gt;products[$i]['attributes'][$j]['option_id']);
+              $Qattributes-&gt;bindInt(':options_values_id', $order-&gt;products[$i]['attributes'][$j]['value_id']);
+              $Qattributes-&gt;bindInt(':popt_language_id', $osC_Session-&gt;value('languages_id'));
+              $Qattributes-&gt;bindInt(':poval_language_id', $osC_Session-&gt;value('languages_id'));
+            }
+            $Qattributes-&gt;execute();
+
+            $Qopa = $osC_Database-&gt;query('insert into :table_orders_products_attributes (orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix) values (:orders_id, :orders_products_id, :products_options, :products_options_values, :options_values_price, :price_prefix)');
+            $Qopa-&gt;bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
+            $Qopa-&gt;bindInt(':orders_id', $insert_id);
+            $Qopa-&gt;bindInt(':orders_products_id', $order_products_id);
+            $Qopa-&gt;bindValue(':products_options', $attributes_values['products_options_name']);
+            $Qopa-&gt;bindValue(':products_options_values', $attributes_values['products_options_values_name']);
+            $Qopa-&gt;bindValue(':options_values_price', $attributes_values['options_values_price']);
+            $Qopa-&gt;bindValue(':price_prefix', $attributes_values['price_prefix']);
+            $Qopa-&gt;execute();
+
+            if ((DOWNLOAD_ENABLED == 'true') &amp;&amp; (strlen($Qattributes-&gt;value('products_attributes_filename')) &gt; 0)) {
+              $Qopd = $osC_Database-&gt;query('insert into :table_orders_products_download (orders_id, orders_products_id, orders_products_filename, download_maxdays, download_count) values (:orders_id, :orders_products_id, :orders_products_filename, :download_maxdays, :download_count)');
+              $Qopd-&gt;bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
+              $Qopd-&gt;bindInt(':orders_id', $insert_id);
+              $Qopd-&gt;bindInt(':orders_products_id', $order_products_id);
+              $Qopd-&gt;bindValue(':orders_products_filename', $Qattributes-&gt;value('products_attributes_filename'));
+              $Qopd-&gt;bindValue(':download_maxdays', $Qattributes-&gt;value('products_attributes_maxdays'));
+              $Qopd-&gt;bindValue(':download_count', $Qattributes-&gt;value('products_attributes_maxcount'));
+              $Qopd-&gt;execute();
+            }
+
+            $products_ordered_attributes .= "\n\t" . $Qattributes-&gt;value('products_options_name') . ' ' . $Qattributes-&gt;value('products_options_values_name');
+          }
+        }
+//------insert customer choosen option eof ----
+
+        $total_weight += ($order-&gt;products[$i]['qty'] * $order-&gt;products[$i]['weight']);
+        $total_tax += tep_calculate_tax($order-&gt;products[$i]['final_price'], $order-&gt;products[$i]['tax']) * $order-&gt;products[$i]['qty'];
+        $total_cost += $order-&gt;products[$i]['final_price'];
+
+        $products_ordered .= $order-&gt;products[$i]['qty'] . ' x ' . $order-&gt;products[$i]['name'] . ' (' . $order-&gt;products[$i]['model'] . ') = ' . $osC_Currencies-&gt;displayPrice($order-&gt;products[$i]['final_price'], $order-&gt;products[$i]['tax_class_id'], $order-&gt;products[$i]['qty']) . $products_ordered_attributes . "\n";
+      }
+
+// lets start with the email confirmation
+      $email_order = STORE_NAME . "\n" .
+                     EMAIL_SEPARATOR . "\n" .
+                     EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
+                     EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT, 'orders=' . $insert_id, 'SSL', false) . "\n" .
+                     EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
+      if ($order-&gt;info['comments']) {
+        $email_order .= tep_output_string_protected($order-&gt;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&lt;$n; $i++) {
+        $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
+      }
+
+      if ($order-&gt;content_type != 'virtual') {
+        $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
+                        EMAIL_SEPARATOR . "\n" .
+                        tep_address_label($osC_Customer-&gt;id, $osC_Session-&gt;value('sendto'), 0, '', "\n") . "\n";
+      }
+
+      $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
+                      EMAIL_SEPARATOR . "\n" .
+                      tep_address_label($osC_Customer-&gt;id, $osC_Session-&gt;value('billto'), 0, '', "\n") . "\n\n";
+
+      $payment =&amp; $osC_Session-&gt;value('payment');
+
+      if (is_object($$payment)) {
+        $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
+                        EMAIL_SEPARATOR . "\n";
+        $payment_class = $$payment;
+        $email_order .= $payment_class-&gt;title . "\n\n";
+        if (isset($payment_class-&gt;email_footer)) {
+          $email_order .= $payment_class-&gt;email_footer . "\n\n";
+        }
+      }
+
+      tep_mail($order-&gt;customer['firstname'] . ' ' . $order-&gt;customer['lastname'], $order-&gt;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);
+      }
+
+// load the after_process function from the payment modules
+      $payment_modules-&gt;after_process();
+
+      $cart-&gt;reset(true);
+
+// unregister session variables used during checkout
+      $osC_Session-&gt;remove('sendto');
+      $osC_Session-&gt;remove('billto');
+      $osC_Session-&gt;remove('shipping');
+      $osC_Session-&gt;remove('payment');
+      $osC_Session-&gt;remove('comments');
+
+      tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
+    }
+  }
+?&gt;
</pre><strong class="error" title="1 lines truncated at column 1000">[Note: Some over-long lines of diff output only partialy shown]</strong>
</div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.9</small></center>
</body></html>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click