コード例 #1
0
 /**
  * Add custom order actions in order list view
  *
  * @since 1.0.0
  * @param array $actions
  * @param \WC_Order $order
  * @return array
  */
 public function custom_order_actions($actions, WC_Order $order)
 {
     $status = new WC_Order_Status_Manager_Order_Status($order->get_status());
     // Sanity check: bail if no status was found.
     // This can happen if some statuses are registered late
     if (!$status || !$status->get_id()) {
         return $actions;
     }
     $next_statuses = $status->get_next_statuses();
     $order_statuses = wc_get_order_statuses();
     $custom_actions = array();
     // TODO: Change action to `woocommerce_mark_order_status` for 2.3.x compatibility
     // TODO: Change nonce_action to `woocommerce-mark-order-status` for 2.3.x compatibility
     $action = 'wc_order_status_manager_mark_order_status';
     $nonce_action = 'wc-order-status-manager-mark-order-status';
     // Add next statuses as actions
     if (!empty($next_statuses)) {
         foreach ($next_statuses as $next_status) {
             $custom_actions[$next_status] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=' . $action . '&status=' . $next_status . '&order_id=' . $order->id), $nonce_action), 'name' => $order_statuses['wc-' . $next_status], 'action' => $next_status);
             // Remove duplicate built-in complete action
             if ('completed' === $next_status) {
                 unset($actions['complete']);
             }
         }
     }
     // Next status actions are prepended to any existing actions
     return $custom_actions + $actions;
 }
