当前位置: 首页>>代码示例>>PHP>>正文


PHP Purchase::delete方法代码示例

本文整理汇总了PHP中Purchase::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::delete方法的具体用法?PHP Purchase::delete怎么用?PHP Purchase::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Purchase的用法示例。


在下文中一共展示了Purchase::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  * Orders admin flow handlers
  */
 function orders_list()
 {
     global $Shopp, $Orders;
     $db = DB::get();
     $defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'per_page' => false, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     if (!current_user_can(SHOPP_USERLEVEL)) {
         wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp'));
     }
     if ($page == "shopp-orders" && !empty($deleting) && !empty($selected) && is_array($selected)) {
         foreach ($selected as $selection) {
             $Purchase = new Purchase($selection);
             $Purchase->load_purchased();
             foreach ($Purchase->purchased as $purchased) {
                 $Purchased = new Purchased($purchased->id);
                 $Purchased->delete();
             }
             $Purchase->delete();
         }
     }
     $statusLabels = $this->Settings->get('order_status');
     if (empty($statusLabels)) {
         $statusLabels = array('');
     }
     $txnStatusLabels = array('PENDING' => __('Pending', 'Shopp'), 'CHARGED' => __('Charged', 'Shopp'), 'REFUNDED' => __('Refunded', 'Shopp'), 'VOID' => __('Void', 'Shopp'));
     if ($update == "order" && !empty($selected) && is_array($selected)) {
         foreach ($selected as $selection) {
             $Purchase = new Purchase($selection);
             $Purchase->status = $newstatus;
             $Purchase->save();
         }
     }
     $Purchase = new Purchase();
     if (!empty($start)) {
         $startdate = $start;
         list($month, $day, $year) = explode("/", $startdate);
         $starts = mktime(0, 0, 0, $month, $day, $year);
     }
     if (!empty($end)) {
         $enddate = $end;
         list($month, $day, $year) = explode("/", $enddate);
         $ends = mktime(23, 59, 59, $month, $day, $year);
     }
     $pagenum = absint($pagenum);
     if (empty($pagenum)) {
         $pagenum = 1;
     }
     if (!$per_page || $per_page < 0) {
         $per_page = 20;
     }
     $start = $per_page * ($pagenum - 1);
     $where = '';
     if (!empty($status) || $status === '0') {
         $where = "WHERE status='{$status}'";
     }
     if (!empty($s)) {
         $s = stripslashes($s);
         if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER) > 0) {
             foreach ($props as $search) {
                 $keyword = !empty($search[2]) ? $search[2] : $search[3];
                 switch (strtolower($search[1])) {
                     case "txn":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "transactionid='{$keyword}'";
                         break;
                     case "gateway":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "gateway LIKE '%{$keyword}%'";
                         break;
                     case "cardtype":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "cardtype LIKE '%{$keyword}%'";
                         break;
                     case "address":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "(address LIKE '%{$keyword}%' OR xaddress='%{$keyword}%')";
                         break;
                     case "city":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "city LIKE '%{$keyword}%'";
                         break;
                     case "province":
                     case "state":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "state='{$keyword}'";
                         break;
                     case "zip":
                     case "zipcode":
                     case "postcode":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "postcode='{$keyword}'";
                         break;
                     case "country":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "country='{$keyword}'";
                         break;
                 }
             }
             if (empty($where)) {
                 $where .= (empty($where) ? "WHERE " : " AND ") . " (id='{$s}' OR CONCAT(firstname,' ',lastname) LIKE '%{$s}%')";
             }
         } elseif (strpos($s, '@') !== false) {
             $where .= (empty($where) ? "WHERE " : " AND ") . " email='{$s}'";
         } else {
//.........这里部分代码省略.........
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:101,代码来源:Flow.php


注:本文中的Purchase::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。