order.php

来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 112 行

PHP
112
字号
<?php
/*
  [SOOBIC!] admin/includes/order.php 

	Version: 1.5
	Author: Soolan (soolan@qq.com)
	Copyright: soolan (www.soobic.com)
	Last Modified: 2005/4/1 10:00

*/

class order {
    var $info, $totals, $products, $customer, $delivery;

   function order($order_id) {
      $this->info = array();
      $this->totals = array();
      $this->products = array();
      $this->customer = array();
      $this->delivery = array();

      $this->query($order_id);
   }

   function query($order_id) {
      global $db,$table_orders,$table_orders_total,$table_orders_products,$table_orders_products_attributes;
			$query = $db->query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode,customers_tel_regular,customers_tel_mobile, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode,delivery_tel_regular,delivery_tel_mobile, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode,billing_tel_regular,billing_tel_mobile, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from $table_orders where orders_id = '" . (int)$order_id . "'");
      $order = $db->fetch_array($query);

      $totals_query = $db->query("select title, text, value from $table_orders_total where orders_id = '" . (int)$order_id . "' order by sort_order");
      while ($totals = $db->fetch_array($totals_query)) {
        $this->totals[] = array('title' => $totals['title'],
                                'value' => $totals['value'],
                                'text' => $totals['text']);
      }
      $this->info = array('currency' => $order['currency'],
                          'currency_value' => $order['currency_value'],
                          'payment_method' => $order['payment_method'],
                          'cc_type' => $order['cc_type'],
                          'cc_owner' => $order['cc_owner'],
                          'cc_number' => $order['cc_number'],
                          'cc_expires' => $order['cc_expires'],
                          'date_purchased' => $order['date_purchased'],
                          'orders_status' => $order['orders_status'],
                          'last_modified' => $order['last_modified']);

      $this->customer = array('name' => $order['customers_name'],
                              'company' => $order['customers_company'],
                              'street_address' => $order['customers_street_address'],
                              'suburb' => $order['customers_suburb'],
                              'city' => $order['customers_city'],
                              'postcode' => $order['customers_postcode'],
                              'tel_regular' => $order['customers_tel_regular'],
                              'tel_mobile' => $order['customers_tel_mobile'],
                              'state' => $order['customers_state'],
                              'country_name' => $order['customers_country'],
                             
                              'email_address' => $order['customers_email_address']);

      $this->delivery = array('name' => $order['delivery_name'],
                              'company' => $order['delivery_company'],
                              'street_address' => $order['delivery_street_address'],
                              'suburb' => $order['delivery_suburb'],
                              'city' => $order['delivery_city'],
                              'postcode' => $order['delivery_postcode'],
                              'tel_regular' => $order['delivery_tel_regular'],
                              'tel_mobile' => $order['delivery_tel_mobile'],
                              'state' => $order['delivery_state'],
                              'country_name' => $order['delivery_country']);

      $this->billing = array('name' => $order['billing_name'],
                             'company' => $order['billing_company'],
                             'street_address' => $order['billing_street_address'],
                             'suburb' => $order['billing_suburb'],
                             'city' => $order['billing_city'],
                             'postcode' => $order['billing_postcode'],
                             'tel_regular' => $order['billing_tel_regular'],
                             'tel_mobile' => $order['billing_tel_mobile'],
                             'state' => $order['billing_state'],
                             'country_name' => $order['billing_country']);


		  $index = 0;
      $orders_products_query = $db->query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from $table_orders_products where orders_id = '" . (int)$order_id . "'");

			while ($orders_products = $db->fetch_array($orders_products_query)) {
        //echo $orders_products['products_price'];
				$this->products[$index] = array('qty' => $orders_products['products_quantity'],
                                        'name' => $orders_products['products_name'],
                                        'model' => $orders_products['products_model'],
                                        'tax' => $orders_products['products_tax'],
                                        'price' => $orders_products['products_price'],
                                        'final_price' => $orders_products['final_price']);
        
				$subindex = 0;
        $attributes_query = $db->query("select products_options, products_options_values, options_values_price, price_prefix from $table_orders_products_attributes where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
        if ($db->num_rows($attributes_query)) {
          while ($attributes = $db->fetch_array($attributes_query)) {
            $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                     'value' => $attributes['products_options_values'],
                                                                     'prefix' => $attributes['price_prefix'],
                                                                     'price' => $attributes['options_values_price']);

            $subindex++;
          }
        }
        $index++;
      }
    }
  }
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?