コード例 #2
0
 public function add_meta_boxes()
 {
     global $post;
     if (isset($_GET['post'])) {
         if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_escrow_bank') {
             $payment_method = get_post_meta($_GET['post'], '_payment_method', true);
             $tmp_settings = get_option('woocommerce_' . $payment_method . '_settings', true);
             $refund_mypage_status = $tmp_settings['possible_register_delivery_info_status_for_admin'];
             //관리자 배송정보 등록/환불 가능 주문상태 지정
             $order = new WC_Order($post->ID);
             $paid_order = get_post_meta($post->ID, "_paid_date", true);
             if (in_array($order->get_status(), $refund_mypage_status) && !empty($paid_order)) {
                 add_meta_box('ifw-order-escrow-register-delivery-request', __('이니시스 에스크로', 'codem_inicis'), 'IFW_Meta_Box_Escrow_Register_Delivery::output', 'shop_order', 'side', 'default');
             }
         } else {
             if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_vbank') {
                 add_meta_box('ifw-order-vbank-refund-request', __('가상계좌 무통장입금 환불 처리', 'codem_inicis'), 'IFW_Meta_Box_Vbank_Refund::output', 'shop_order', 'side', 'default');
             } else {
                 if (in_array(get_post_meta($_GET['post'], '_payment_method', true), array('inicis_card', 'inicis_bank', 'inicis_hpp', 'inicis_kpay', 'inicis_stdcard'))) {
                     $order = new WC_Order($_GET['post']);
                     if (!in_array($order->get_status(), array('pending', 'on-hold'))) {
                         add_meta_box('ifw-order-refund-request', __('결제내역', 'codem_inicis'), 'IFW_Meta_Box_Refund::output', 'shop_order', 'side', 'default');
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
 /**
  * Checks if order is paid
  * @return bool
  */
 public function is_paid()
 {
     $payment_methods = apply_filters('bewpi_paid_watermark_excluded_payment_methods', array('bacs', 'cod', 'cheque'), $this->order->id);
     if (in_array($this->order->payment_method, $payment_methods)) {
         return false;
     }
     $order_statuses = apply_filters('bewpi_paid_watermark_excluded_order_statuses', array('pending', 'on-hold', 'auto-draft'), $this->order->id);
     return !in_array($this->order->get_status(), $order_statuses);
 }
コード例 #4
0
 /**
  * Output for the order received page.
  */
 public function thankyou_page($order_id)
 {
     $order = new WC_Order($order_id);
     if ('completed' == $order->get_status()) {
         echo '<p>' . __('Your booking has been confirmed. Thank you.', 'woocommerce-bookings') . '</p>';
     } else {
         echo '<p>' . __('Your booking is awaiting confirmation. You will be notified by email as soon as we\'ve confirmed availability.', 'woocommerce-bookings') . '</p>';
     }
 }
コード例 #5
0
ファイル: index.php プロジェクト: veronalabs/wp-sms
function wps_wcc_new_order($order_id)
{
    global $sms, $wps_options;
    $order = new WC_Order($order_id);
    if (!$get_mobile) {
        return;
    }
    $sms->to = array(get_option('wp_admin_mobile'));
    $string = $wps_options['wpsms_wc_no_tt'];
    $template_vars = array('order_id' => $order_id, 'status' => $order->get_status(), 'order_name' => $order->get_order_number());
    $final_message = preg_replace('/%(.*?)%/ime', "\$template_vars['\$1']", $string);
    $sms->msg = $final_message;
    $sms->SendSMS();
}
コード例 #6
0
            function thankyou_page($order_id)
            {
                if (empty($order_id)) {
                    return;
                }
                $order = new WC_Order($order_id);
                if ($order->payment_method != 'inicis_vbank' || $order->get_status() == 'failed') {
                    return;
                }
                $VACT_BankCodeName = get_post_meta($order_id, 'VACT_BankCodeName', true);
                //입금은행명/코드
                $VACT_Num = get_post_meta($order_id, 'VACT_Num', true);
                //계좌번호
                $VACT_Name = get_post_meta($order_id, 'VACT_Name', true);
                //예금주
                $VACT_InputName = get_post_meta($order_id, 'VACT_InputName', true);
                //송금자
                $VACT_Date = get_post_meta($order_id, 'VACT_Date', true);
                //입금예정일
                $vact_date_format = date(__('Y년 m월 d일', 'inicis_payment'), strtotime($VACT_Date));
                echo '<h2>' . __('가상계좌 무통장입금 안내', 'inicis_payment') . '</h2>';
                echo '<p>' . __('가상계좌 무통장입금 안내로 주문이 접수되었습니다. 아래 지정된 계좌번호로 입금기한내에 반드시 입금하셔야 하며, 송금자명으로 입금 해주셔야 주문이 정상 접수 됩니다.', 'inicis_payment') . '</p>';
                echo '
				<table name="inicis_vbank_account_table" id="inicis_vbank_account_table" class="inicis_vbank_account_table">
					<tbody>';
                echo '<tr>';
                echo '	<th>' . __('은행명:', 'inicis_payment') . '</th>';
                echo '	<td data-title="' . __('은행명:', 'inicis_payment') . '">' . $VACT_BankCodeName . '</td>';
                echo '</tr>';
                echo '<tr>';
                echo '	<th>' . __('계좌번호:', 'inicis_payment') . '</th>';
                echo '	<td data-title="' . __('계좌번호:', 'inicis_payment') . '">' . $VACT_Num . '</td>';
                echo '</tr>';
                echo '<tr>';
                echo '	<th>' . __('예금주:', 'inicis_payment') . '</th>';
                echo '	<td data-title="' . __('예금주:', 'inicis_payment') . '">' . $VACT_Name . '</td>';
                echo '</tr>';
                echo '<tr>';
                echo '	<th>' . __('송금자:', 'inicis_payment') . '</th>';
                echo '	<td data-title="' . __('송금자:', 'inicis_payment') . '">' . $VACT_InputName . '</td>';
                echo '</tr>';
                echo '<tr>';
                echo '	<th>' . __('입금기한:', 'inicis_payment') . '</th>';
                echo '	<td data-title="' . __('입금기한:', 'inicis_payment') . '">' . $vact_date_format . '</td>';
                echo '</tr>';
                echo '</tbody></table>';
            }
コード例 #7
0
ファイル: index.php プロジェクト: umarsheikh13/woogiving
function woogiving_process_donation()
{
    // Setup post variables
    $wg_order_id = $_POST['wg_order_id'];
    $jg_donation_id = $_POST['jg_donation_id'];
    if (is_numeric($wg_order_id) && ctype_alnum($jg_donation_id)) {
        // Validate order ID
        $wg_order_id_validation = get_post((int) $wg_order_id);
        if ($wg_order_id_validation) {
            // Get options
            $wg_options = get_option('woocommerce_woogiving_settings');
            // Include JG API and setup API
            require_once 'inc/JustGivingClient.php';
            $jg_client = new JustGivingClient('https://api.justgiving.com/', $wg_options['app_id'], 1, $wg_options['api_login'], $wg_options['api_password']);
            // Check if donation exists in JG
            $wg_donation_id_check = $jg_client->Donation->RetrieveRef(woogiving_create_ref($wg_order_id_validation->ID));
            if (count($wg_donation_id_check->donations)) {
                // Check if donations IDs match
                if ($wg_donation_id_check->donations[0]->id == (int) $jg_donation_id) {
                    // Get donation details from JG
                    $wg_donation_id_status = $jg_client->Donation->RetrieveStatus($jg_donation_id);
                    $jg_amount = $wg_donation_id_status->amount;
                    $jg_status = $wg_donation_id_status->status;
                    // Get customer order
                    $customer_order = new WC_Order($wg_order_id_validation->ID);
                    // Check if amount donated is equal to higher than the amount in the order
                    if ($jg_amount >= $customer_order->order_total && $jg_status == 'Accepted') {
                        // Get JG fundraising page ID
                        $wg_jg_page_check = $jg_client->Page->Retrieve($wg_options['username']);
                        // Check if donation was made to correct charity
                        if ($wg_jg_page_check->charity->id == $wg_donation_id_check->donations[0]->charityId) {
                            // Check order status
                            if ($customer_order->get_status() == 'completed') {
                                // Order has already been completed
                                return json_encode(array('wg_status' => 'failure', 'wg_message' => __('This donation has already been processed.', 'woogiving')));
                            } else {
                                // Reduce stock levels and complete payment
                                $customer_order->reduce_order_stock();
                                $customer_order->payment_complete($jg_donation_id);
                                $customer_order->update_status('completed');
                                return json_encode(array('wg_status' => 'success', 'wg_redirect' => woogiving_get_return_url($customer_order)));
                            }
                        } else {
                            return json_encode(array('wg_status' => 'failure', 'wg_message' => __('This donation cannot be processed, please contact us.', 'woogiving')));
                        }
                    }
                } else {
                    return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Invalid donation ID.', 'woogiving')));
                }
            } else {
                return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Invalid donation ID.', 'woogiving')));
            }
        } else {
            return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Donation could not be processed.', 'woogiving')));
        }
    } else {
        return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Donation could not be processed.', 'woogiving')));
    }
}
コード例 #8
0
 /**
  * The the Order's status
  * @param WC_Order $order
  * @return string
  */
 public static function get_order_status(WC_Order $order)
 {
     if (self::is_wc_version_gte_2_2()) {
         return $order->get_status();
     } else {
         return $order->status;
     }
 }
コード例 #9
0
 function successful_request_mobile_return($posted)
 {
     global $woocommerce;
     if ($this->id == 'inicis_bank' && wp_is_mobile()) {
         $get_type = $_GET['type'];
         $tmp_rst = explode(',', $get_type);
         $tmp_oid = $tmp_rst[1];
         $tmp_rst = explode('=', $tmp_oid);
         $oid = $tmp_rst[1];
         $tmp_rst = explode('_', $oid);
         $orderid = $tmp_rst[0];
         $order = new WC_Order($orderid);
         if (in_array($order->get_status(), array('pending', 'failed'))) {
             wc_add_notice(__('결제를 취소하셨습니다.  (ERROR: 0xF53D)', 'inicis_payment'), 'error');
             wp_redirect(WC()->cart->get_checkout_url());
             exit;
         }
     }
 }
コード例 #10
0
ファイル: crud.php プロジェクト: woocommerce/woocommerce
 /**
  * Test: update_status
  */
 function test_update_status()
 {
     $object = new WC_Order();
     $this->assertFalse($object->update_status('on-hold'));
     $object->save();
     $this->assertTrue($object->update_status('on-hold'));
     $this->assertEquals('on-hold', $object->get_status());
 }
コード例 #11
0
<?php

require_once 'request.php';
require_once 'ResponseHandler.php';
require_once 'PlexDataSourceKey.php';
wp_head();
$args = array('posts_per_page' => -1, 'post_type' => 'shop_order', 'post_status' => 'publish');
$starting_time = microtime(true);
$orders = new WP_Query($args);
$inc = 0;
if ($orders->have_posts()) {
    while ($orders->have_posts()) {
        $orders->the_post();
        $order = new WC_Order($post->ID);
        if ('processing' == $order->get_status()) {
            echo '<br>';
            $inc++;
            $plexOrderId = get_post_meta($post->ID, 'plexOrderId', true);
            if ('' != $plexOrderId) {
                $orderStatus = getOrderStatusFromPlex($plexOrderId);
                echo 'orderStatus for plex order id=' . $plexOrderId . ' is = ' . $orderStatus;
            }
            echo '<br>';
        } else {
        }
    }
}
$end_time = microtime(true);
/* This function will return the status string */
function getOrderStatusFromPlex($plexOrderId)
{
コード例 #12
0
 function do_background_checks($explicit = false)
 {
     $statuses = array();
     $min_age = $this->pending_order_check_min_age;
     if ($explicit == true) {
         $min_age = 0;
     }
     $orders = $this->get_pending_orders($min_age);
     if ('yes' == $this->debug) {
         $c_orders = 0;
         if ($orders) {
             $c_orders = count($orders);
         }
         $this->log->add($this->id, "do_background_checks: #orders=" . $c_orders);
     }
     if ($orders) {
         foreach ($orders as $ordera) {
             $order_id = $ordera->order_id;
             $order = new WC_Order($order_id);
             /*if (!$order->needs_payment()) {
                 if ( 'yes' == $this->debug ) 
                   $this->log->add($this->id, "    order: #".$order->id . " (".$order->get_status().") does not need payment. removing from the queue.");
               
                 $this->remove_from_maksuturva_queue($ordera->order_id, $ordera->payment_id);
                 continue;
               }*/
             if ('yes' == $this->debug) {
                 $this->log->add($this->id, "    process status_query for order: #" . $order->id . " (" . $order->get_status() . ") ");
             }
             $response = $this->status_request($order);
             $status = $response['status'];
             if ($response['status'] === 'false') {
                 if ($response['exception'] == 'true') {
                     if ('yes' == $this->debug) {
                         $this->log->add($this->id, "    Error: " . $response['response']);
                     }
                     $statuses[] = array('id' => $order->id, 'message' => __('Error:', $this->td) . ": " . $response['response']);
                 } else {
                     $statuses[] = array('id' => $order->id, 'message' => __('Error: order not found on Maksuturva', $this->td) . ": " . $response['response']);
                     if ('yes' == $this->debug) {
                         $this->log->add($this->id, "    order #" . $order->id . " not found. Removing from the queue...");
                     }
                     $this->remove_from_maksuturva_queue($ordera->order_id, $ordera->payment_id);
                     $order->cancel_order();
                 }
                 continue;
             }
             if ('yes' == $this->debug) {
                 $this->log->add($this->id, "    process_status_query_result");
             }
             $res = $this->process_status_query_result($order, $response['response'], $ordera);
             if ($order->needs_payment()) {
                 $statuses[] = $res;
             }
         }
     }
     return $statuses;
 }
コード例 #13
0
ファイル: Serializers.php プロジェクト: aplazame/woocommerce
 /**
  * @param array $qs
  *
  * @return array
  */
 public static function get_history($qs)
 {
     $orders = array();
     foreach ($qs as $item => $values) {
         $order = new WC_Order($qs[$item]->ID);
         $orderDate = new DateTime($order->order_date);
         $orders[] = array('id' => (string) $order->id, 'amount' => Aplazame_Filters::decimals($order->get_total()), 'due' => '', 'status' => $order->get_status(), 'type' => Aplazame_Helpers::get_payment_method($order->id), 'order_date' => $orderDate->format(DATE_ISO8601), 'currency' => $order->get_order_currency(), 'billing' => self::get_address($order, 'billing'), 'shipping' => self::get_shipping_info($order));
     }
     return $orders;
 }
 /**
  * @param WC_Order $wc_order
  */
 static function send_booking($wc_order)
 {
     $order = new Bring_WC_Order_Adapter($wc_order);
     $order_id = $wc_order->id;
     $test_mode = self::is_test_mode();
     $api_key = self::get_api_key();
     $api_uid = self::get_api_uid();
     $client_url = self::get_client_url();
     $customer_number = isset($_REQUEST['_bring-customer-number']) ? $_REQUEST['_bring-customer-number'] : '';
     if (isset($_REQUEST['_bring-shipping-date']) && isset($_REQUEST['_bring-shipping-date-hour']) && isset($_REQUEST['_bring-shipping-date-minutes'])) {
         $shipping_date_time = $_REQUEST['_bring-shipping-date'] . 'T' . $_REQUEST['_bring-shipping-date-hour'] . ':' . $_REQUEST['_bring-shipping-date-minutes'] . ':00';
     } else {
         $shipping_date = self::create_shipping_date();
         $shipping_date_time = $shipping_date['date'] . "T" . $shipping_date['hour'] . ":" . $shipping_date['minute'] . ":00";
     }
     $additional_info = '';
     if (isset($_REQUEST['_bring_additional_info'])) {
         $additional_info = filter_var($_REQUEST['_bring_additional_info'], FILTER_SANITIZE_STRING);
     }
     $sender_address = self::get_sender_address($additional_info);
     $recipient_address = $order->get_recipient_address_formatted();
     // One booking request per. order shipping item.
     foreach ($order->get_fraktguiden_shipping_items() as $item_id => $shipping_method) {
         $service_id = Fraktguiden_Helper::parse_shipping_method_id($shipping_method['method_id'])['service'];
         $packages = $order->get_packages_formatted($item_id);
         $pickup_point = $order->get_pickup_point_for_shipping_item_formatted($item_id);
         $booking_request = new Bring_Booking_Request(new WP_Bring_Request());
         $booking_request->set_test_mode($test_mode)->set_content_type('application/json')->set_accept('application/json')->set_api_key($api_key)->set_api_uid($api_uid)->set_client_url($client_url);
         $consignment = new Bring_Booking_Consignment_Creator();
         $consignment->set_purchase_order($order_id)->set_shipping_date_time($shipping_date_time)->set_sender_address($sender_address)->set_recipient_address($recipient_address)->set_product_id($service_id)->set_customer_number($customer_number)->set_packages($packages);
         if (!empty($pickup_point)) {
             $consignment->set_pickup_point($pickup_point);
         }
         if (Fraktguiden_Helper::get_option('evarsling') == 'yes') {
             $product_services = ['recipientNotification' => ['email' => $recipient_address['contact']['email'], 'mobile' => $recipient_address['contact']['phoneNumber']]];
             $consignment->set_product_services($product_services);
         }
         $booking_request->add_consignment_data($consignment->create_data());
         // Start sending the booking
         if ($booking_request->is_valid()) {
             $original_order_status = $wc_order->get_status();
             // Set order status to awaiting shipping.
             $wc_order->update_status('wc-bring-shipment');
             // Send the booking.
             $response = $booking_request->send();
             // Save the response json to the order.
             $order->update_booking_response($response);
             // Download labels pdf
             if (!$order->has_booking_errors()) {
                 Bring_Booking_Labels::download_to_local($order);
             }
             // Create new status and order note.
             if (!$order->has_booking_errors()) {
                 // Check if the plugin has been configured to set a specific order status after success.
                 $status = Fraktguiden_Helper::get_option('auto_set_status_after_booking_success');
                 if ($status == 'none') {
                     // Set status back to the previous status
                     $status = $original_order_status;
                 }
                 $status_note = __("Booked with Bring" . "\n", 'bring-fraktguiden');
             } else {
                 // If there are errors, set the status back to the original status.
                 $status = $original_order_status;
                 $status_note = __("Booking errors. See the Bring Booking box for details." . "\n", 'bring-fraktguiden');
             }
             // Update status.
             $wc_order->update_status($status, $status_note);
         } else {
             // @todo: Not valid. show message?
         }
     }
 }
コード例 #15
0
 public function order_delivery($order_id = 0)
 {
     if (!$order_id || !$this->settings['pickup_location'] || !$this->settings['pickup_name'] || !$this->settings['pickup_phone']) {
         return false;
     }
     // Get order object
     $order = new WC_Order($order_id);
     if (!$order) {
         return false;
     }
     // Get customer user ID
     $user = $order->get_user();
     if (!$user) {
         return false;
     }
     $delivery_address = str_replace('<br/>', ', ', $order->get_formatted_shipping_address());
     if (!$delivery_address) {
         return false;
     }
     if (!$order->billing_phone) {
         return false;
     }
     $delivery_address_data = $this->get_address_data($delivery_address);
     $args = array('pickup_address' => (string) $this->settings['pickup_location'], 'pickup_contact_name' => (string) $this->settings['pickup_name'], 'pickup_contact_phone' => (string) $this->settings['pickup_phone'], 'customer_identifier' => (string) $user->user_login, 'dropoff_contact_name' => (string) $user->display_name, 'dropoff_contact_phone' => (string) $order->billing_phone, 'dropoff_address' => (string) $delivery_address_data['address'], 'dropoff_coordinates' => (string) $delivery_address_data['location']);
     if ($this->settings['pickup_coords']) {
         $args['pickup_coordinates'] = (string) $this->settings['pickup_coords'];
     }
     if ($this->settings['pickup_remarks']) {
         $args['pickup_remarks'] = (string) $this->settings['pickup_remarks'];
     }
     if ($this->settings['city']) {
         $args['city'] = (string) $this->settings['city'];
     }
     $delivery_notes = $order->customer_note;
     if ($delivery_notes) {
         $args['dropoff_remarks'] = (string) $this->settings['delivery_notes'];
     }
     $delivery = $this->api('deliveries', $args, 'post');
     if ($delivery && isset($delivery->id)) {
         update_post_meta($order_id, '_wumdrop_delivery_id', $delivery->id);
         if (isset($delivery->distance_estimate)) {
             update_post_meta($order_id, '_wumdrop_distance_estimate', $delivery->distance_estimate);
         }
         if (isset($delivery->time_estimate)) {
             update_post_meta($order_id, '_wumdrop_time_estimate', $delivery->time_estimate);
         }
         if (isset($delivery->message)) {
             update_post_meta($order_id, '_wumdrop_delivery_message', $delivery->message);
         }
         if (isset($delivery->time_estimate)) {
             update_post_meta($order_id, '_wumdrop_delivery_price', $delivery->price);
         }
         $order_note = __('WumDrop delivery order placed.', 'woocommerce-wumdrop');
         if ('completed' != $order->get_status()) {
             $order->update_status('completed', $order_note);
         } else {
             $order->add_order_note($order_note);
         }
         return true;
     }
     return false;
 }
コード例 #16
0
 function add_order_status_column_content($column)
 {
     global $post;
     if ('nfe' == $column) {
         $nfe = get_post_meta($post->ID, 'nfe', true);
         $order = new WC_Order($post->ID);
         if ($order->get_status() == 'pending' || $order->get_status() == 'cancelled') {
             echo '<span class="nfe_none">-</span>';
         } elseif ($nfe) {
             echo '<div class="nfe_success">NF-e Emitida</div>';
         } else {
             echo '<div class="nfe_alert">NF-e não emitida</div>';
         }
     }
 }
コード例 #17
0
 /**
  * Get the order status
  *
  * Order statuses changed from a taxonomy in 2.1 to using `post_status`
  * in 2.2
  *
  * @since 3.0.0
  * @param WC_Order $order
  * @return mixed|string
  */
 public static function get_order_status(WC_Order $order)
 {
     return self::is_wc_version_gte_2_2() ? $order->get_status() : $order->status;
 }
コード例 #18
0
 private function convert_order_status(WC_Order $order)
 {
     $status = $order->get_status();
     switch ($status) {
         case 'completed':
             return '$fulfilled';
         case 'cancelled':
             return '$canceled';
         case 'on-hold':
             return '$held';
         case 'refunded':
             return '$returned';
         case 'processing':
             return '$approved';
         case 'pending':
         case 'failed':
         default:
             return null;
     }
 }
コード例 #19
0
 public function inicis_order_received_title($title, $id)
 {
     if (is_order_received_page() && get_the_ID() === $id) {
         global $wp;
         $order_id = apply_filters('woocommerce_thankyou_order_id', absint($wp->query_vars['order-received']));
         $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']));
         if (!empty($order_id)) {
             $order = new WC_Order($order_id);
             if ($order->get_status() == 'failed') {
                 $title = __('결제 실패로, 결제를 다시한번 진행 해 주시기 바랍니다.', 'inicis_payment');
             } else {
                 $title = __('정상적인 결제완료로 주문이 접수되었습니다.', 'inicis_payment');
             }
         } else {
             $title = __('정상적인 결제완료로 주문이 접수되었습니다.', 'inicis_payment');
         }
     }
     return $title;
 }
 /**
  * Capture and log when customer completes checkout
  *
  * @param  int $order_id
  * @return void
  */
 public function capture_sale_events($order_ids, $historic = false)
 {
     $products = array();
     foreach ($order_ids as $order_id) {
         $exported = get_post_meta($order_id, '_wc_graphflow_exported', true);
         if ('yes' !== $exported) {
             $order = new WC_Order($order_id);
             if (!$order) {
                 return;
             }
             $order_currency = $order->get_order_currency();
             $order_id = $order->id;
             $customer_ip_address = $order->customer_ip_address;
             $customer_user_agent = $order->customer_user_agent;
             // extract order status, different for WC 2.1 vs 2.2
             if (defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, '2.2', '>=')) {
                 $order_status = $order->get_status();
             } else {
                 $order_status = $order->status;
             }
             foreach ($order->get_items() as $order_item_id => $order_item) {
                 // extract the user id for the order
                 if ($historic == true) {
                     $order_user = isset($order->customer_user) ? $order->customer_user : $order->billing_email;
                     if ($order_user == 0) {
                         $order_user = $order->billing_email;
                     }
                 } else {
                     $order_user = $this->get_user_id();
                 }
                 // check if we can get the product, log an error message if not.
                 $product = get_product($order_item['product_id']);
                 if (!$product) {
                     $this->get_api()->log->add("graphflow", "Failed to get_product for id: " . $order_item['product_id'] . " during order export for order id: " . $order->id);
                     continue;
                 }
                 $this->maybe_capture_product($order_item['product_id']);
                 // timestamp in UTC
                 $time = new DateTime($order->order_date);
                 $time->setTimezone(new DateTimeZone('UTC'));
                 $timestamp_utc = $time->getTimestamp() * 1000;
                 $graphflow_order_item = array('fromId' => $order_user, 'toId' => $order_item['product_id'], 'interactionType' => 'purchase', 'price' => $product->get_price(), 'quantity' => $order_item['qty'], 'interactionData' => array('order_currency' => $order_currency, 'transactionId' => $order_id, 'remoteAddr' => $customer_ip_address, 'uaRaw' => $customer_user_agent, 'order_status' => $order_status), 'timestamp' => $timestamp_utc);
                 $products[] = $graphflow_order_item;
             }
             // For historical orders, only capture if not already captured
             if ($historic == false || 'yes' != get_user_meta($order_user, '_wc_graphflow_exported', true)) {
                 $this->capture_customer($order_user, $historic);
             }
         }
     }
     if (!empty($products)) {
         $this->get_api()->add_user_interactions($products);
     }
     foreach ($order_ids as $order_id) {
         // Set a meta field so we do not export again when visiting thanks page for this order
         update_post_meta($order_id, '_wc_graphflow_exported', 'yes');
     }
 }
コード例 #21
0
 /**
  * Checks if order is paid
  * @return bool
  */
 public function is_paid()
 {
     return in_array($this->order->get_status(), array('pending', 'on-hold', 'auto-draft')) ? false : true;
 }
 /**
  * Callback - Action - Add meta box - "Offer Summary"
  * Output hmtl for "Offer Summary" meta box
  * @since	0.1.0
  * @param WP_Post $post The object for the current post/page
  */
 public function add_meta_box_offer_summary_callback($post)
 {
     global $post, $wpdb;
     if ($post->ID) {
         $postmeta = get_post_meta($post->ID);
         $currency_symbol = get_woocommerce_currency_symbol();
         // Add an nonce field so we can check for it later.
         wp_nonce_field('woocommerce_offer_summary_metabox', 'woocommerce_offer_summary_metabox_noncename');
         /*
          * Use get_post_meta() to retrieve an existing value
          * from the database and use the value for the form.
          */
         $current_status_value = get_post_status($post->ID);
         /*
          * Set default
          */
         if (!isset($current_status_value)) {
             $current_status_value = 'publish';
         }
         // Lookup product data
         $product_id = $postmeta['offer_product_id'][0];
         $product_variant_id = isset($postmeta['offer_variation_id'][0]) && $postmeta['offer_variation_id'][0] != '' ? $postmeta['offer_variation_id'][0] : '';
         $_pf = new WC_Product_Factory();
         $_product = $_pf->get_product($product_id);
         if ($product_variant_id) {
             $_pf_variant = new WC_Product_Factory();
             $_product_variant = $_pf_variant->get_product($product_variant_id);
             $_product_variant_managing_stock = $_product_variant->managing_stock() == 'parent' ? true : false;
             $_product_sku = $_product_variant->get_sku() ? $_product_variant->get_sku() : $_product->get_sku();
             $_product_permalink = $_product_variant->get_permalink();
             $_product_attributes_resulat = $_product_variant->get_variation_attributes();
             foreach ($_product_attributes_resulat as $name => $attribute) {
                 $_product_attributes[] = wc_attribute_label(str_replace('attribute_', '', $name)) . ': <strong>' . $attribute . '</strong>';
             }
             $_product_regular_price = $_product_variant->get_regular_price() ? $_product_variant->get_regular_price() : $_product->get_regular_price();
             $_product_sale_price = $_product_variant->get_sale_price() ? $_product_variant->get_sale_price() : $_product->get_sale_price();
             $_product_managing_stock = $_product_variant->managing_stock() ? $_product_variant->managing_stock() : $_product->managing_stock();
             $_product_stock = $_product_variant_managing_stock ? $_product_variant->get_total_stock() : $_product->get_total_stock();
             $_product_in_stock = $_product_variant_managing_stock ? $_product_variant->has_enough_stock($postmeta['offer_quantity'][0]) : $_product->has_enough_stock($postmeta['offer_quantity'][0]);
             $_product_backorders_allowed = $_product_variant_managing_stock ? $_product_variant->backorders_allowed() : $_product->backorders_allowed();
             $_product_backorders_require_notification = $_product_variant_managing_stock ? $_product_variant->backorders_require_notification() : $_product->backorders_require_notification();
             $_product_formatted_name = $_product_variant->get_formatted_name();
             $_product_image = $_product_variant->get_image('shop_thumbnail') ? $_product_variant->get_image('shop_thumbnail') : $_product->get_image('shop_thumbnail');
         } else {
             $_product_sku = $_product->get_sku();
             $_product_attributes = $_product->get_attributes();
             $_product_permalink = $_product->get_permalink();
             $_product_regular_price = $_product->get_regular_price();
             $_product_sale_price = $_product->get_sale_price();
             $_product_managing_stock = $_product->managing_stock();
             $_product_stock = $_product->get_total_stock();
             $_product_in_stock = $_product->has_enough_stock($postmeta['offer_quantity'][0]);
             $_product_backorders_allowed = $_product->backorders_allowed();
             $_product_backorders_require_notification = $_product->backorders_require_notification();
             $_product_formatted_name = $_product->get_formatted_name();
             $_product_image = $_product->get_image('shop_thumbnail');
             // set error message if product not found...
         }
         /**
          * Set default expiration date on 'pending' offer expiration date input field
          * @since   1.2.0
          */
         if ($current_status_value == 'publish') {
             // get offers options - general
             $default_expire_date = '';
             $options_general = get_option('offers_for_woocommerce_options_general');
             if (!empty($options_general['general_setting_default_expire_days'])) {
                 $current_time = date("Y-m-d H:i:s", current_time('timestamp', 0));
                 $default_expire_days = str_replace(",", "", $options_general['general_setting_default_expire_days']);
                 $default_expire_date = $default_expire_days != '' ? date("m/d/Y", strtotime($current_time . ' + ' . $default_expire_days . ' days')) : '';
             }
             if ($default_expire_date != '') {
                 $postmeta['offer_expiration_date'] = array($default_expire_date);
             }
         }
         /**
          * Check to 'consider inventory' of product stock compared to offer quantities
          * @since   0.1.0
          */
         $offer_inventory_msg = '<strong>Notice: </strong>' . __('Product stock is lower than offer quantity!', $this->plugin_slug);
         $show_offer_inventory_msg = $_product_in_stock ? FALSE : TRUE;
         // Check for 'offer_order_id'
         if (isset($postmeta['offer_order_id'][0]) && is_numeric($postmeta['offer_order_id'][0])) {
             $order_id = $postmeta['offer_order_id'][0];
             // Set order meta data array
             $offer_order_meta = array();
             $offer_order_meta['Order ID'] = '<a href="post.php?post=' . $order_id . '&action=edit">' . '#' . $order_id . '</a>';
             // Get Order
             $order = new WC_Order($order_id);
             if ($order->post) {
                 $offer_order_meta['Order Date'] = $order->post->post_date;
                 $offer_order_meta['Order Status'] = ucwords($order->get_status());
             } else {
                 $offer_order_meta['Order ID'] .= '<br /><small><strong>Notice: </strong>' . __('Order not found; may have been deleted', $this->plugin_slug) . '</small>';
             }
         }
         // set author_data
         $author_data = get_userdata($post->post_author);
         // set author offer counts
         $author_counts = array();
         if ($author_data) {
             // count offers by author id
             $post_type = 'woocommerce_offer';
             $args = array($post_type, 'trash', $post->post_author);
             $count_all = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status != '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'publish', $post->post_author);
             $count_pending = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'accepted-offer', $post->post_author);
             $count_accepted = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'countered-offer', $post->post_author);
             $count_countered = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'buyercountered-offer', $post->post_author);
             $count_buyer_countered = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'declined-offer', $post->post_author);
             $count_declined = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'completed-offer', $post->post_author);
             $count_completed = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'on-hold-offer', $post->post_author);
             $count_on_hold = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $args = array($post_type, 'expired-offer', $post->post_author);
             $count_expired = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status = '%s' AND post_author = '%s'", $args));
             $author_counts['all'] = apply_filters('get_usernumposts', $count_all, $post->post_author);
             $author_counts['pending'] = apply_filters('get_usernumposts', $count_pending, $post->post_author);
             $author_counts['accepted'] = apply_filters('get_usernumposts', $count_accepted, $post->post_author);
             $author_counts['countered'] = apply_filters('get_usernumposts', $count_countered, $post->post_author);
             $author_counts['buyercountered'] = apply_filters('get_usernumposts', $count_buyer_countered, $post->post_author);
             $author_counts['declined'] = apply_filters('get_usernumposts', $count_declined, $post->post_author);
             $author_counts['completed'] = apply_filters('get_usernumposts', $count_completed, $post->post_author);
             $author_counts['on_hold'] = apply_filters('get_usernumposts', $count_on_hold, $post->post_author);
             $author_counts['expired'] = apply_filters('get_usernumposts', $count_expired, $post->post_author);
             $author_data->offer_counts = $author_counts;
         }
         $query_counter_offers_history = $wpdb->prepare("SELECT * FROM {$wpdb->commentmeta} INNER JOIN {$wpdb->comments} ON {$wpdb->commentmeta}.comment_id = {$wpdb->comments}.comment_ID WHERE {$wpdb->commentmeta}.meta_value = '%d' AND {$wpdb->comments}.comment_type = 'offers-history' ORDER BY comment_date ASC", $post->ID);
         $query_counter_offers_history_result = $wpdb->get_results($query_counter_offers_history);
         /**
          * Output html for Offer Comments loop
          */
         include_once 'views/meta-panel-summary.php';
     }
 }
