[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: order.php 4774 2006-10-17 06:47:16Z drbyte $ 21 // 22 23 class order { 24 var $info, $totals, $products, $customer, $delivery; 25 26 function order($order_id) { 27 $this->info = array(); 28 $this->totals = array(); 29 $this->products = array(); 30 $this->customer = array(); 31 $this->delivery = array(); 32 33 $this->query($order_id); 34 } 35 36 function query($order_id) { 37 global $db; 38 $order = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address, 39 customers_suburb, customers_city, customers_postcode, customers_id, 40 customers_state, customers_country, customers_telephone, 41 customers_email_address, customers_address_format_id, delivery_name, 42 delivery_company, delivery_street_address, delivery_suburb, 43 delivery_city, delivery_postcode, delivery_state, delivery_country, 44 delivery_address_format_id, billing_name, billing_company, 45 billing_street_address, billing_suburb, billing_city, billing_postcode, 46 billing_state, billing_country, billing_address_format_id, 47 coupon_code, payment_method, payment_module_code, shipping_method, shipping_module_code, 48 cc_type, cc_owner, cc_number, cc_expires, currency, 49 currency_value, date_purchased, orders_status, last_modified, 50 order_total, order_tax, ip_address 51 from " . TABLE_ORDERS . " 52 where orders_id = '" . (int)$order_id . "'"); 53 54 55 $totals = $db->Execute("select title, text, class 56 from " . TABLE_ORDERS_TOTAL . " 57 where orders_id = '" . (int)$order_id . "' 58 order by sort_order"); 59 60 while (!$totals->EOF) { 61 $this->totals[] = array('title' => $totals->fields['title'], 62 'text' => $totals->fields['text'], 63 'class' => $totals->fields['class']); 64 $totals->MoveNext(); 65 } 66 67 $this->info = array('currency' => $order->fields['currency'], 68 'currency_value' => $order->fields['currency_value'], 69 'payment_method' => $order->fields['payment_method'], 70 'payment_module_code' => $order->fields['payment_module_code'], 71 'shipping_method' => $order->fields['shipping_method'], 72 'shipping_module_code' => $order->fields['shipping_module_code'], 73 'coupon_code' => $order->fields['coupon_code'], 74 'cc_type' => $order->fields['cc_type'], 75 'cc_owner' => $order->fields['cc_owner'], 76 'cc_number' => $order->fields['cc_number'], 77 'cc_cvv' => $order->fields['cc_cvv'], 78 'cc_expires' => $order->fields['cc_expires'], 79 'date_purchased' => $order->fields['date_purchased'], 80 'orders_status' => $order->fields['orders_status'], 81 'total' => $order->fields['order_total'], 82 'tax' => $order->fields['order_tax'], 83 'last_modified' => $order->fields['last_modified'], 84 'ip_address' => $order->fields['ip_address'] 85 ); 86 87 $this->customer = array('name' => $order->fields['customers_name'], 88 'id' => $order->fields['customers_id'], 89 'company' => $order->fields['customers_company'], 90 'street_address' => $order->fields['customers_street_address'], 91 'suburb' => $order->fields['customers_suburb'], 92 'city' => $order->fields['customers_city'], 93 'postcode' => $order->fields['customers_postcode'], 94 'state' => $order->fields['customers_state'], 95 'country' => $order->fields['customers_country'], 96 'format_id' => $order->fields['customers_address_format_id'], 97 'telephone' => $order->fields['customers_telephone'], 98 'email_address' => $order->fields['customers_email_address']); 99 100 $this->delivery = array('name' => $order->fields['delivery_name'], 101 'company' => $order->fields['delivery_company'], 102 'street_address' => $order->fields['delivery_street_address'], 103 'suburb' => $order->fields['delivery_suburb'], 104 'city' => $order->fields['delivery_city'], 105 'postcode' => $order->fields['delivery_postcode'], 106 'state' => $order->fields['delivery_state'], 107 'country' => $order->fields['delivery_country'], 108 'format_id' => $order->fields['delivery_address_format_id']); 109 110 $this->billing = array('name' => $order->fields['billing_name'], 111 'company' => $order->fields['billing_company'], 112 'street_address' => $order->fields['billing_street_address'], 113 'suburb' => $order->fields['billing_suburb'], 114 'city' => $order->fields['billing_city'], 115 'postcode' => $order->fields['billing_postcode'], 116 'state' => $order->fields['billing_state'], 117 'country' => $order->fields['billing_country'], 118 'format_id' => $order->fields['billing_address_format_id']); 119 120 $index = 0; 121 $orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model, 122 products_price, products_tax, products_quantity, 123 final_price, onetime_charges, 124 product_is_free 125 from " . TABLE_ORDERS_PRODUCTS . " 126 where orders_id = '" . (int)$order_id . "'"); 127 128 while (!$orders_products->EOF) { 129 // convert quantity to proper decimals - account history 130 if (QUANTITY_DECIMALS != 0) { 131 $fix_qty = $orders_products->fields['products_quantity']; 132 switch (true) { 133 case (!strstr($fix_qty, '.')): 134 $new_qty = $fix_qty; 135 break; 136 default: 137 $new_qty = preg_replace('/[0]+$/', '', $orders_products->fields['products_quantity']); 138 break; 139 } 140 } else { 141 $new_qty = $orders_products->fields['products_quantity']; 142 } 143 144 $new_qty = round($new_qty, QUANTITY_DECIMALS); 145 146 if ($new_qty == (int)$new_qty) { 147 $new_qty = (int)$new_qty; 148 } 149 150 $this->products[$index] = array('qty' => $new_qty, 151 'id' => $orders_products->fields['products_id'], 152 'name' => $orders_products->fields['products_name'], 153 'model' => $orders_products->fields['products_model'], 154 'tax' => $orders_products->fields['products_tax'], 155 'price' => $orders_products->fields['products_price'], 156 'onetime_charges' => $orders_products->fields['onetime_charges'], 157 'final_price' => $orders_products->fields['final_price'], 158 'product_is_free' => $orders_products->fields['product_is_free']); 159 160 $subindex = 0; 161 $attributes = $db->Execute("select products_options, products_options_values, options_values_price, 162 price_prefix, 163 product_attribute_is_free 164 from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " 165 where orders_id = '" . (int)$order_id . "' 166 and orders_products_id = '" . (int)$orders_products->fields['orders_products_id'] . "'"); 167 if ($attributes->RecordCount()>0) { 168 while (!$attributes->EOF) { 169 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options'], 170 'value' => $attributes->fields['products_options_values'], 171 'prefix' => $attributes->fields['price_prefix'], 172 'price' => $attributes->fields['options_values_price'], 173 'product_attribute_is_free' =>$attributes->fields['product_attribute_is_free']); 174 175 $subindex++; 176 $attributes->MoveNext(); 177 } 178 } 179 $index++; 180 $orders_products->MoveNext(); 181 } 182 } 183 } 184 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |