Beispiel #1
0
function wc2_cart_confirm_table( $slug = '' ) {
	$wc2_cart = WC2_Cart::get_instance( $slug );
	$cart = $wc2_cart->get_cart( $slug );
	$cart_num = count($cart);
	$entry_data = wc2_get_entry();
	$num = 0;

	ob_start();
?>
	<table class="cart-table">
		<thead>
		<tr>
<?php
	$cart_header = '
			<th scope="row" class="num">No.</th>
			<th class="thumbnail">&nbsp;&nbsp;</th>
			<th class="name">'.__('Items','wc2').'</th>
			<th class="price">'.__('Unit price','wc2').'</th>
			<th class="quantity">'.__('Quantity','wc2').'</th>
			<th class="subtotal">'.__('Amount','wc2').'</th>';
	$cart_header = apply_filters( 'wc2_filter_cart_confirm_header', $cart_header, $cart, $slug );
	echo $cart_header;
?>
		</tr>
		</thead>
		<tbody>
	<?php foreach( $cart as $idx => $row ): ?>
		<tr>
<?php
			$post_id = $row['post_id'];
			$item_id = $row['item_id'];
			$item_name = $row['item_name'];
			$item_code = $row['item_code'];
			$sku_name = $row['sku_name'];
			$sku_code = $row['sku_code'];
			$sku_id = $row['sku_id'];
			$quantity = $row['quantity'];
			$price = $row['price'];
			$subtotal = $row['quantity'] * $row['price'];

			//$item_sku_data = wc2_get_item_sku_data( $item_id, $sku_id );
			//$stock_status = $item_sku_data['stock_status'];
			//$stock = $item_sku_data['sku_stock'];
			$pictid = wc2_get_mainpictid( $item_code );
			$cart_thumbnail = ( !empty($pictid ) ) ? wc2_the_item_image( 0, 60, 60, $post_id ) : wc2_no_image();
			$cart_thumbnail = apply_filters( 'wc2_filter_cart_confirm_row_thumbnail', $cart_thumbnail, $post_id, $pictid, $idx, $row, $slug );

			$cart_item_name = wc2_get_cart_item_name( $item_name, $item_code, $sku_name, $sku_code );
			$cart_options = '';
			$cart_options = apply_filters( 'wc2_filter_cart_confirm_row_options', $cart_options, $idx, $row, $slug );

			$num++;
			$cart_row = '
			<td class="num">'.$num.'</td>
			<td class="thumbnail">'.$cart_thumbnail.'</td>
			<td class="name">'.$cart_item_name.$cart_options.'</td>
			<td class="price">'.wc2_crform( $price, false, false ).'</td>
			<td class="quantity">'.wc2_crform( $quantity, false, false ).'</td>
			<td class="subtotal">'.wc2_crform( $subtotal, false, false ).'</td>';
			$cart_row = apply_filters( 'wc2_filter_cart_confirm_row', $cart_row, $idx, $row );
			echo $cart_row;
?>
		</tr>
	<?php endforeach; ?>
		</tbody>
		<tfoot>
		<tr>
			<th colspan="5"><?php _e('Total amount of items', 'wc2'); ?></th>
			<th class="total-items-price"><?php wc2_crform_e( $entry_data['order']['item_total_price'], true, false ); ?></th>
		</tr>
<?php if( !empty($entry_data['order']['discount']) ) : ?>
		<tr>
			<td colspan="5"><?php echo apply_filters( 'wc2_filter_discount_label', __('Discount', 'wc2') ); ?></td>
			<td class="discount"><?php wc2_crform_e($entry_data['order']['discount'], true, false); ?></td>
		</tr>
<?php endif; ?>
<?php if( 0.00 < (float)$entry_data['order']['tax'] && 'products' == wc2_get_tax_target() ) : ?>
		<tr>
			<td colspan="5"><?php wc2_tax_label_e(); ?></td>
			<td class="tax"><?php wc2_tax_e( $entry_data['order'] ) ?></td>
		</tr>
<?php endif; ?>
		<tr>
			<td colspan="5"><?php _e('Shipping charges', 'wc2'); ?></td>
			<td class="aright"><?php wc2_crform_e( $entry_data['order']['shipping_charge'], true, false ); ?></td>
		</tr>
<?php if( !empty($entry_data['order']['cod_fee']) ) : ?>
		<tr>
			<td colspan="5"><?php echo apply_filters( 'wc2_filter_cod_label', __('COD fee', 'wc2') ); ?></td>
			<td class="aright"><?php wc2_crform_e( $entry_data['order']['cod_fee'], true, false ); ?></td>
		</tr>
<?php endif; ?>
<?php if( 0.00 < (float)$entry_data['order']['tax'] && 'all' == wc2_get_tax_target() ) : ?>
		<tr>
			<td colspan="5"><?php wc2_tax_label_e(); ?></td>
			<td class="tax"><?php wc2_tax_e( $entry_data['order'] ) ?></td>
		</tr>
<?php endif; ?>
<?php if( wc2_is_membersystem_state() && wc2_is_membersystem_point() && !empty($entry_data['order']['usedpoint']) ) : ?>
		<tr>
			<td colspan="5"><?php _e('Used points', 'wc2'); ?></td>
			<td class="usedpoint"><?php echo number_format( $entry_data['order']['usedpoint'] ); ?></td>
		</tr>
<?php endif; ?>
		<tr>
			<th colspan="5"><?php _e('Total amount', 'wc2'); ?></th>
			<th class="total_price"><?php wc2_crform_e( $entry_data['order']['total_price'], true, false ); ?></th>
		</tr>
		</tfoot>
	</table>
<?php if( wc2_is_membersystem_state() && wc2_is_membersystem_point() &&  wc2_is_login() ) : 
		$member_id = wc2_memberinfo( 'ID' );
		$point = wc2_get_member_data_value( $member_id, $key ); ?>
	<form id="cart-form-confirm-point" action="<?php wc2_cart_url_e( 'point' ); ?>" method="post">
	<table id="point-table">
		<tr>
			<td><?php _e('Current holdings points', 'wc2'); ?></td>
			<td><span class="point"><?php echo $point; ?></span><?php _e('Points', 'wc2'); ?></td>
		</tr>
		<tr>
			<td><?php _e('Point to use', 'wc2'); ?></td>
			<td><input name="offer[usedpoint]" class="used_point" type="text" value="<?php esc_attr_e($entry_data['order']['usedpoint']); ?>" /><?php _e('Points', 'wc2'); ?></td>
		</tr>
			<tr>
			<td colspan="2"><input name="use_point" type="button" class="use_point_button" value="<?php _e('Use the points', 'wc2'); ?>" /></td>
		</tr>
	</table>
	<?php do_action( 'wc2_action_confirm_point_page_form_inside' ); ?>
	</form>
	<?php do_action( 'wc2_action_confirm_point_page_form_outside' ); ?>
<?php endif; ?>
	<?php do_action( 'wc2_action_confirm_cart_footer' ); ?>
<?php
	$html = ob_get_contents();
	ob_end_clean();
	$html = apply_filters( 'wc2_filter_cart_confirm_table', $html, $slug );
	return $html;
}
 function column_total_price($item)
 {
     return wc2_crform($item['total_price'], true, false);
 }
