Example #1
0
<?php
	$entry_data = wc2_get_entry();
	$payment = wc2_get_payment( $entry_data['order']['payment_method'] );
	$transaction_key = wc2_transaction_key();
	$cart = wc2_get_cart();

	ob_start();
	//if( 'acting' != $payment['settlement'] || 0 == $entry_data['order']['total_price'] ) :
?>
		<form id="cart-form-confirm" action="<?php wc2_cart_url_e(); ?>" method="post">
		<div class="send">
			<input type="button" class="button back" id="bk2delivery" value="戻る">
			<input type="button" class="button action" id="purchase" value="購入する">
			<input type="hidden" name="wcaction" value="purchase_process">
		</div>
		<?php wp_nonce_field( 'wc2_purchase', 'wc2_nonce' ); ?>
		<?php do_action( 'wc2_action_confirm_page_form_inside' ); ?>
		</form>
		<?php do_action( 'wc2_action_confirm_page_form_outside' ); ?>
<?php
	//endif;
	$html = ob_get_contents();
	ob_end_clean();
?>
Example #2
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;
	}
Example #3
0
 public function pdfSetFooter($pdf, $data)
 {
     global $wc2;
     $wc2_options = wc2_get_option();
     $font = $this->font;
     $border = 0;
     list($fontsize, $lineheight, $linetop) = $this->set_font_size(9);
     $pdf->SetFont($font, '', $fontsize);
     // Body label
     $pdf->SetXY(15.5, 94.90000000000001);
     $pdf->MultiCell(87.8, $lineheight, $this->conv_enc(__('Item name', 'wc2')), $border, 'C');
     $pdf->SetXY(103.7, 94.90000000000001);
     $pdf->MultiCell(11.4, $lineheight, $this->conv_enc(__('Quantity', 'wc2')), $border, 'C');
     $pdf->SetXY(115.8, 94.90000000000001);
     $pdf->MultiCell(11.0, $lineheight, $this->conv_enc(__('Unit', 'wc2')), $border, 'C');
     $pdf->SetXY(127.2, 94.90000000000001);
     $pdf->MultiCell(15.0, $lineheight, $this->conv_enc(__('Price', 'wc2')), $border, 'C');
     $pdf->SetXY(142.9, 94.90000000000001);
     $pdf->MultiCell(22.4, $lineheight, $this->conv_enc(__('Amount', 'wc2') . '(' . __(wc2_crcode(), 'wc2') . ')'), $border, 'C');
     // Footer label
     $labeldata = array('order_condition' => $data['order_condition'], 'order_item_total_price' => $data['item_total_price'], 'order_discount' => $data['discount'], 'order_shipping_charge' => $data['shipping_charge'], 'order_cod_fee' => $data['cod_fee']);
     $pdf->SetXY(104.3, 198.8);
     $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(__('Total amount of items', 'wc2')), $border, 'C');
     $pdf->SetXY(104.3, 204.8);
     $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(apply_filters('wc2_filter_discount_label', __('Discount', 'wc2'), $data)), $border, 'C');
     if ('products' == wc2_get_tax_target()) {
         $data_1 = apply_filters('wc2_filter_tax_label', wc2_tax_label($labeldata));
         $data_2 = apply_filters('wc2_filter_shipping_label', __('Shipping charges', 'wc2'));
         $data_3 = apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2'));
     } else {
         $data_1 = apply_filters('wc2_filter_shipping_label', __('Shipping charges', 'wc2'));
         $data_2 = apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2'));
         $data_3 = apply_filters('wc2_filter_tax_label', wc2_tax_label($labeldata));
     }
     $pdf->SetXY(104.3, 210.8);
     $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_1), $border, 'C');
     $pdf->SetXY(104.3, 216.7);
     $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_2), $border, 'C');
     $pdf->SetXY(104.3, 222.7);
     $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_3), $border, 'C');
     if (wc2_is_membersystem_point()) {
         $pdf->SetXY(104.3, 228.6);
         $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(apply_filters('wc2_filter_point_label', __('Used points', 'wc2'))), $border, 'C');
         $pdf->SetXY(104.3, 235.8);
         $pdf->MultiCell(37.77, $lineheight, $this->conv_enc(__('Total Amount', 'wc2')), $border, 'C');
     } else {
         $pdf->SetXY(104.3, 235.8);
         $pdf->MultiCell(37.77, $lineheight * 2, $this->conv_enc(__('Total Amount', 'wc2')), $border, 'C');
     }
     list($fontsize, $lineheight, $linetop) = $this->set_font_size(8);
     $pdf->SetFont($font, '', $fontsize);
     // Footer value
     $payment = wc2_get_payment($data['payment_method']);
     $transfers = apply_filters('wc2_filter_pdf_transfer', array('BT'), $data);
     if ('invoice' == $_REQUEST['type'] && in_array($payment['settlement'], $transfers)) {
         $transferee = __('Transfer', 'wc2') . " : \r\n";
         $transferee .= wc2_get_option('transferee_info') . "\r\n";
         $note_text = apply_filters('wc2_filter_mail_transferee', $transferee, $data, 'pdf', $payment);
     } else {
         $note_text = $data['note'];
     }
     $pdf->SetXY(16.1, 198.8);
     $pdf->MultiCell(86.59999999999999, $lineheight, $this->conv_enc(apply_filters('wc2_filter_pdf_note', $note_text, $data, $_REQUEST['type'])), $border, 'J');
     list($fontsize, $lineheight, $linetop) = $this->set_font_size(9);
     $pdf->SetFont($font, '', $fontsize);
     $pdf->SetXY(142.9, 198.8);
     $total_price = $data['item_total_price'] - $data['usedpoint'] + $data['discount'] + $data['shipping_charge'] + $data['cod_fee'] + $data['tax'];
     $pdf->MultiCell(22.6, $lineheight, wc2_get_currency($data['item_total_price']), $border, 'R');
     $materials = array('total_price' => $data['item_total_price'], 'discount' => $data['discount'], 'shipping_charge' => $data['shipping_charge'], 'cod_fee' => $data['cod_fee']);
     if ('include' == $wc2_options['general']['tax_mode']) {
         $tax = '(' . wc2_internal_tax($materials) . ')';
     } else {
         $tax = wc2_get_currency($data['tax']);
     }
     if ('products' == wc2_get_tax_target()) {
         $datav_1 = apply_filters('wc2_filter_tax_value', $tax, $data);
         $datav_2 = apply_filters('wc2_filter_shipping_value', wc2_get_currency($data['shipping_charge']), $data);
         $datav_3 = apply_filters('wc2_filter_cod_value', wc2_get_currency($data['cod_fee']), $data);
     } else {
         $datav_1 = apply_filters('wc2_filter_shipping_value', wc2_get_currency($data['shipping_charge']), $data);
         $datav_2 = apply_filters('wc2_filter_cod_value', wc2_get_currency($data['cod_fee']), $data);
         $datav_3 = apply_filters('wc2_filter_tax_value', $tax, $data);
     }
     $pdf->SetXY(142.9, 204.8);
     $pdf->MultiCell(22.6, $lineheight, $this->conv_enc(apply_filters('wc2_filter_discount_value', wc2_get_currency($data['discount']), $data)), $border, 'R');
     $pdf->SetXY(142.9, 210.8);
     $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_1), $border, 'R');
     $pdf->SetXY(142.9, 216.7);
     $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_2), $border, 'R');
     $pdf->SetXY(142.9, 222.7);
     $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_3), $border, 'R');
     if (wc2_is_membersystem_point()) {
         $pdf->SetXY(142.9, 228.6);
         $pdf->MultiCell(22.6, $lineheight, $this->conv_enc(apply_filters('wc2_filter_point_value', wc2_get_currency($data['usedpoint']), $data)), $border, 'R');
         $pdf->SetXY(142.9, 235.8);
         $pdf->MultiCell(22.67, $lineheight, $this->conv_enc(wc2_get_currency($total_price)), $border, 'R');
     } else {
         $pdf->SetXY(142.9, 235.8);
         $pdf->MultiCell(22.67, $lineheight, $this->conv_enc(wc2_get_currency($total_price)), $border, 'R');
     }
     do_action('wc2_action_order_print_footer', $pdf, $data);
 }
