Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

1739
 
1841
 
1841
 
item.php
_> 11 <?php
  22 /*
<> 3 -  $Id: item.php 1739 2007-12-20 00:52:16Z hpdl $
   3+  $Id: item.php 1841 2008-12-12 13:25:49Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
  77 
<> 8 -  Copyright (c) 2003 osCommerce
   8+  Copyright (c) 2008 osCommerce
99 
  1010   Released under the GNU General Public License
  1111 */
     
 !
4646 
  4747 // class methods
  4848     function quote($method = '') {
<> 49 -      global $order, $total_count;
   49+      global $order;
5050 
<>  51+      $number_of_items = $this->getNumberOfItems();
   52+
5153       $this->quotes = array('id' => $this->code,
  5254                             'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
  5355                             'methods' => array(array('id' => $this->code,
  5456                                                      'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
<> 55 -                                                     'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
   57+                                                     'cost' => (MODULE_SHIPPING_ITEM_COST * $number_of_items) + MODULE_SHIPPING_ITEM_HANDLING)));
5658 
  5759       if ($this->tax_class > 0) {
  5860         $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     
 !
8789     function keys() {
  8890       return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
  8991     }
<>  92+
   93+    function getNumberOfItems() {
   94+      global $order, $total_count;
   95+
   96+      $number_of_items = $total_count;
   97+
   98+      if ($order->content_type == 'mixed') {
   99+        $number_of_items = 0;
   100+
   101+        for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
   102+          $number_of_items += $order->products[$i]['qty'];
   103+
   104+          if (isset($order->products[$i]['attributes'])) {
   105+            reset($order->products[$i]['attributes']);
   106+            while (list($option, $value) = each($order->products[$i]['attributes'])) {
   107+              $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id");
   108+              $virtual_check = tep_db_fetch_array($virtual_check_query);
   109+
   110+              if ($virtual_check['total'] > 0) {
   111+                $number_of_items -= $order->products[$i]['qty'];
   112+              }
   113+            }
   114+          }
   115+        }
   116+      }
   117+
   118+      return $number_of_items;
   119+    }
<_ 90120   }
  91121 ?>