コード例 #23
0
 /**
  * Overrides the WC Order get_status function for draft and auto-draft statuses for a subscription
  * so that it will return a pending status instead of draft / auto-draft.
  *
  * @since 2.0
  * @return string Status
  */
 public function get_status()
 {
     if (in_array(get_post_status($this->id), array('draft', 'auto-draft'))) {
         $this->post_status = 'wc-pending';
         $status = apply_filters('woocommerce_order_get_status', 'pending', $this);
     } else {
         $status = parent::get_status();
     }
     return $status;
 }
コード例 #24
0
 /**
  * Get the order data for the given ID.
  *
  * @since  2.5.0
  * @param  WC_Order $order The order instance
  * @return array
  */
 protected function get_order_data($order)
 {
     $order_post = get_post($order->id);
     $dp = wc_get_price_decimals();
     $order_data = array('id' => $order->id, 'order_number' => $order->get_order_number(), 'created_at' => $this->format_datetime($order_post->post_date_gmt), 'updated_at' => $this->format_datetime($order_post->post_modified_gmt), 'completed_at' => $this->format_datetime($order->completed_date, true), 'status' => $order->get_status(), 'currency' => $order->get_order_currency(), 'total' => wc_format_decimal($order->get_total(), $dp), 'subtotal' => wc_format_decimal($order->get_subtotal(), $dp), 'total_line_items_quantity' => $order->get_item_count(), 'total_tax' => wc_format_decimal($order->get_total_tax(), $dp), 'total_shipping' => wc_format_decimal($order->get_total_shipping(), $dp), 'cart_tax' => wc_format_decimal($order->get_cart_tax(), $dp), 'shipping_tax' => wc_format_decimal($order->get_shipping_tax(), $dp), 'total_discount' => wc_format_decimal($order->get_total_discount(), $dp), 'shipping_methods' => $order->get_shipping_method(), 'payment_details' => array('method_id' => $order->payment_method, 'method_title' => $order->payment_method_title, 'paid' => isset($order->paid_date)), 'billing_address' => array('first_name' => $order->billing_first_name, 'last_name' => $order->billing_last_name, 'company' => $order->billing_company, 'address_1' => $order->billing_address_1, 'address_2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'postcode' => $order->billing_postcode, 'country' => $order->billing_country, 'email' => $order->billing_email, 'phone' => $order->billing_phone), 'shipping_address' => array('first_name' => $order->shipping_first_name, 'last_name' => $order->shipping_last_name, 'company' => $order->shipping_company, 'address_1' => $order->shipping_address_1, 'address_2' => $order->shipping_address_2, 'city' => $order->shipping_city, 'state' => $order->shipping_state, 'postcode' => $order->shipping_postcode, 'country' => $order->shipping_country), 'note' => $order->customer_note, 'customer_ip' => $order->customer_ip_address, 'customer_user_agent' => $order->customer_user_agent, 'customer_id' => $order->get_user_id(), 'view_order_url' => $order->get_view_order_url(), 'line_items' => array(), 'shipping_lines' => array(), 'tax_lines' => array(), 'fee_lines' => array(), 'coupon_lines' => array());
     // add line items
     foreach ($order->get_items() as $item_id => $item) {
         $product = $order->get_product_from_item($item);
         $product_id = null;
         $product_sku = null;
         // Check if the product exists.
         if (is_object($product)) {
             $product_id = isset($product->variation_id) ? $product->variation_id : $product->id;
             $product_sku = $product->get_sku();
         }
         $meta = new WC_Order_Item_Meta($item, $product);
         $item_meta = array();
         foreach ($meta->get_formatted(null) as $meta_key => $formatted_meta) {
             $item_meta[] = array('key' => $meta_key, 'label' => $formatted_meta['label'], 'value' => $formatted_meta['value']);
         }
         $order_data['line_items'][] = array('id' => $item_id, 'subtotal' => wc_format_decimal($order->get_line_subtotal($item, false, false), $dp), 'subtotal_tax' => wc_format_decimal($item['line_subtotal_tax'], $dp), 'total' => wc_format_decimal($order->get_line_total($item, false, false), $dp), 'total_tax' => wc_format_decimal($item['line_tax'], $dp), 'price' => wc_format_decimal($order->get_item_total($item, false, false), $dp), 'quantity' => wc_stock_amount($item['qty']), 'tax_class' => !empty($item['tax_class']) ? $item['tax_class'] : null, 'name' => $item['name'], 'product_id' => $product_id, 'sku' => $product_sku, 'meta' => $item_meta);
     }
     // Add shipping.
     foreach ($order->get_shipping_methods() as $shipping_item_id => $shipping_item) {
         $order_data['shipping_lines'][] = array('id' => $shipping_item_id, 'method_id' => $shipping_item['method_id'], 'method_title' => $shipping_item['name'], 'total' => wc_format_decimal($shipping_item['cost'], $dp));
     }
     // Add taxes.
     foreach ($order->get_tax_totals() as $tax_code => $tax) {
         $order_data['tax_lines'][] = array('id' => $tax->id, 'rate_id' => $tax->rate_id, 'code' => $tax_code, 'title' => $tax->label, 'total' => wc_format_decimal($tax->amount, $dp), 'compound' => (bool) $tax->is_compound);
     }
     // Add fees.
     foreach ($order->get_fees() as $fee_item_id => $fee_item) {
         $order_data['fee_lines'][] = array('id' => $fee_item_id, 'title' => $fee_item['name'], 'tax_class' => !empty($fee_item['tax_class']) ? $fee_item['tax_class'] : null, 'total' => wc_format_decimal($order->get_line_total($fee_item), $dp), 'total_tax' => wc_format_decimal($order->get_line_tax($fee_item), $dp));
     }
     // Add coupons.
     foreach ($order->get_items('coupon') as $coupon_item_id => $coupon_item) {
         $order_data['coupon_lines'][] = array('id' => $coupon_item_id, 'code' => $coupon_item['name'], 'amount' => wc_format_decimal($coupon_item['discount_amount'], $dp));
     }
     $order_data = apply_filters('woocommerce_cli_order_data', $order_data);
     return $this->flatten_array($order_data);
 }
コード例 #25
0
 /**
  * Process a pre-order payment when the pre-order is released.
  *
  * @param WC_Order $order
  * @return wp_error|null
  */
 public function process_pre_order_release_payment($order)
 {
     try {
         $order_items = $order->get_items();
         $order_item = array_shift($order_items);
         $pre_order_name = sprintf(__('%s - Pre-order for "%s"', 'woocommerce'), esc_html(get_bloginfo('name', 'display')), $order_item['name']) . ' ' . sprintf(__('(Order #%s)', 'woocommerce'), $order->get_order_number());
         $customer_id = get_post_meta($order->id, '_simplify_customer_id', true);
         if (!$customer_id) {
             return new WP_Error('simplify_error', __('Customer not found', 'woocommerce'));
         }
         // Charge the customer
         $payment = Simplify_Payment::createPayment(array('amount' => $order->order_total * 100, 'customer' => $customer_id, 'description' => trim(substr($pre_order_name, 0, 1024)), 'currency' => strtoupper(get_woocommerce_currency()), 'reference' => $order->id));
         if ('APPROVED' == $payment->paymentStatus) {
             // Payment complete
             $order->payment_complete($payment->id);
             // Add order note
             $order->add_order_note(sprintf(__('Simplify payment approved (ID: %s, Auth Code: %s)', 'woocommerce'), $payment->id, $payment->authCode));
         } else {
             return new WP_Error('simplify_payment_declined', __('Payment was declined - the customer need to try another card.', 'woocommerce'));
         }
     } catch (Exception $e) {
         $order_note = sprintf(__('Simplify Transaction Failed (%s)', 'woocommerce'), $e->getMessage());
         // Mark order as failed if not already set,
         // otherwise, make sure we add the order note so we can detect when someone fails to check out multiple times
         if ('failed' != $order->get_status()) {
             $order->update_status('failed', $order_note);
         } else {
             $order->add_order_note($order_note);
         }
     }
 }
コード例 #26
0
 /**
  * Thank You page message.
  *
  * @param  int    $order_id Order ID.
  *
  * @return string
  */
 public function thankyou_page($order_id)
 {
     $order = new WC_Order($order_id);
     $order_status = $order->get_status();
 }
コード例 #27
0
 /** 
  * Returns order status of a WooCommerce order
  */
 public function getOrderStatus(WC_Order $order)
 {
     return $order->get_status();
 }
コード例 #28
0
    public static function view_order_shortcode_output($atts)
    {
        if (!is_user_logged_in()) {
            return;
        }
        extract(shortcode_atts(array('order_count' => 10), $atts));
        $user_id = get_current_user_id();
        $order_id = isset($_GET['order']) ? $_GET['order'] : 0;
        $order = new WC_Order($order_id);
        if ($order_id == 0) {
            wc_get_template('myaccount/my-orders.php', array('order_count' => 'all' == $order_count ? -1 : $order_count));
            return;
        }
        if (!current_user_can('delete_users') && $order->user_id != $user_id) {
            echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('My Account &rarr;', 'opentickets-community-edition') . '</a>' . '</div>';
            return;
        }
        if (is_callable(array(&$order, 'get_status'))) {
            $status = $order->get_status();
        } else {
            $status = get_term_by('slug', $order->status, 'shop_order_status');
        }
        echo '<p class="order-info">' . sprintf(__('Order <mark class="order-number">%s</mark> made on <mark class="order-date">%s</mark>', 'opentickets-community-edition'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date))) . '. ' . sprintf(__('Order status: <mark class="order-status">%s</mark>', 'opentickets-community-edition'), __($status->name, 'opentickets-community-edition')) . '.</p>';
        $notes = $order->get_customer_order_notes();
        if ($notes) {
            ?>
			<h2><?php 
            _e('Order Updates', 'opentickets-community-edition');
            ?>
</h2>
			<ol class="commentlist notes">
				<?php 
            foreach ($notes as $note) {
                ?>
				<li class="comment note">
					<div class="comment_container">
						<div class="comment-text">
							<p class="meta"><?php 
                echo date_i18n(__('l jS \\of F Y, h:ia', 'opentickets-community-edition'), strtotime($note->comment_date));
                ?>
</p>
							<div class="description">
								<?php 
                echo wpautop(wptexturize($note->comment_content));
                ?>
							</div>
			  				<div class="clear"></div>
			  			</div>
						<div class="clear"></div>
					</div>
				</li>
				<?php 
            }
            ?>
			</ol>
			<?php 
        }
        do_action('woocommerce_view_order', $order_id);
    }
コード例 #29
0
ファイル: EbayOrdersTable.php プロジェクト: booklein/wpbookle
 /** ************************************************************************
  * Recommended. This is a custom column method and is responsible for what
  * is rendered in any column with a name/slug of 'title'. Every time the class
  * needs to render a column, it first looks for a method named 
  * column_{$column_title} - if it exists, that method is run. If it doesn't
  * exist, column_default() is called instead.
  * 
  * This example also illustrates how to implement rollover actions. Actions
  * should be an associative array formatted as 'slug'=>'link html' - and you
  * will need to generate the URLs yourself. You could even ensure the links
  * 
  * 
  * @see WP_List_Table::::single_row_columns()
  * @param array $item A singular item (one full row's worth of data)
  * @return string Text to be placed inside the column <td> (profile title only)
  **************************************************************************/
 function column_details($item)
 {
     // get current page with paging as url param
     $page = $_REQUEST['page'];
     if (isset($_REQUEST['paged'])) {
         $page .= '&paged=' . $_REQUEST['paged'];
     }
     if (isset($_REQUEST['s'])) {
         $page .= '&s=' . urlencode($_REQUEST['s']);
     }
     if (isset($_REQUEST['order_status'])) {
         $page .= '&order_status=' . $_REQUEST['order_status'];
     }
     //Build row actions
     $actions = array('view_ebay_order_details' => sprintf('<a href="?page=%s&action=%s&ebay_order=%s&width=600&height=470" class="thickbox">%s</a>', $page, 'view_ebay_order_details', $item['id'], __('Details', 'wplister')));
     // try to find created order
     $order_post_id = $item['post_id'];
     $order_exists = false;
     $order_msg = '';
     if ($order_post_id) {
         $order = new WC_Order();
         if ($order->get_order($order_post_id)) {
             // order exists - but might be trashed
             if ($order->post_status == 'trash') {
                 $order_msg = '<br><small style="color:darkred;">Order #' . $order_post_id . ' has been trashed.</small>';
             } else {
                 $order_exists = true;
                 $order_msg = '<br><small>Order ' . $order->get_order_number() . ' is ' . $order->get_status() . '.</small>';
             }
         } else {
             // order does not exist - probably deleted
             $order_msg = '<br><small style="color:darkred;">Order #' . $order_post_id . ' has been deleted.</small>';
         }
     }
     // create or edit order link
     if ($order_exists) {
         $actions['edit_order'] = sprintf('<a href="post.php?action=%s&post=%s">%s</a>', 'edit', $item['post_id'], __('View Order', 'wplister'));
     } else {
         $actions['create_order'] = sprintf('<a href="?page=%s&action=%s&ebay_order=%s">%s</a>', $page, 'create_order', $item['id'], __('Create Order', 'wplister'));
     }
     // free version can't create orders
     if (WPLISTER_LIGHT) {
         unset($actions['create_order']);
     }
     // item title
     $title = $item['buyer_name'];
     if ($item['buyer_userid']) {
         $title .= ' <i style="color:silver">' . $item['buyer_userid'] . '</i>';
     }
     $item_details = maybe_unserialize($item['details']);
     if ($item_details) {
         if ($item_details->IsMultiLegShipping) {
             $title .= '<br><small>Global Shipping Program</small>';
         }
     }
     //Return the title contents
     return sprintf('%1$s %2$s', $title . $order_msg, $this->row_actions($actions));
 }
コード例 #30
-1
 /**
  * Method to update an order in the database.
  * @param WC_Order $order
  */
 public function update(&$order)
 {
     $order->set_version(WC_VERSION);
     wp_update_post(array('ID' => $order->get_id(), 'post_date' => date('Y-m-d H:i:s', $order->get_date_created('edit')), 'post_date_gmt' => get_gmt_from_date(date('Y-m-d H:i:s', $order->get_date_created('edit'))), 'post_status' => 'wc-' . ($order->get_status('edit') ? $order->get_status('edit') : apply_filters('woocommerce_default_order_status', 'pending')), 'post_parent' => $order->get_parent_id(), 'post_excerpt' => $this->get_post_excerpt($order)));
     $this->update_post_meta($order);
     $order->save_meta_data();
     $order->apply_changes();
     $this->clear_caches($order);
 }