Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

1497
 
1674
 
1674
 
order.php
_> 11 <?php
  22 /*
<> 3 -  $Id: order.php 1497 2007-03-29 13:40:05Z hpdl $
   3+  $Id: order.php 1674 2007-08-20 22:56:00Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
  77 
<> 8 -  Copyright (c) 2006 osCommerce
   8+  Copyright (c) 2007 osCommerce
99 
  1010   This program is free software; you can redistribute it and/or modify
  1111   it under the terms of the GNU General Public License v2 (1991)
     
 !
2121 
  2222 /* Class constructor */
  2323 
<> 24 -    function osC_Order($order_id = '') {
   24+    function __construct($order_id = '') {
2525       if (is_numeric($order_id)) {
  2626         $this->_id = $order_id;
  2727       }
     
 !
6565       $Qcheck->execute();
  6666 
  6767       if ($Qcheck->valueInt('orders_status') === 4) {
<>  68+/* HPDL
6869         $Qdel = $osC_Database->query('delete from :table_orders_products_download where orders_id = :orders_id');
  6970         $Qdel->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
  7071         $Qdel->bindInt(':orders_id', $id);
  7172         $Qdel->execute();
<>  73+*/
7274 
<> 73 -        $Qdel = $osC_Database->query('delete from :table_orders_products_attributes where orders_id = :orders_id');
  74 -        $Qdel->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
   75+        $Qdel = $osC_Database->query('delete from :table_orders_products_variants where orders_id = :orders_id');
   76+        $Qdel->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
7577         $Qdel->bindInt(':orders_id', $id);
  7678         $Qdel->execute();
  7779 
     
 !
188190       $Qstatus->execute();
  189191 
  190192       foreach ($osC_ShoppingCart->getProducts() as $products) {
<> 191 -        $Qproducts = $osC_Database->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)');
   193+        $Qproducts = $osC_Database->query('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :products_tax, :products_quantity)');
192194         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
  193195         $Qproducts->bindInt(':orders_id', $insert_id);
  194196         $Qproducts->bindInt(':products_id', osc_get_product_id($products['id']));
  195197         $Qproducts->bindValue(':products_model', '' /*$products['model']*/);
  196198         $Qproducts->bindValue(':products_name', $products['name']);
  197199         $Qproducts->bindValue(':products_price', $products['price']);
<> 198 -        $Qproducts->bindValue(':final_price', $products['final_price']);
199200         $Qproducts->bindValue(':products_tax', '' /*$products['tax']*/);
  200201         $Qproducts->bindInt(':products_quantity', $products['quantity']);
  201202         $Qproducts->execute();
  202203 
  203204         $order_products_id = $osC_Database->nextID();
  204205 
<> 205 -        if ($osC_ShoppingCart->hasAttributes($products['id'])) {
  206 -          foreach ($osC_ShoppingCart->getAttributes($products['id']) as $attributes) {
   206+        if ( $osC_ShoppingCart->isVariant($products['id']) ) {
   207+          foreach ( $osC_ShoppingCart->getVariant($products['id']) as $variant ) {
   208+/* HPDL
207209             if (DOWNLOAD_ENABLED == '1') {
  208210               $Qattributes = $osC_Database->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');
  209211               $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
     
 !
215217               $Qattributes->bindInt(':options_values_id', $attributes['options_values_id']);
  216218               $Qattributes->bindInt(':popt_language_id', $osC_Language->getID());
  217219               $Qattributes->bindInt(':poval_language_id', $osC_Language->getID());
<> 218 -            } else {
  219 -              $Qattributes = $osC_Database->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');
  220 -              $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
  221 -              $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
  222 -              $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
  223 -              $Qattributes->bindInt(':products_id', $products['id']);
  224 -              $Qattributes->bindInt(':options_id', $attributes['options_id']);
  225 -              $Qattributes->bindInt(':options_values_id', $attributes['options_values_id']);
  226 -              $Qattributes->bindInt(':popt_language_id', $osC_Language->getID());
  227 -              $Qattributes->bindInt(':poval_language_id', $osC_Language->getID());
   220+              $Qattributes->execute();
228221             }
<> 229 -            $Qattributes->execute();
   222+*/
230223 
<> 231 -            $Qopa = $osC_Database->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)');
  232 -            $Qopa->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
  233 -            $Qopa->bindInt(':orders_id', $insert_id);
  234 -            $Qopa->bindInt(':orders_products_id', $order_products_id);
  235 -            $Qopa->bindValue(':products_options', $Qattributes->value('products_options_name'));
  236 -            $Qopa->bindValue(':products_options_values', $Qattributes->value('products_options_values_name'));
  237 -            $Qopa->bindValue(':options_values_price', $Qattributes->value('options_values_price'));
  238 -            $Qopa->bindValue(':price_prefix', $Qattributes->value('price_prefix'));
  239 -            $Qopa->execute();
   224+            $Qvariant = $osC_Database->query('insert into :table_orders_products_variants (orders_id, orders_products_id, group_title, value_title) values (:orders_id, :orders_products_id, :group_title, :value_title)');
   225+            $Qvariant->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
   226+            $Qvariant->bindInt(':orders_id', $insert_id);
   227+            $Qvariant->bindInt(':orders_products_id', $order_products_id);
   228+            $Qvariant->bindValue(':group_title', $variant['group_title']);
   229+            $Qvariant->bindValue(':value_title', $variant['value_title']);
   230+            $Qvariant->execute();
240231 
<>  232+/*HPDL
241233             if ((DOWNLOAD_ENABLED == '1') && (strlen($Qattributes->value('products_attributes_filename')) > 0)) {
  242234               $Qopd = $osC_Database->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)');
  243235               $Qopd->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
     
 !
248240               $Qopd->bindValue(':download_count', $Qattributes->value('products_attributes_maxcount'));
  249241               $Qopd->execute();
  250242             }
<>  243+*/
251244           }
  252245         }
  253246       }
     
 !
365358                        $osC_Language->get('email_order_products') . "\n" .
  366359                        $osC_Language->get('email_order_separator') . "\n";
  367360 
<> 368 -        $Qproducts = $osC_Database->query('select orders_products_id, products_model, products_name, final_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id');
   361+        $Qproducts = $osC_Database->query('select orders_products_id, products_model, products_name, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id');
369362         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
  370363         $Qproducts->bindInt(':orders_id', $id);
  371364         $Qproducts->execute();
  372365 
  373366         while ($Qproducts->next()) {
<> 374 -          $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $Qproducts->value('products_model') . ') = ' . $osC_Currencies->displayPriceWithTaxRate($Qproducts->value('final_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n";
   367+          $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $Qproducts->value('products_model') . ') = ' . $osC_Currencies->displayPriceWithTaxRate($Qproducts->value('products_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n";
375368 
<> 376 -          $Qattributes = $osC_Database->query('select products_options, products_options_values from :table_orders_products_attributes where orders_id = :orders_id and orders_products_id = :orders_products_id order by orders_products_attributes_id');
  377 -          $Qattributes->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
  378 -          $Qattributes->bindInt(':orders_id', $id);
  379 -          $Qattributes->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id'));
  380 -          $Qattributes->execute();
   369+          $Qvariants = $osC_Database->query('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id');
   370+          $Qvariants->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
   371+          $Qvariants->bindInt(':orders_id', $id);
   372+          $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id'));
   373+          $Qvariants->execute();
381374 
<> 382 -          while ($Qattributes->next()) {
  383 -            $email_order .= "\t" . $Qattributes->value('products_options') . ': ' . $Qattributes->value('products_options_values') . "\n";
   375+          while ( $Qvariants->next() ) {
   376+            $email_order .= "\t" . $Qvariants->value('group_title') . ': ' . $Qvariants->value('value_title') . "\n";
384377           }
  385378         }
  386379 
  387380         unset($Qproducts);
<> 388 -        unset($Qattributes);
   381+        unset($Qvariants);
389382 
  390383         $email_order .= $osC_Language->get('email_order_separator') . "\n";
  391384 
     
 !
416409 
  417410           $email_order .= "\n" . $osC_Language->get('email_order_delivery_address') . "\n" .
  418411                           $osC_Language->get('email_order_separator') . "\n" .
<> 419 -                          osC_Address::format($address, "\n") . "\n";
   412+                          osC_Address::format($address) . "\n";
420413 
  421414           unset($address);
  422415         }
     
 !
436429 
  437430         $email_order .= "\n" . $osC_Language->get('email_order_billing_address') . "\n" .
  438431                         $osC_Language->get('email_order_separator') . "\n" .
<> 439 -                        osC_Address::format($address, "\n") . "\n\n";
   432+                        osC_Address::format($address) . "\n\n";
440433 
  441434         unset($address);
  442435 
     
 !
680673                              'country_iso3' => $Qorder->value('billing_country_iso3'),
  681674                              'format' => $Qorder->value('billing_address_format'));
  682675 
<> 683 -      $Qproducts = $osC_Database->query('select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from :table_orders_products where orders_id = :orders_id');
   676+      $Qproducts = $osC_Database->query('select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id');
684677       $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
  685678       $Qproducts->bindInt(':orders_id', $order_id);
  686679       $Qproducts->execute();
     
 !
695688                                         'name' => $Qproducts->value('products_name'),
  696689                                         'model' => $Qproducts->value('products_model'),
  697690                                         'tax' => $Qproducts->value('products_tax'),
<> 698 -                                        'price' => $Qproducts->value('products_price'),
  699 -                                        'final_price' => $Qproducts->value('final_price'));
   691+                                        'price' => $Qproducts->value('products_price'));
700692 
<> 701 -        $Qattributes = $osC_Database->query('select products_options, products_options_values, options_values_price, price_prefix from :table_orders_products_attributes where orders_id = :orders_id and orders_products_id = :orders_products_id');
  702 -        $Qattributes->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
  703 -        $Qattributes->bindInt(':orders_id', $order_id);
  704 -        $Qattributes->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id'));
  705 -        $Qattributes->execute();
   693+        $Qvariants = $osC_Database->query('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id');
   694+        $Qvariants->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
   695+        $Qvariants->bindInt(':orders_id', $order_id);
   696+        $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id'));
   697+        $Qvariants->execute();
706698 
<> 707 -        if ($Qattributes->numberOfRows()) {
  708 -          while ($Qattributes->next()) {
  709 -            $this->products[$index]['attributes'][$subindex] = array('option' => $Qattributes->value('products_options'),
  710 -                                                                     'value' => $Qattributes->value('products_options_values'),
  711 -                                                                     'prefix' => $Qattributes->value('price_prefix'),
  712 -                                                                     'price' => $Qattributes->value('options_values_price'));
   699+        if ( $Qvariants->numberOfRows() ) {
   700+          while ( $Qvariants->next() ) {
   701+            $this->products[$index]['attributes'][$subindex] = array('option' => $Qvariants->value('group_title'),
   702+                                                                     'value' => $Qvariants->value('value_title'));
<_ 713703 
  714704             $subindex++;
  715705           }