コード例 #1
0
ファイル: class-page.php プロジェクト: nanbu-collne/test2
	/**
	 * Shipping destination check
	 *
	 */
	public function delivery_process() {
		wc2_set_entry();
		$mes = $this->stock_check();
		if( 0 < count($mes) ) {
			foreach( $mes as $error )
				$this->set_error( $error, 'delivery_process' );
			$this->current_page_type = 'cart';
			$this->current_page = 'top';
			$this->page_redirect();
		}

		$mes = $this->delivery_check();
		if( 0 < count($mes) ) {
			foreach( $mes as $error )
				$this->set_error( $error, 'delivery_process' );
			$this->current_page_type = 'cart';
			$this->current_page = 'delivery';
			$this->page_redirect();
		}

		wc2_set_order_price();

		if( wc2_is_membersystem_state() && wc2_is_membersystem_point() && $this->is_member_logged_in() ) {
			$mem_point = wc2_get_member_data_value( $_SESSION[WC2]['member']['ID'], MEMBER_POINT );
			$_SESSION[WC2]['member']['point'] = $mem_point;
		}
	}
コード例 #2
0
ファイル: class-cart.php プロジェクト: nanbu-collne/test2
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;
}
コード例 #3
0
ファイル: class-member.php プロジェクト: nanbu-collne/test2
	public function set_session_member_from_post_data(){
		//固定
		$member_id = $this->get_memberinfo('ID');
		$rank = wc2_get_member_data_value($member_id, MEMBER_RANK);
		$point = wc2_get_member_data_value($member_id, MEMBER_POINT);
		$registered = wc2_get_member_data_value($member_id, MEMBER_REGISTERED);

		if( isset( $_SESSION[WC2]['member'] ) ){
			unset($_SESSION[WC2]['member']);
		}

		$_SESSION[WC2]['member']['ID'] = $member_id;
		$_POST = WC2_Utils::stripslashes_deep_post($_POST);
		$base_member_key = array(
									'account',
									'email',
									'email2' ,
									'rank' ,
									'point' ,
									'name1' ,
									'name2' ,
									'name3' ,
									'name4' ,
									'country' ,
									'zipcode' ,
									'pref' ,
									'address1' ,
									'address2' ,
									'tel' ,
									'fax' ,
									'registered' ,
								);

		foreach( $base_member_key as $mem_key ){
			switch($mem_key){
			case 'rank':
				$_SESSION[WC2]['member'][$mem_key] = $rank;
				break;
			case 'point':
				$_SESSION[WC2]['member'][$mem_key] = $point;
				break;
			case 'registered':
				$_SESSION[WC2]['member'][$mem_key] = $registered;
				break;
			default:
				$_SESSION[WC2]['member'][$mem_key] = ( isset( $_POST['member'][$mem_key] ) ) ? $_POST['member'][$mem_key]: '';
				break;
			}
		}

		//csmb
		$csmb_keys = wc2_get_custom_field_keys(WC2_CSMB);
		if( !empty($csmb_keys) && is_array($csmb_keys) ){
			foreach($csmb_keys as $key){
				list( $pfx, $csmb_key ) = explode('_', $key, 2);
				$csmb_val = ( isset( $_POST[WC2_CUSTOM_MEMBER][$csmb_key] ) ) ? $_POST[WC2_CUSTOM_MEMBER][$csmb_key]: '';
				$_SESSION[WC2]['member'][WC2_CUSTOM_MEMBER][$csmb_key] = $csmb_val;
			}
		}
		//meta

		do_action('wc2_action_set_session_member_from_post_data');

	}