Example #4
0
function wc2_set_order_price($cart = array(), $entry_data = array())
{
    $general = wc2_get_option('general');
    if (empty($cart) and !is_admin()) {
        $cart = wc2_get_cart();
    }
    if (empty($entry_data) and !is_admin()) {
        $entry_data = wc2_get_entry();
    }
    //*** Delivery method name
    $delivery_name = wc2_get_delivery_method_name($entry_data['order']['delivery_method']);
    wc2_set_entry_order_value('delivery_name', $delivery_name);
    //--------------------------------------------------------------------------
    //*** Payment method name
    $payment = wc2_get_payment($entry_data['order']['payment_method']);
    $payment_name = $payment['name'];
    wc2_set_entry_order_value('payment_name', $payment_name);
    //--------------------------------------------------------------------------
    //*** Item total price
    $item_total_price = wc2_get_item_total_price($cart);
    wc2_set_entry_order_value('item_total_price', $item_total_price);
    //--------------------------------------------------------------------------
    //*** Discount price
    $discount = wc2_get_order_discount($general['display_mode'], $cart);
    wc2_set_entry_order_value('discount', $discount);
    //--------------------------------------------------------------------------
    //*** Shipping charge
    if (empty($general['postage_privilege']) || $item_total_price + $discount < $general['postage_privilege']) {
        $country = isset($entry_data['delivery']['country']) && !empty($entry_data['delivery']['country']) ? $entry_data['delivery']['country'] : $entry_data['customer']['country'];
        $shipping_charge = wc2_get_shipping_charge($entry_data['order']['delivery_method'], $entry_data['delivery']['pref'], $country, $cart);
    } else {
        $shipping_charge = 0;
    }
    $shipping_charge = apply_filters('wc2_filter_set_shipping_charge', $shipping_charge, $cart, $entry_data);
    wc2_set_entry_order_value('shipping_charge', $shipping_charge);
    //--------------------------------------------------------------------------
    //*** COD fee
    $usedpoint = isset($entry_data['order']['usedpoint']) ? (int) $entry_data['order']['usedpoint'] : 0;
    $amount_by_cod = $item_total_price + $discount + $shipping_charge - $usedpoint;
    $amount_by_cod = apply_filters('wc2_filter_set_amount_by_cod', $amount_by_cod, $entry_data, $item_total_price, $discount, $shipping_charge, $usedpoint);
    $cod_fee = wc2_get_cod_fee($entry_data['order']['payment_method'], $amount_by_cod, $item_total_price, $discount, $shipping_charge);
    $cod_fee = apply_filters('wc2_filter_set_cod_fee', $cod_fee, $entry_data, $item_total_price, $discount, $shipping_charge, $usedpoint);
    wc2_set_entry_order_value('cod_fee', $cod_fee);
    //--------------------------------------------------------------------------
    //*** Set materials
    $materials = array('entry_data' => $entry_data, 'cart' => $cart, 'total_price' => $item_total_price, 'discount' => $discount, 'shipping_charge' => $shipping_charge, 'usedpoint' => $usedpoint, 'cod_fee' => $cod_fee, 'payment' => $payment);
    //--------------------------------------------------------------------------
    //*** Tax price
    $tax = wc2_get_tax($materials);
    wc2_set_entry_order_value('tax', $tax);
    //--------------------------------------------------------------------------
    //*** Total price
    $total_price = $item_total_price + $discount + $shipping_charge - $usedpoint + $cod_fee + ('exclude' == $general['tax_mode'] ? $tax : 0);
    $total_price = apply_filters('wc2_filter_set_total_order_price', $total_price, $item_total_price, $discount, $shipping_charge, $usedpoint, $cod_fee);
    wc2_set_entry_order_value('total_price', $total_price);
    //--------------------------------------------------------------------------
    //*** Get point
    $member = wc2_get_member();
    $getpoint = wc2_get_order_point($member['ID'], $usedpoint);
    wc2_set_entry_order_value('getpoint', $getpoint);
    //--------------------------------------------------------------------------
}
Example #5
0
function wc2_ordermail($data, $send = 'order')
{
    $cart = $data['cart'];
    $payment = wc2_get_payment($data['payment_method']);
    $general_options = wc2_get_option('general');
    $total_price = $data['item_total_price'] - $data['usedpoint'] + $data['discount'] + $data['shipping_charge'] + $data['cod_fee'] + $data['tax'];
    $msg_body = "";
    if ($data['order_type'] == 'estimate') {
        $msg_top = "\r\n\r\n\r\n" . __('【お見積】', 'wc2') . "\r\n";
        $msg_top .= wc2_mail_line(1, $data['email']);
        //********************
        $msg_top .= apply_filters('wc2_filter_ordermail_first', "", $data, $payment, $send);
        $msg_top .= wc2_get_mail_addressform($data, 'customer');
        $msg_top .= __('お見積番号', 'wc2') . " : " . $data['order_id'] . "\r\n";
    } else {
        $msg_top = "\r\n\r\n\r\n" . __('【ご注文内容】', 'wc2') . "\r\n";
        $msg_top .= wc2_mail_line(1, $data['email']);
        //********************
        $msg_top .= apply_filters('wc2_filter_ordermail_first', "", $data, $payment, $send);
        $msg_top .= wc2_get_mail_addressform($data, 'customer');
        $msg_top .= __('Order number', 'wc2') . " : " . $data['dec_order_id'] . "\r\n";
        $msg_top .= __('注文日時', 'wc2') . " : " . $data['order_date'] . "\r\n";
    }
    $msg_top .= "\r\n";
    $msg_body = apply_filters('wc2_filter_ordermail_top', $msg_top, $data, $payment, $send);
    $msg_detail = __('Items', 'wc2') . "\r\n";
    foreach ($cart as $idx => $cart_row) {
        //		$item_id = $cart_row['item_id'];
        //		$sku_id = $cart_row['sku_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);
        $cart_options = '';
        $msg_detail .= wc2_mail_line(2, $data['email']);
        //--------------------
        $msg_detail .= $cart_item_name . "\r\n";
        if (is_array($cart_options) && count($cart_options) > 0) {
            $optstr = '';
            foreach ($cart_options as $key => $value) {
                if (!empty($key)) {
                    $key = urldecode($key);
                    if (is_array($value)) {
                        $c = '';
                        $optstr .= $key . ' : ';
                        foreach ($value as $v) {
                            $optstr .= $c . urldecode($v);
                            $c = ', ';
                        }
                        $optstr .= "\r\n";
                    } else {
                        $optstr .= $key . ' : ' . urldecode($value) . "\r\n";
                    }
                }
            }
            $msg_detail .= apply_filters('wc2_filter_ordermail_cartrow_options', $optstr, $cart_options, $send);
        }
        $msg_detail .= __('単価', 'wc2') . " " . wc2_crform($cart_row['price'], true, false) . __(' * ', 'wc2') . $cart_row['quantity'] . "\r\n";
    }
    $msg_detail .= wc2_mail_line(3, $data['email']);
    //====================
    $msg_detail .= __('商品合計', 'wc2') . " : " . wc2_crform($data['item_total_price'], true, false) . "\r\n";
    if ($data['discount'] != 0) {
        $msg_detail .= apply_filters('wc2_filter_discount_label', __('値引', 'wc2'), $data['order_id']) . " : " . wc2_crform($data['discount'], true, false) . "\r\n";
    }
    if (0.0 < (double) $data['tax'] && 'products' == $general_options['tax_target']) {
        $msg_detail .= wc2_tax_label($data) . " : " . wc2_crform($data['tax'], true, false) . "\r\n";
    }
    $msg_detail .= __('送料', 'wc2') . " : " . wc2_crform($data['shipping_charge'], true, false) . "\r\n";
    if ($payment['settlement'] == 'COD') {
        $msg_detail .= apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2')) . " : " . wc2_crform($data['cod_fee'], true, false) . "\r\n";
    }
    if (0.0 < (double) $data['tax'] && 'all' == $general_options['tax_target']) {
        $msg_detail .= wc2_tax_label($data) . " : " . wc2_crform($data['tax'], true, false) . "\r\n";
    }
    if ($data['usedpoint'] != 0) {
        $msg_detail .= __('ご利用ポイント', 'wc2') . " : " . number_format($data['usedpoint']) . __('ポイント', 'wc2') . "\r\n";
    }
    $msg_detail .= wc2_mail_line(2, $data['email']);
    //--------------------
    $msg_detail .= __('お支払金額', 'wc2') . " : " . wc2_crform($total_price, true, false) . "\r\n";
    $msg_detail .= wc2_mail_line(2, $data['email']);
    //--------------------
    $msg_detail .= "(" . __('Currency', 'wc2') . ' : ' . __(wc2_crcode(), 'wc2') . ")\r\n\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_detail', $msg_detail, $data, $payment, $send);
    $msg_shipping = __('【配送先】', 'wc2') . "\r\n";
    $msg_shipping .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_shipping .= wc2_get_mail_addressform($data, 'delivery');
    $msg_shipping .= __('配送方法', 'wc2') . " : " . $data['delivery_name'] . "\r\n";
    $msg_shipping .= __('配送希望日', 'wc2') . " : " . $data['delivery_date'] . "\r\n";
    $msg_shipping .= __('配送希望時間', 'wc2') . " : " . $data['delivery_time'] . "\r\n";
    $msg_shipping .= "\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_shipping', $msg_shipping, $data, $payment, $send);
    $msg_payment = __('【お支払方法】', 'wc2') . "\r\n";
    $msg_payment .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_payment .= $payment['name'] . wc2_payment_detail($data) . "\r\n\r\n";
    if ($payment['settlement'] == 'BT') {
        $transferee = __('お振込先', 'wc2') . " : \r\n";
        $transferee .= wc2_get_option('transferee_info') . "\r\n\r\n";
        $transferee .= wc2_mail_line(2, $data['email']) . "\r\n";
        //--------------------
        $msg_payment .= apply_filters('wc2_filter_mail_transferee', $transferee, $data, $payment, $send);
    }
    $msg_payment .= "\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_payment', $msg_payment, $data, $payment, $send);
    $msg_other = __('【その他】', 'wc2') . "\r\n";
    $msg_other .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_other .= wc2_mail_custom_field_info($data, 'order', 'beforeremarks');
    $msg_other .= $data['note'] . "\r\n";
    $msg_other .= wc2_mail_custom_field_info($data, 'order', 'other');
    $msg_other .= "\r\n\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_other', $msg_other, $data, $payment, $send);
    $msg_body = apply_filters('wc2_filter_ordermail_body', $msg_body, $data, $payment, $send);
    return $msg_body;
}