Beispiel #3
0
	/**
	 * Delivery input check
	 *
	 */
	public function delivery_check() {
		$mes = array();
		if( isset($_POST['delivery']['delivery_flag']) && $_POST['delivery']['delivery_flag'] == 1 ) {
			//氏名
			if ( WC2_Utils::is_blank($_POST['delivery']['name1']) || WC2_Utils::is_blank($_POST['delivery']['name2']) ){
				$mes[] = __('氏名を入力してください。', 'wc2');
			}
			//郵便番号
			if ( WC2_Utils::is_blank($_POST['delivery']['zipcode']) ){
				$mes[] = __('郵便番号が入力されていません。', 'wc2');
			}elseif( preg_match('/[^\d-]/', trim($_POST['delivery']['zipcode'])) ){
				$mes[] = __('郵便番号は半角数字で入力してください。', 'wc2');
			}
			//都道府県
			if ( WC2_UNSELECTED == ($_POST['delivery']['pref']) )
				$mes[] = __('都道府県が選択されていません。', 'wc2');
			//市区町村・番地
			if ( WC2_Utils::is_blank($_POST['delivery']['address1']) )
				$mes[] = __('市区町村・番地が入力されていません。', 'wc2');
			//電話番号
			if( WC2_Utils::is_blank($_POST['delivery']['tel']) ){
				$mes[] = __('電話番号が入力されていません。', 'wc2');
			}elseif( !WC2_Utils::is_blank($_POST['delivery']['tel']) && preg_match('/[^\d]/', trim($_POST['delivery']['tel'])) ){
				$mes[] = __('電話番号は半角数字で入力してください。', 'wc2');
			}
		}
		if( !isset($_POST['offer']['delivery_method']) || (empty($_POST['offer']['delivery_method']) && !WC2_Utils::is_zero($_POST['offer']['delivery_method'])) )
			$mes[] = __('配送方法を選択してください。', 'wc2');
		if( !isset($_POST['offer']['payment_method']) ) {
			$mes[] = __('支払方法を選択してください。', 'wc2');
		} else {
			$entry_data = wc2_get_entry();
			$delivery = wc2_get_option( 'delivery' );
			$general = wc2_get_option( 'general' );
			$payment = wc2_get_payment( $_POST['offer']['payment_method'] );
			if( 'COD' == $payment['settlement'] ) {
				$item_total_price = wc2_get_item_total_price();
				$materials = array(
					'total_price' => $item_total_price,
					'discount' => $entry_data['order']['discount'],
					'shipping_charge' => $entry_data['order']['shipping_charge'],
					'cod_fee' => $entry_data['order']['cod_fee'],
				);
				$item_total_price += wc2_get_tax( $materials );
				$cod_limit_amount = ( isset($general['cod_limit_amount']) && 0 < (int)$general['cod_limit_amount'] ) ? $general['cod_limit_amount'] : 0;
				if( 0 < $cod_limit_amount && $item_total_price > $cod_limit_amount )
					$mes[] = sprintf(__('商品合計金額が、代引きでご購入できる上限額(%s)を超えています。', 'wc2'), wc2_crform( $general['cod_limit_amount'], true, false ));
			}

			$d_method_index = wc2_get_delivery_method_index( (int)$_POST['offer']['delivery_method'] );
			if( $delivery['delivery_method'][$d_method_index]['nocod'] == 1 ) {
				if('COD' == $payment['settlement'])
					$mes[] = __('この配送方法では、代引きはご利用できません。', 'wc2');
			}

			$country = $entry_data['delivery']['country'];
			$local_country = wc2_get_base_country();
			if( $country == $local_country ) {
				if( $delivery['delivery_method'][$d_method_index]['intl'] == 1 ) {
					$mes[] = __('配送方法が誤っています。国際便は指定できません。', 'wc2');
				}
			} else {
				if( WC2_Utils::is_zero($delivery['delivery_method'][$d_method_index]['intl']) ) {
					$mes[] = __('配送方法が誤っています。国際便を指定してください。', 'wc2');
				}
			}
		}
	
		//custom_delivery check
		$csde_mes = wc2_custom_field_enter_check('delivery');
		foreach( $csde_mes as $csde_mes_val ){
			$mes[] = $csde_mes_val;
		}

		//custom_order check
		$csod_mes = wc2_custom_field_enter_check('order');
		foreach( $csod_mes as $csod_mes_val ){
			$mes[] = $csod_mes_val;
		}

		$mes = apply_filters( 'wc2_filter_delivery_check', $mes );
		return $mes;
	}
    public function member_history_rows()
    {
        $wc2_db_member = WC2_DB_Member::get_instance();
        $wc2_order = WC2_DB_Order::get_instance();
        $wc2_item = WC2_DB_Item::get_instance();
        if (is_admin()) {
            $member_id = $wc2_db_member->get_member_id();
        } else {
            if (wc2_is_login() && 0 != $_SESSION[WC2]['member']['ID']) {
                $member_id = $_SESSION[WC2]['member']['ID'];
            } else {
                return false;
            }
        }
        $member_history = $wc2_order->get_member_history($member_id);
        $colspan = wc2_is_membersystem_point() ? 9 : 7;
        $html = '<div class="history-area">
					<table>';
        if (!count($member_history)) {
            $html .= '<tr>
			<td>' . __('There is no your purchase history.', 'wc2') . '</td>
			</tr>';
        }
        foreach ($member_history as $umhs) {
            $cart = $umhs['cart'];
            $history_member_head = '<tr>
				<th class="historyrow">' . __('Order number', 'wc2') . '</th>
				<th class="historyrow">' . __('Order status', 'wc2') . '</th>
				<th class="historyrow">' . __('Purchase date', 'wc2') . '</th>
				<th class="historyrow">' . __('Purchase amount', 'wc2') . '</th>';
            if (wc2_is_membersystem_point()) {
                $history_member_head .= '<th class="historyrow">' . __('Used points', 'wc2') . '</th>';
            }
            $history_member_head .= '<th class="historyrow">' . apply_filters('wc2_filter_discount_label', __('Discount', 'wc2'), $umhs) . '</th>
				<th class="historyrow">' . __('Shipping charges', 'wc2') . '</th>
				<th class="historyrow">' . apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2')) . '</th>
				<th class="historyrow">' . __('Consumption tax', 'wc2') . '</th>';
            if (wc2_is_membersystem_point()) {
                $history_member_head .= '<th class="historyrow">' . __('Acquired points', 'wc2') . '</th>';
            }
            $history_member_head .= '</tr>
				<tr>
				<td class="rightnum"><a href="' . WC2_ADMIN_URL . '?page=wc2_order&action=edit&target=' . $umhs['ID'] . '">' . $umhs['dec_order_id'] . '</a></td>
				<td class="aleft">' . wc2_get_order_status_name($umhs['order_status']) . '</td>
				<td class="date">' . $umhs['order_date'] . '</td>
				<td class="rightnum">' . wc2_crform($umhs['item_total_price'] - $umhs['usedpoint'] + $umhs['discount'] + $umhs['shipping_charge'] + $umhs['cod_fee'] + $umhs['tax'], true, false) . '</td>';
            if (wc2_is_membersystem_point()) {
                $history_member_head .= '<td class="rightnum">' . number_format($umhs['usedpoint']) . '</td>';
            }
            $history_member_head .= '<td class="rightnum">' . wc2_crform($umhs['discount'], true, false) . '</td>
				<td class="rightnum">' . wc2_crform($umhs['shipping_charge'], true, false) . '</td>
				<td class="rightnum">' . wc2_crform($umhs['cod_fee'], true, false) . '</td>
				<td class="rightnum">' . wc2_crform($umhs['tax'], true, false) . '</td>';
            if (wc2_is_membersystem_point()) {
                $history_member_head .= '<td class="rightnum">' . number_format($umhs['getpoint']) . '</td>';
            }
            $history_member_head .= '</tr>';
            $html .= apply_filters('wc2_filter_history_member_head', $history_member_head, $umhs);
            $html .= apply_filters('wc2_filter_member_history_header', NULL, $umhs);
            $html .= '<tr>
				<td class="retail" colspan="' . $colspan . '">
					<table id="retail_table_' . $umhs['ID'] . '" class="retail">';
            $history_cart_head = '<tr>
					<th scope="row" class="num">No.</th>
					<th class="thumbnail">&nbsp;</th>
					<th>' . __('Items', 'wc2') . '</th>
					<th class="price ">' . __('Unit price', 'wc2') . '(' . wc2_crcode() . ')' . '</th>
					<th class="quantity">' . __('Quantity', 'wc2') . '</th>
					<th class="subtotal">' . __('Amount', 'wc2') . '(' . wc2_crcode() . ')' . '</th>
					</tr>';
            $html .= apply_filters('wc2_filter_history_cart_head', $history_cart_head, $umhs);
            $i = 1;
            foreach ($cart as $cart_row) {
                $ordercart_id = $cart_row['cart_id'];
                $post_id = $cart_row['post_id'];
                $item_id = $cart_row['item_id'];
                $sku_id = $cart_row['sku_id'];
                $quantity = $cart_row['quantity'];
                $options = isset($cart_row['options']) ? $cart_row['options'] : '';
                //$options = wc2_get_ordercart_meta_value( 'option', $ordercart_id );
                //$options = wc2_get_ordercart_meta( 'option', $ordercart_id );
                $item_name = $cart_row['item_name'];
                $item_code = $cart_row['item_code'];
                $sku_name = $cart_row['sku_name'];
                $sku_code = $cart_row['sku_code'];
                $cart_item_name = wc2_get_cart_item_name($item_name, $item_code, $sku_name, $sku_code);
                $skuPrice = $cart_row['price'];
                $pictid = (int) $wc2_item->get_mainpictid($item_code);
                $optstr = '';
                if (is_array($options) && count($options) > 0) {
                    $optstr = '';
                    foreach ($options as $key => $value) {
                        if (!empty($key)) {
                            $key = urldecode($key);
                            $value = maybe_unserialize($value);
                            if (is_array($value)) {
                                $c = '';
                                $optstr .= esc_html($key) . ' : ';
                                foreach ($value as $v) {
                                    $optstr .= $c . nl2br(esc_html(urldecode($v)));
                                    $c = ', ';
                                }
                                $optstr .= "<br />\n";
                            } else {
                                $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
                            }
                        }
                    }
                    $optstr = apply_filters('wc2_filter_option_history', $optstr, $options);
                }
                $optstr = apply_filters('wc2_filter_option_info_history', $optstr, $umhs, $cart_row, $i);
                $permalink = apply_filters('wc2_filter_link_item_history', get_permalink($post_id), $cart_row);
                $history_cart_row = '<tr>
					<td>' . $i . '</td>
					<td>';
                if ($pictid) {
                    $cart_thumbnail = '<a href="' . esc_url($permalink) . '">' . wp_get_attachment_image($pictid, array(60, 60), true) . '</a>';
                } else {
                    $cart_thumbnail = '<p>' . wc2_no_image() . '</p>';
                }
                $history_cart_row .= apply_filters('wc2_filter_cart_thumbnail', $cart_thumbnail, $post_id, $pictid, $i, $cart_row);
                $history_cart_row .= '</td>
					<td class="aleft"><a href="' . esc_url($permalink) . '">' . esc_html($cart_item_name) . '<br />' . $optstr . '</a>' . apply_filters('wc2_filter_history_item_name', NULL, $umhs, $cart_row, $i) . '</td>
					<td class="rightnum">' . wc2_crform($skuPrice, true, false) . '</td>
					<td class="rightnum">' . number_format($cart_row['quantity']) . '</td>
					<td class="rightnum">' . wc2_crform($skuPrice * $cart_row['quantity'], true, false) . '</td>
					</tr>';
                $materials = compact('cart_thumbnail', 'post_id', 'pictid', 'cart_item_name', 'optstr');
                $html .= apply_filters('wc2_filter_history_cart_row', $history_cart_row, $umhs, $cart_row, $i, $materials);
                $i++;
            }
            $html .= '</table>
				</td>
				</tr>';
        }
        $html .= '</table>
		</div>';
        $html = apply_filters('wc2_filter_member_history_rows', $html, $member_id, $member_history, $colspan);
        return $html;
    }
