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"> </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 wc2_get_admin_order_cart_row($order_id, $cart) { $num = 0; ob_start(); if (is_array($cart) and 0 < count($cart)) { foreach ($cart as $idx => $row) { if (isset($row['cart_id'])) { $cart_id = $row['cart_id']; $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']; $row_index = $row['row_index']; $meta_type = isset($row['meta_type']) ? $row['meta_type'] : array(); $meta_key = isset($row['meta_key']) ? $row['meta_key'] : array(); $pictid = wc2_get_mainpictid($item_code); $cart_thumbnail = !empty($pictid) ? wc2_the_item_image(0, 60, 60, $post_id) : wc2_no_image(); $cart_item_name = wc2_get_cart_item_name($item_name, $item_code, $sku_name, $sku_code); $cart_options = ''; $cart_options = apply_filters('wc2_filter_order_cart_row_options', $cart_options, $idx, $row); $stock_status = wc2_get_item_stock_status($item_id, $sku_id); $stock = wc2_get_item_stock($item_id, $sku_id); $stock_signal_red = apply_filters('wc2_filter_stock_signal_red', 20); $red = $stock_signal_red < $stock ? ' signal_red' : ''; $num++; ?> <tr id="<?php echo $row_index; ?> "> <td class="num"><?php echo $num; ?> </td> <td class="thumbnail"><?php echo $cart_thumbnail; ?> </td> <td class="name"><?php esc_html_e($cart_item_name); echo $cart_options; ?> </td> <td class="price"><input name="sku_price[<?php echo $cart_id; ?> ]" id="sku_price-<?php echo $cart_id; ?> " class="text price right" type="text" value="<?php wc2_crform_e($price, false, false, false); ?> " /></td> <td class="quantity"><input name="quantity[<?php echo $cart_id; ?> ]" id="quantity-<?php echo $cart_id; ?> " class="text quantity right" type="text" value="<?php esc_attr_e($quantity); ?> " /></td> <td id="subtotal-<?php echo $cart_id; ?> " class="subtotal"> </td> <td class="stock<?php echo $red; ?> "><?php echo esc_html($stock_status); ?> </td> <td class="action"> <input type="hidden" name="cart_id[]" id="cart_id-<?php echo $cart_id; ?> " value="<?php esc_attr_e($cart_id); ?> " /> <input type="hidden" name="cart_post_id[<?php echo $cart_id; ?> ]" value="<?php esc_attr_e($post_id); ?> " /> <input type="hidden" name="item_id[<?php echo $cart_id; ?> ]" value="<?php esc_attr_e($item_id); ?> " /> <input type="hidden" name="sku_id[<?php echo $cart_id; ?> ]" value="<?php esc_attr_e($sku_id); ?> " /> <input type="hidden" name="row_index[<?php echo $cart_id; ?> ]" value="<?php esc_attr_e($row_index); ?> " /> <?php foreach ((array) $meta_type as $type => $meta) { ?> <?php foreach ((array) $meta as $key => $value) { ?> <input type="hidden" name="meta_type[<?php echo $cart_id; ?> ][<?php echo $type; ?> ][<?php echo $key; ?> ]" value="<?php esc_attr_e($value); ?> " /> <?php } ?> <?php } ?> <?php foreach ((array) $meta_key as $key => $value) { ?> <input type="hidden" name="meta_key[<?php echo $cart_id; ?> ][<?php echo $key; ?> ]" value="<?php esc_attr_e($value); ?> " /> <?php } ?> <input type="button" id="cart-remove-<?php echo $cart_id; ?> " class="cart-remove button" value="<?php _e('削除', 'wc2'); ?> " /> <?php do_action('wc2_action_admin_order_cart_row', $order_id, $cart, $idx); ?> </td> </tr> <?php } } } $row = ob_get_contents(); ob_end_clean(); return apply_filters('wc2_filter_admin_order_cart_row', $row, $order_id, $cart); }