Example #1
0
function wc2_ordermail_admin($order_id)
{
    $data = wc2_get_order_data($order_id);
    $phrase = wc2_get_option('phrase');
    $msg_body = wc2_ordermail($data, 'admin');
    switch ($_POST['mode']) {
        case 'mail_completion':
            //発送完了
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['completionmail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['completionmail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_completion');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_order':
            //注文確認
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['ordermail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['ordermail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_order');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_change':
            //変更確認
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['changemail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['changemail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_change');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_receipt':
            //入金確認
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['receiptmail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['receiptmail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_receipt');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_estimate':
            //見積
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['estimatemail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['estimatemail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_estimate');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_cancel':
            //キャンセル
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['cancelmail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['cancelmail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_cancel');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        case 'mail_other':
            //その他
            $header = apply_filters('wc2_filter_ordermail_admin_header', $phrase['header']['othermail'], $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', $phrase['footer']['othermail'], $data);
            $body = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, 'mail_other');
            $message = do_shortcode($header) . $body . do_shortcode($footer);
            break;
        default:
            $header = apply_filters('wc2_filter_ordermail_admin_header', '', $data);
            $footer = apply_filters('wc2_filter_ordermail_admin_footer', '', $data);
            $message = apply_filters('wc2_filter_ordermail_admin_body', $msg_body, $data, '');
    }
    return apply_filters('wc2_filter_ordermail_admin_message', $message, $data);
}
Example #2
0
function wc2_Classic_trackPageview_by_Yoast($push){
	$page_type = wc2_get_current_page_type();
	$page = wc2_get_current_page();
	$action = isset($_REQUEST['wcaction']) ? $_REQUEST['wcaction']: '';
	$row = array();
	if( 'cart' == $page_type && 'complete' == $page && 'purchase_process' == $action ){
		$entry_data =  wc2_get_entry();
		$order_id = $entry_data['order']['ID'];
		$data = wc2_get_order_data( $order_id );
		$cart = $data['cart'];
		$total_price = $data['item_total_price'] + $data['discount'] - $data['usedpoint'];

		$row[] = "'_addTrans', '" . $order_id . "', '" . get_option('blogname') . "', '" . $total_price . "', '" . $data['tax'] . "', '" . $data['shipping_charge'] . "', '" . $data['address1'] . $data['address2'] . "', '" . $data['pref'] . "', '" . get_locale() . "'";
		foreach( $cart as $index => $cart_row ){
			$skuName = urldecode($cart_row['sku_name']);
			$itemName = $cart_row['item_name'];
			$post_id = $cart_row['post_id'];
			$cats = wc2_get_item_cat_genre_ids($post_id);

			if( is_array($cats) )
				sort($cats);

			$category = isset($cats[0]) ? get_term($cats[0], 'item'): '';
			$catName = isset($category->name) ? $category->name: '';
			$skuPrice = $cart_row['price'];
			$quantity = $cart_row['quantity'];

			$row[] = "'_addItem', '" . $order_id . "', '" . $skuName . "', '" . $itemName . "', '" . $catName . "', '" . $skuPrice . "', '" . $quantity . "'";
		}

		$row[] = "'_trackTrans'";
	}
	$row = apply_filters('wc2_filter_Classic_trackPageview_by_Yoast', $row, $page_type, $page, $action);
	$push = array_merge( $push, $row );

	return $push;
}
Example #3
0
 public function admin_order_page()
 {
     if (!isset($this->plugin_screen_hook_suffix)) {
         return;
     }
     $screen = get_current_screen();
     if ($this->plugin_screen_hook_suffix != $screen->id) {
         return;
     }
     if (isset($_REQUEST['action'])) {
         $this->mode = $_REQUEST['action'];
     } else {
         $this->mode = 'list';
     }
     $wc2_order = WC2_DB_Order::get_instance();
     switch ($this->mode) {
         case 'new':
             $title = '新規' . $this->title . '登録';
             $order_id = '';
             $dec_order_id = '';
             $data = $this->get_post_data();
             $data['ID'] = '';
             $data['dec_order_id'] = '--------------';
             $cart = array();
             $cart_row = 1;
             $item_total_price = 0;
             $order_date = wc2_get_today();
             $order_action = 'register';
             $this->page = 'order-post';
             break;
         case 'edit':
             $title = $this->title . '編集';
             if (isset($_REQUEST['order_action']) and 'register' == $_REQUEST['order_action']) {
                 check_admin_referer('wc2_order_post', 'wc2_nonce');
                 $data = $this->get_post_data();
                 if ($this->check_order_data($data)) {
                     $data = apply_filters('wc2_filter_admin_order_register_order_data', $data);
                     do_action('wc2_action_admin_order_register_pre');
                     $wc2_order->set_order_data($data);
                     $res = $wc2_order->add_order_data();
                     if (1 == $res) {
                         $order_id = $wc2_order->get_the_order_id();
                         $args = array('data' => $data, 'order_id' => $order_id);
                         wc2_set_dec_order_id($args);
                         $this->action_status = 'success';
                         $this->action_message = __('登録しました', 'wc2');
                     } else {
                         $this->action_status = 'error';
                         $this->action_message = __('登録に失敗しました', 'wc2');
                     }
                 } else {
                     $this->action_status = 'error';
                     $this->action_message = __('データに不備があります', 'wc2');
                 }
             } elseif (isset($_REQUEST['order_action']) and 'update' == $_REQUEST['order_action']) {
                 check_admin_referer('wc2_order_post', 'wc2_nonce');
                 $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id'] : '';
                 $data = $this->get_post_data();
                 if ($this->check_order_data($data)) {
                     $data = apply_filters('wc2_filter_admin_order_update_order_data', $data);
                     do_action('wc2_action_admin_order_update_pre');
                     $wc2_order->set_order_id($order_id);
                     $wc2_order->set_order_data($data);
                     $res = $wc2_order->update_order_data();
                     if (1 == $res) {
                         $this->action_status = 'success';
                         $this->action_message = __('Updated!');
                     } elseif (0 === $res) {
                         $this->action_status = 'none';
                         $this->action_message = '';
                     } else {
                         $this->action_status = 'error';
                         $this->action_message = __('Update Failed');
                     }
                 } else {
                     $this->action_status = 'error';
                     $this->action_message = __('データに不備があります', 'wc2');
                 }
             } else {
                 $order_id = isset($_REQUEST['target']) ? $_REQUEST['target'] : '';
             }
             $data = wc2_get_order_data($order_id);
             $dec_order_id = isset($data['dec_order_id']) ? $data['dec_order_id'] : '';
             $cart = !empty($data['cart']) ? $data['cart'] : array();
             $cart_row = 0 < count($cart) ? max(array_keys($cart)) + 1 : 1;
             $item_total_price = wc2_get_item_total_price($cart);
             $order_date_time = explode(" ", $data[ORDER_DATE]);
             $order_date = explode("-", $order_date_time[0]);
             $order_action = 'update';
             $this->page = 'order-post';
             break;
             //*** LI CUSTOMIZE >>>
         //*** LI CUSTOMIZE >>>
         case 'edit-mode':
             $title = $this->title . '編集';
             $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id'] : '';
             $dec_order_id = isset($_REQUEST['dec_order_id']) ? $_REQUEST['dec_order_id'] : '';
             $data = $this->get_post_data();
             $cart = !empty($data['cart']) ? $data['cart'] : array();
             $cart_row = 0 < count($cart) ? max(array_keys($cart)) + 1 : 1;
             $item_total_price = wc2_get_item_total_price($cart);
             $order_date_time = explode(" ", $data[ORDER_DATE]);
             $order_date = explode("-", $order_date_time[0]);
             $order_action = 'update';
             $this->page = 'order-post';
             $this->mode = 'edit';
             break;
             //*** LI CUSTOMIZE <<<
         //*** LI CUSTOMIZE <<<
         case 'delete':
             check_admin_referer('wc2_order_list', 'wc2_nonce');
             if (isset($_REQUEST['target']) && !empty($_REQUEST['target'])) {
                 $res = self::delete_order_data($_REQUEST['target']);
             }
             $this->page = 'order-list';
             break;
         case 'delete_batch':
             check_admin_referer('wc2_order_list', 'wc2_nonce');
             if (isset($_REQUEST['order_tag']) && !empty($_REQUEST['order_tag'])) {
                 $res = self::delete_batch_order_data($_REQUEST['order_tag']);
             }
             $this->page = 'order-list';
             break;
         case 'dl_orderdetail_list':
             check_admin_referer('wc2_dl_orderdetail_list', 'wc2_nonce');
             $this->download_order_detail_list();
             $this->page = '';
             break;
         case 'dl_order_list':
             check_admin_referer('wc2_dl_order_list', 'wc2_nonce');
             $this->download_order_list();
             $this->page = '';
             break;
         case 'list':
         default:
             $this->page = 'order-list';
             break;
     }
     do_action('wc2_action_admin_order_page', array($this));
     $order_status = wc2_get_option('management_status');
     $receipt_status = wc2_get_option('receipt_status');
     $order_type = wc2_get_option('order_type');
     //受注リスト
     if ($this->page == 'order-list') {
         $order_list = new WC2_Order_List_Table();
         $order_list->prepare_items();
         $order_refine_period = wc2_get_option('order_refine_period');
         $search_period = isset($_SESSION[WC2][$this->page]['search_period']) ? $_SESSION[WC2][$this->page]['search_period'] : 3;
         $startdate = isset($_SESSION[WC2][$this->page]['startdate']) ? $_SESSION[WC2][$this->page]['startdate'] : '';
         $enddate = isset($_SESSION[WC2][$this->page]['enddate']) ? $_SESSION[WC2][$this->page]['enddate'] : '';
         $search_column_key = isset($_REQUEST['search_column']) ? $_REQUEST['search_column'] : '';
         $search_word = '';
         $search_word_key = '';
         switch ($search_column_key) {
             case 'none':
                 break;
             case 'order_status':
                 $search_word_key = isset($_REQUEST['search_word']['order_status']) ? $_REQUEST['search_word']['order_status'] : '';
                 if (array_key_exists($search_word_key, $order_status)) {
                     $search_word = $order_status[$search_word_key];
                 }
                 break;
             case 'receipt_status':
                 $search_word_key = isset($_REQUEST['search_word']['receipt_status']) ? $_REQUEST['search_word']['receipt_status'] : '';
                 if (array_key_exists($search_word_key, $receipt_status)) {
                     $search_word = $receipt_status[$search_word_key];
                 }
                 break;
             case 'order_type':
                 $search_word_key = isset($_REQUEST['search_word']['order_type']) ? $_REQUEST['search_word']['order_type'] : '';
                 if (array_key_exists($search_word_key, $order_type)) {
                     $search_word = $order_type[$search_word_key];
                 }
                 break;
             default:
                 if (isset($_REQUEST['search_word']['keyword'])) {
                     $search_word = $_REQUEST['search_word']['keyword'];
                 }
         }
         $search_columns = $order_list->define_columns();
         unset($search_columns['cb']);
         unset($search_columns['total_price']);
         $search_columns['item_code'] = __('Item code', 'wc2');
         $search_columns['item_name'] = __('Item name', 'wc2');
         $search_columns = apply_filters('wc2_filter_admin_order_list_search_columns', $search_columns);
         $opt_order = wc2_get_option('opt_order');
         $chk_order = !empty($opt_order['chk_order']) ? $opt_order['chk_order'] : array();
         $chk_detail = !empty($opt_order['chk_detail']) ? $opt_order['chk_detail'] : array();
         $system_options = wc2_get_option('system');
         $applyform = wc2_get_apply_addressform($system_options['addressform']);
         //受注編集画面
     } elseif ($this->page == 'order-post') {
         $status = $this->action_status;
         $message = $this->action_message;
         $general_options = wc2_get_option('general');
         $payment_method = wc2_get_option('payment_method');
         $delivery_options = wc2_get_option('delivery');
         $delivery_method = isset($delivery_options['delivery_method']) ? $delivery_options['delivery_method'] : array();
         $delivery_after_days = apply_filters('wc2_filter_delivery_after_days', !empty($delivery_options['delivery_after_days']) ? (int) $delivery_options['delivery_after_days'] : 100);
         $order_condition = maybe_unserialize($data[ORDER_CONDITION]);
         $order_check = maybe_unserialize($data[ORDER_CHECK]);
     }
     $order_page = apply_filters('wc2_filter_admin_order_page', WC2_PLUGIN_DIR . '/admin/views/' . $this->page . '.php');
     require_once $order_page;
 }