Beispiel #5
0
								<td colspan="5"><?php 
echo $cod_label;
?>
</td>
								<td><input name="offer[cod_fee]" id="cod_fee" class="text price right" type="text" value="<?php 
echo $cod_fee;
?>
" /></td>
								<td class="notes" colspan="2"><?php 
_e('※自動計算されません', 'wc2');
?>
</td>
							</tr>
							<?php 
if ('all' == $general_options['tax_target']) {
    $tax = isset($data[ORDER_TAX]) && !empty($data[ORDER_TAX]) ? wc2_crform($data[ORDER_TAX], false, false, false) : '0';
    ?>
							<tr class="tax">
								<td colspan="5"><?php 
    wc2_tax_label_e($data);
    ?>
</td>
								<td><input name="offer[tax]" id="tax" class="text price right" type="text" value="<?php 
    echo $tax;
    ?>
" /></td>
								<td class="notes" colspan="2"><?php 
    _e('※自動計算されません', 'wc2');
    ?>
</td>
							</tr>
Beispiel #6
0
 public function get_list_item_sku_price($post_id)
 {
     $item_list = $this->get_item_list($post_id, ITEM_SKU_PRICE);
     $sku_price = '';
     foreach ($item_list as $row) {
         $sku_price .= wc2_crform($row[ITEM_SKU_PRICE], true, false) . '<br />';
     }
     return $sku_price;
 }
Beispiel #7
0
function wc2_crform_e( $float, $symbol_pre = true, $symbol_post = true, $seperator_flag = true ){
	esc_attr_e(wc2_crform( $float, $symbol_pre, $symbol_post, $seperator_flag ));
}
Beispiel #8
0
 static function tax_label($data = array())
 {
     $general_options = wc2_get_option('general');
     if (is_array($data) && array_key_exists('order_condition', $data)) {
         $condition = maybe_unserialize($data['order_condition']);
         $tax_mode = isset($condition['tax_mode']) ? $condition['tax_mode'] : $general_options['tax_mode'];
     } else {
         $tax_mode = $general_options['tax_mode'];
     }
     if ('exclude' == $tax_mode) {
         $label = __('Consumption tax', 'wc2');
     } else {
         if (isset($condition['tax_mode']) && !empty($data['ID'])) {
             $materials = array('total_price' => $data['item_total_price'], 'discount' => $data['discount'], 'shipping_charge' => $data['shipping_charge'], 'cod_fee' => $data['cod_fee']);
             $label = __('Internal consumption tax', 'wc2') . '(' . wc2_crform(wc2_internal_tax($materials), true, false, true) . ')';
         } else {
             $label = __('Internal consumption tax', 'wc2');
         }
     }
     $label = apply_filters('wc2_filter_tax_label', $label, $tax_mode);
     return $label;
 }
 public function download_order_detail_list()
 {
     $order_list = new WC2_Order_List_Table();
     //1ページあたりのテーブルの行数
     $per_page = $order_list->get_items_per_page(self::$per_page_slug);
     //ソート
     $args = $order_list->sort_culum_order_by($per_page);
     //データ
     $list_data = $order_list->get_list_data($args);
     $list = '';
     $opt_order = wc2_get_option('opt_order');
     $chk_detail = !empty($opt_order['chk_detail']) ? $opt_order['chk_detail'] : array();
     //--------------------- checkbox Check  ---------------------//
     $chk_detail['ID'] = 1;
     $chk_detail['deco_id'] = 1;
     $chk_detail['date'] = isset($_REQUEST['check']['date']) ? 1 : 0;
     $chk_detail['member_id'] = isset($_REQUEST['check']['member_id']) ? 1 : 0;
     $chk_detail['name'] = isset($_REQUEST['check']['name']) ? 1 : 0;
     $chk_detail['delivery_method'] = isset($_REQUEST['check']['delivery_method']) ? 1 : 0;
     $chk_detail['shipping_date'] = isset($_REQUEST['check']['shipping_date']) ? 1 : 0;
     $chk_detail['item_code'] = 1;
     $chk_detail['sku_code'] = isset($_REQUEST['check']['sku_code']) ? 1 : 0;
     $chk_detail['item_name'] = isset($_REQUEST['check']['item_name']) ? 1 : 0;
     $chk_detail['sku_name'] = isset($_REQUEST['check']['sku_name']) ? 1 : 0;
     $chk_detail['options'] = isset($_REQUEST['check']['options']) ? 1 : 0;
     $chk_detail['quantity'] = 1;
     $chk_detail['price'] = 1;
     $chk_detail['unit'] = isset($_REQUEST['check']['unit']) ? 1 : 0;
     $opt_order['chk_detail'] = apply_filters('wc2_filter_admin_order_list_chk_detail', $chk_detail);
     wc2_update_option('opt_order', $opt_order);
     //---------------------------- TITLE -----------------------------//
     $title = '';
     $title .= '"' . __('ID', 'wc2') . '"';
     if (1 == $chk_detail['deco_id']) {
         $title .= ',"' . __('Order number', 'wc2') . '"';
     }
     if (1 == $chk_detail['date']) {
         $title .= ',"' . __('Order date', 'wc2') . '"';
     }
     if (1 == $chk_detail['member_id']) {
         $title .= ',"' . __('Membership ID', 'wc2') . '"';
     }
     if (1 == $chk_detail['name']) {
         $title .= ',"' . __('Name', 'wc2') . '"';
     }
     if (1 == $chk_detail['delivery_method']) {
         $title .= ',"' . __('Delivery method', 'wc2') . '"';
     }
     if (1 == $chk_detail['shipping_date']) {
         $title .= ',"' . __('Shipping date', 'wc2') . '"';
     }
     if (1 == $chk_detail['item_code']) {
         $title .= ',"' . __('Item code', 'wc2') . '"';
     }
     if (1 == $chk_detail['sku_code']) {
         $title .= ',"' . __('SKU code', 'wc2') . '"';
     }
     if (1 == $chk_detail['item_name']) {
         $title .= ',"' . __('Item name', 'wc2') . '"';
     }
     if (1 == $chk_detail['sku_name']) {
         $title .= ',"' . __('SKU display name', 'wc2') . '"';
     }
     if (1 == $chk_detail['options']) {
         $title .= ',"' . __('Options for items', 'wc2') . '"';
     }
     if (1 == $chk_detail['quantity']) {
         $title .= ',"' . __('Quantity', 'wc2') . '"';
     }
     if (1 == $chk_detail['price']) {
         $title .= ',"' . __('Unit price', 'wc2') . '"';
     }
     if (1 == $chk_detail['unit']) {
         $title .= ',"' . __('Unit', 'wc2') . '"';
     }
     $list .= apply_filters('wc2_filter_admin_order_list_dl_detail_title', $title, $chk_detail);
     $list .= "\n";
     //----------------------------- DATA -----------------------------//
     foreach ((array) $list_data as $data) {
         $order_id = $data['ID'];
         $cart = wc2_get_order_cart_data($order_id);
         foreach ($cart as $cart_row) {
             $line = '"' . $order_id . '"';
             if (1 == $chk_detail['deco_id']) {
                 $line .= ',"' . $data['dec_order_id'] . '"';
             }
             if (1 == $chk_detail['date']) {
                 $line .= ',"' . $data['order_date'] . '"';
             }
             if (1 == $chk_detail['member_id']) {
                 $line .= ',"' . $data['member_id'] . '"';
             }
             if (1 == $chk_detail['name']) {
                 $line .= ',"' . wc2_entity_decode($data['name']) . '"';
             }
             if (1 == $chk_detail['delivery_method']) {
                 $line .= ',"' . wc2_entity_decode($data['delivery_name']) . '"';
             }
             if (1 == $chk_detail['shipping_date']) {
                 $line .= ',"' . $data['order_modified'] . '"';
             }
             if (1 == $chk_detail['item_code']) {
                 $line .= ',"' . $cart_row['item_code'] . '"';
             }
             if (1 == $chk_detail['sku_code']) {
                 $line .= ',"' . $cart_row['sku_code'] . '"';
             }
             if (1 == $chk_detail['item_name']) {
                 $line .= ',"' . wc2_entity_decode($cart_row['item_name']) . '"';
             }
             if (1 == $chk_detail['sku_name']) {
                 $line .= ',"' . wc2_entity_decode($cart_row['sku_name']) . '"';
             }
             if (1 == $chk_detail['options']) {
                 $optstr = '';
                 $options = isset($cart_row['meta_type']['option']) ? $cart_row['meta_type']['option'] : '';
                 if (is_array($options) && count($options) > 0) {
                     foreach ((array) $options as $key => $value) {
                         $meta_value = maybe_unserialize($value);
                         if (is_array($meta_value)) {
                             $meta_vals = '';
                             foreach ($meta_value as $array_val) {
                                 $meta_vals .= ' ' . urldecode($array_val);
                             }
                             $optstr .= wc2_entity_decode(urldecode($key) . ':' . $meta_vals) . ' ';
                         } else {
                             $optstr .= wc2_entity_decode(urldecode($key) . ':' . urldecode($meta_value)) . ' ';
                         }
                     }
                 }
                 $line .= ',"' . $optstr . '"';
             }
             if (1 == $chk_detail['quantity']) {
                 $line .= ',"' . $cart_row['quantity'] . '"';
             }
             if (1 == $chk_detail['price']) {
                 $line .= ',"' . wc2_crform($cart_row['price'], false, false, false) . '"';
             }
             if (1 == $chk_detail['unit']) {
                 $line .= ',"' . wc2_entity_decode($cart_row['unit']) . '"';
             }
             $list .= apply_filters('wc2_filter_admin_order_list_dl_detail', $line, $chk_detail, $data, $cart_row);
             $list .= "\n";
         }
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=wc2_order_detail_list.csv");
     mb_http_output("pass");
     print mb_convert_encoding($list, "SJIS-win", "UTF-8");
     exit;
 }