order.php

来自「this the oscommerce 3.0 aplha 4」· PHP 代码 · 共 593 行 · 第 1/2 页

PHP
593
字号
        return $this->_billing[$id];      }      return false;    }    function getPaymentMethod() {      return $this->_payment_method;    }    function getPaymentModule() {      return $this->_payment_module;    }    function getCreditCardDetails($id = '') {      if (empty($id)) {        return $this->_credit_card;      } elseif (isset($this->_credit_card[$id])) {        return $this->_credit_card[$id];      }      return false;    }    function isValidCreditCard() {      if (!empty($this->_credit_card['owner']) && !empty($this->_credit_card['number']) && !empty($this->_credit_card['expires'])) {        return true;      }      return false;    }    function getCurrency($id = 'code') {      if (isset($this->_currency[$id])) {        return $this->_currency[$id];      }      return false;    }    function getCurrencyValue() {      return $this->getCurrency('value');    }    function getDateCreated() {      return $this->_date_purchased;    }    function getDateLastModified() {      return $this->_last_modified;    }    function getStatusID() {      return $this->_status_id;    }    function getStatus() {      if (!isset($this->_status)) {        $this->_getStatus();      }      return $this->_status;    }    function getNumberOfComments() {      $number_of_comments = 0;      if (!isset($this->_status_history)) {        $this->_getStatusHistory();      }      foreach ($this->_status_history as $status_history) {        if (!empty($status_history['comment'])) {          $number_of_comments++;        }      }      return $number_of_comments;    }    function getProducts() {      if (!isset($this->_products)) {        $this->_getProducts();      }      return $this->_products;    }    function getNumberOfProducts() {      if (!isset($this->_products)) {        $this->_getProducts();      }      return sizeof($this->_products);    }    function getNumberOfItems() {      $number_of_items = 0;      if (!isset($this->_products)) {        $this->_getProducts();      }      foreach ($this->_products as $product) {        $number_of_items += $product['quantity'];      }      return $number_of_items;    }    function getTotal($id = 'total') {      if (!isset($this->_totals)) {        $this->_getTotals();      }      foreach ($this->_totals as $total) {        if ($total['class'] == $id) {          return strip_tags($total['text']);        }      }      return false;    }    function getTotals() {      if (!isset($this->_totals)) {        $this->_getTotals();      }      return $this->_totals;    }    function getStatusHistory() {      if (!isset($this->_status_history)) {        $this->_getStatusHistory();      }      return $this->_status_history;    }    function getTransactionHistory() {      if (!isset($this->_transaction_history)) {        $this->_getTransactionHistory();      }      return $this->_transaction_history;    }    function getPostTransactionActions() {      if (!isset($this->_post_transaction_actions)) {        $this->_getPostTransactionActions();      }      return $this->_post_transaction_actions;    }    function hasPostTransactionActions() {      if (!isset($this->_post_transaction_actions)) {        $this->_getPostTransactionActions();      }      return !empty($this->_post_transaction_actions);    }    function delete($id, $restock = false) {      global $osC_Database;      $error = false;      $osC_Database->startTransaction();      if ($restock === true) {        $Qproducts = $osC_Database->query('select products_id, products_quantity from :table_orders_products where orders_id = :orders_id');        $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);        $Qproducts->bindInt(':orders_id', $id);        $Qproducts->execute();        while ($Qproducts->next()) {          $Qupdate = $osC_Database->query('update :table_products set products_quantity = products_quantity + :products_quantity, products_ordered = products_ordered - :products_ordered where products_id = :products_id');          $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);          $Qupdate->bindInt(':products_quantity', $Qproducts->valueInt('products_quantity'));          $Qupdate->bindInt(':products_ordered', $Qproducts->valueInt('products_quantity'));          $Qupdate->bindInt(':products_id', $Qproducts->valueInt('products_id'));          $Qupdate->setLogging($_SESSION['module'], $id);          $Qupdate->execute();          if ($osC_Database->isError() === true) {            $error = true;            break;          }          $Qcheck = $osC_Database->query('select products_quantity from :table_products where products_id = :products_id and products_Status = 0');          $Qcheck->bindTable(':table_products', TABLE_PRODUCTS);          $Qcheck->bindInt(':products_id', $Qproducts->valueInt('products_id'));          $Qcheck->execute();          if (($Qcheck->numberOfRows() === 1) && ($Qcheck->valueInt('products_quantity') > 0)) {            $Qstatus = $osC_Database->query('update :table_products set products_status = 1 where products_id = :products_id');            $Qstatus->bindTable(':table_products', TABLE_PRODUCTS);            $Qstatus->bindInt(':products_id', $Qproducts->valueInt('products_id'));            $Qstatus->setLogging($_SESSION['module'], $id);            $Qstatus->execute();            if ($osC_Database->isError() === true) {              $error = true;              break;            }          }        }      }      if ($error === false) {        $Qopa = $osC_Database->query('delete from :table_orders_products_attributes where orders_id = :orders_id');        $Qopa->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);        $Qopa->bindInt(':orders_id', $id);        $Qopa->setLogging($_SESSION['module'], $id);        $Qopa->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $Qop = $osC_Database->query('delete from :table_orders_products where orders_id = :orders_id');        $Qop->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);        $Qop->bindInt(':orders_id', $id);        $Qop->setLogging($_SESSION['module'], $id);        $Qop->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $Qosh = $osC_Database->query('delete from :table_orders_transactions_history where orders_id = :orders_id');        $Qosh->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);        $Qosh->bindInt(':orders_id', $id);        $Qosh->setLogging($_SESSION['module'], $id);        $Qosh->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $Qosh = $osC_Database->query('delete from :table_orders_status_history where orders_id = :orders_id');        $Qosh->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);        $Qosh->bindInt(':orders_id', $id);        $Qosh->setLogging($_SESSION['module'], $id);        $Qosh->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $Qot = $osC_Database->query('delete from :table_orders_total where orders_id = :orders_id');        $Qot->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);        $Qot->bindInt(':orders_id', $id);        $Qot->setLogging($_SESSION['module'], $id);        $Qot->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $Qo = $osC_Database->query('delete from :table_orders where orders_id = :orders_id');        $Qo->bindTable(':table_orders', TABLE_ORDERS);        $Qo->bindInt(':orders_id', $id);        $Qo->setLogging($_SESSION['module'], $id);        $Qo->execute();        if ($osC_Database->isError() === true) {          $error = true;        }      }      if ($error === false) {        $osC_Database->commitTransaction();        return true;      } else {        $osC_Database->rollbackTransaction();        return false;      }    }  }?>

⌨️ 快捷键说明

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