当前位置: 首页>>代码示例>>PHP>>正文


PHP wcj_get_table_html函数代码示例

本文整理汇总了PHP中wcj_get_table_html函数的典型用法代码示例。如果您正苦于以下问题:PHP wcj_get_table_html函数的具体用法?PHP wcj_get_table_html怎么用?PHP wcj_get_table_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wcj_get_table_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_custom_payment_gateways_fields_admin_order_meta_box

 /**
  * create_custom_payment_gateways_fields_admin_order_meta_box.
  *
  * @version 2.5.2
  * @since   2.5.2
  */
 function create_custom_payment_gateways_fields_admin_order_meta_box()
 {
     $order_id = get_the_ID();
     $html = '';
     $input_fields = get_post_meta($order_id, '_wcj_custom_payment_gateway_input_fields', true);
     $table_data = array();
     foreach ($input_fields as $name => $value) {
         $table_data[] = array($name, $value);
     }
     $html .= wcj_get_table_html($table_data, array('table_class' => 'widefat striped', 'table_heading_type' => 'vertical'));
     echo $html;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:18,代码来源:class-wcj-payment-gateways.php

示例2: create_custom_tabs_meta_box

 /**
  * create_custom_tabs_meta_box.
  *
  * @version 2.5.0
  */
 public function create_custom_tabs_meta_box()
 {
     $current_post_id = get_the_ID();
     $option_name = 'wcj_custom_product_tabs_local_total_number';
     if (!($total_custom_tabs = get_post_meta($current_post_id, '_' . $option_name, true))) {
         $total_custom_tabs = apply_filters('booster_get_option', 1, get_option('wcj_custom_product_tabs_local_total_number_default', 1));
     }
     $html = '';
     $is_disabled = apply_filters('booster_get_message', '', 'readonly_string');
     $is_disabled_message = apply_filters('booster_get_message', '', 'desc');
     $html .= '<table>';
     $html .= '<tr>';
     $html .= '<th>';
     $html .= __('Total number of custom tabs', 'woocommerce-jetpack');
     $html .= '</th>';
     $html .= '<td>';
     $html .= '<input type="number" min="0" id="' . $option_name . '" name="' . $option_name . '" value="' . $total_custom_tabs . '" ' . $is_disabled . '>';
     $html .= '</td>';
     $html .= '<td>';
     $html .= __('Click "Update" product after you change this number.', 'woocommerce-jetpack') . '<br>' . $is_disabled_message;
     $html .= '</td>';
     $html .= '</td>';
     $html .= '</tr>';
     $html .= '</table>';
     echo $html;
     $options = array(array('id' => 'wcj_custom_product_tabs_title_local_', 'title' => __('Title', 'woocommerce-jetpack'), 'type' => 'text'), array('id' => 'wcj_custom_product_tabs_priority_local_', 'title' => __('Order', 'woocommerce-jetpack'), 'type' => 'number'), array('id' => 'wcj_custom_product_tabs_content_local_', 'title' => __('Content', 'woocommerce-jetpack'), 'type' => 'textarea'));
     $enable_wp_editor = get_option('wcj_custom_product_tabs_local_wp_editor_enabled', 'yes');
     $enable_wp_editor = 'yes' === $enable_wp_editor ? true : false;
     for ($i = 1; $i <= $total_custom_tabs; $i++) {
         $is_local_tab_visible = $this->is_local_tab_visible($i, $current_post_id);
         $readonly = $is_local_tab_visible ? '' : ' readonly';
         // not really used
         $disabled = $is_local_tab_visible ? '' : ' - ' . __('Disabled', 'woocommerce-jetpack');
         $data = array();
         $html = '<hr>';
         $html .= '<h4>' . __('Custom Product Tab', 'woocommerce-jetpack') . ' #' . $i . $disabled . '</h4>';
         if ($enable_wp_editor) {
             $the_field_wp_editor = array();
         }
         if ($is_local_tab_visible) {
             foreach ($options as $option) {
                 $option_id = $option['id'] . $i;
                 if (!($option_value = get_post_meta($current_post_id, '_' . $option_id, true))) {
                     $option_value = get_option($option['id'] . 'default_' . $i, '');
                     if ('' === $option_value && 'wcj_custom_product_tabs_priority_local_' === $option['id']) {
                         $option_value = 50;
                     }
                 }
                 switch ($option['type']) {
                     case 'number':
                         $the_field = '<input style="width:25%;min-width:100px;" type="' . $option['type'] . '" id="' . $option_id . '" name="' . $option_id . '" value="' . $option_value . '"' . $readonly . '>';
                         break;
                     case 'text':
                         $the_field = '<input style="width:50%;min-width:150px;" type="' . $option['type'] . '" id="' . $option_id . '" name="' . $option_id . '" value="' . $option_value . '"' . $readonly . '>';
                         break;
                     case 'textarea':
                         if ($enable_wp_editor) {
                             $the_field = '';
                             $the_field_wp_editor = array($option_id => $option_value);
                         } else {
                             $the_field = '<textarea style="width:100%;height:300px;" id="' . $option_id . '" name="' . $option_id . '"' . $readonly . '>' . $option_value . '</textarea>';
                         }
                         break;
                 }
                 if ('' != $the_field) {
                     $data[] = array($option['title'], $the_field);
                 }
             }
             $html .= wcj_get_table_html($data, array('table_class' => 'widefat', 'table_style' => 'margin-bottom:20px;', 'table_heading_type' => 'vertical', 'columns_styles' => array('width:10%;')));
         }
         echo $html;
         if ($enable_wp_editor && !empty($the_field_wp_editor)) {
             wp_editor(current($the_field_wp_editor), key($the_field_wp_editor));
         }
     }
     $html = '<input type="hidden" name="woojetpack_custom_tabs_save_post" value="woojetpack_custom_tabs_save_post">';
     echo $html;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:83,代码来源:class-wcj-product-tabs.php

示例3: get_products_sales


//.........这里部分代码省略.........
                     }
                     $products_data[$product_id]['total_sum'] += $item['line_total'];
                     // Sales by Month
                     $month = date('n', get_the_time('U', $order_id));
                     $year = date('Y', get_the_time('U', $order_id));
                     $years[$year] = true;
                     if (!isset($products_data[$product_id]['sales_by_month'][$year][$month])) {
                         $products_data[$product_id]['sales_by_month'][$year][$month] = 0;
                     }
                     $products_data[$product_id]['sales_by_month'][$year][$month] += $item['qty'];
                     // Title
                     if (!isset($products_data[$product_id]['title'])) {
                         $products_data[$product_id]['title'] = '';
                         $_product = wc_get_product($product_id);
                         if (is_object($_product)) {
                             $products_data[$product_id]['title'] .= $_product->get_title();
                             // get_the_title( $product_id );
                             if ('WC_Product_Variation' === get_class($_product) && is_object($_product->parent)) {
                                 $products_data[$product_id]['title'] .= '<br><em>' . $_product->get_formatted_variation_attributes(true) . '</em>';
                             } elseif ('WC_Product_Variation' === get_class($_product)) {
                                 //									$products_data[ $product_id ][ 'title' ] .= ' [PARENT PRODUCT DELETED]'; // todo
                                 $products_data[$product_id]['title'] .= $item['name'] . '<br><em>' . __('Variation', 'woocommerce-jetpack') . '</em>';
                                 // get_the_title( $product_id );
                                 $products_data[$product_id]['title'] = '<del>' . $products_data[$product_id]['title'] . '</del>';
                             }
                         } else {
                             //								$products_data[ $product_id ][ 'title' ] .= $item['name'] . ' [PRODUCT DELETED]'; // todo
                             $products_data[$product_id]['title'] .= $item['name'];
                             $products_data[$product_id]['title'] = '<del>' . $products_data[$product_id]['title'] . '</del>';
                         }
                         //							$products_data[ $product_id ][ 'title' ] .= ' [ID: ' . $product_id . ']';
                     }
                     // Last Sale Time
                     if (!isset($products_data[$product_id]['last_sale'])) {
                         $products_data[$product_id]['last_sale'] = date('Y-m-d H:i:s', get_the_time('U', $order_id));
                     }
                     // Product ID
                     if (!isset($products_data[$product_id]['product_id'])) {
                         $products_data[$product_id]['product_id'] = $product_id;
                     }
                 }
             }
             $total_orders++;
         }
         $offset += $block_size;
     }
     //		usort( $products_data, array( $this, 'sort_by_total_sales' ) );
     usort($products_data, array($this, 'sort_by_title'));
     $table_data = array();
     $the_header = array(__('ID', 'woocommerce-jetpack'), __('Product', 'woocommerce-jetpack'), __('Last Sale', 'woocommerce-jetpack'), __('Total Sales', 'woocommerce-jetpack'), __('Total Sum', 'woocommerce-jetpack'));
     foreach ($years as $year => $value) {
         if ($year != $this->year) {
             continue;
         }
         for ($i = 12; $i >= 1; $i--) {
             $the_header[] = sprintf('%04d.%02d', $year, $i);
         }
     }
     $table_data[] = $the_header;
     foreach ($products_data as $the_data) {
         if ('' == $this->product_title || false !== stripos($the_data['title'], $this->product_title)) {
             $the_row = array($the_data['product_id'], $the_data['title'], $the_data['last_sale'], $the_data['sales'], wc_price($the_data['total_sum']));
             foreach ($years as $year => $value) {
                 if ($year != $this->year) {
                     continue;
                 }
                 for ($i = 12; $i >= 1; $i--) {
                     if (isset($the_data['sales_by_month'][$year][$i])) {
                         if ($i > 1) {
                             $prev_month_data = isset($the_data['sales_by_month'][$year][$i - 1]) ? $the_data['sales_by_month'][$year][$i - 1] : 0;
                             $color = $prev_month_data >= $the_data['sales_by_month'][$year][$i] ? 'red' : 'green';
                         } else {
                             $color = 'black';
                         }
                         $the_row[] = '<span style="color:' . $color . ';">' . $the_data['sales_by_month'][$year][$i] . '</span>';
                     } else {
                         $the_row[] = '';
                     }
                 }
             }
             $table_data[] = $the_row;
         }
     }
     $menu = '';
     $menu .= '<ul class="subsubsub">';
     $menu .= '<li><a href="' . add_query_arg('year', date('Y')) . '" class="' . ($this->year == date('Y') ? 'current' : '') . '">' . date('Y') . '</a> | </li>';
     $menu .= '<li><a href="' . add_query_arg('year', date('Y') - 1) . '" class="' . ($this->year == date('Y') - 1 ? 'current' : '') . '">' . (date('Y') - 1) . '</a> | </li>';
     $menu .= '<li><a href="' . add_query_arg('year', date('Y') - 2) . '" class="' . ($this->year == date('Y') - 2 ? 'current' : '') . '">' . (date('Y') - 2) . '</a></li>';
     $menu .= '</ul>';
     $menu .= '<br class="clear">';
     $filter_form = '';
     $filter_form .= '<form method="get" action="">';
     $filter_form .= '<input type="hidden" name="page" value="' . $_GET['page'] . '" />';
     $filter_form .= '<input type="hidden" name="tab" value="' . $_GET['tab'] . '" />';
     $filter_form .= '<input type="hidden" name="report" value="' . $_GET['report'] . '" />';
     $filter_form .= '<input type="text" name="product_title" title="" value="' . $this->product_title . '" /><input type="submit" value="' . __('Filter products', 'woocommerce-jetpack') . '" />';
     $filter_form .= '</form>';
     $the_results = !empty($products_data) ? wcj_get_table_html($table_data, array('table_class' => 'widefat striped')) : '<p><em>' . __('No sales data for current period.') . '</em></p>';
     return '<p>' . $menu . '</p>' . '<p>' . $filter_form . '</p>' . $the_results;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:101,代码来源:wcj-class-reports-sales.php

示例4: wcj_product_add_new


//.........这里部分代码省略.........
     }
     if (isset($_GET['wcj_edit_product_image_delete'])) {
         $product_id = $_GET['wcj_edit_product_image_delete'];
         $post_author_id = get_post_field('post_author', $product_id);
         $user_ID = get_current_user_id();
         if ($user_ID != $post_author_id) {
             echo '<p>' . __('Wrong user ID!', 'woocommerce-jetpack') . '</p>';
         } else {
             $image_id = get_post_thumbnail_id($product_id);
             wp_delete_post($image_id, true);
         }
     }
     if (0 != $atts['product_id']) {
         $this->the_product = wc_get_product($atts['product_id']);
     }
     $header_html .= '<h3>';
     $header_html .= 0 == $atts['product_id'] ? __('Add New Product', 'woocommerce-jetpack') : __('Edit Product', 'woocommerce-jetpack');
     $header_html .= '</h3>';
     $header_html .= '<form method="post" action="' . remove_query_arg(array('wcj_edit_product_image_delete', 'wcj_delete_product')) . '" enctype="multipart/form-data">';
     // todo multipart only if image...
     $required_mark_html_template = '&nbsp;<abbr class="required" title="required">*</abbr>';
     $table_data = array();
     $input_style = 'width:100%;';
     $table_data[] = array('<label for="wcj_add_new_product_title">' . __('Title', 'woocommerce-jetpack') . $required_mark_html_template . '</label>', '<input required type="text" style="' . $input_style . '" id="wcj_add_new_product_title" name="wcj_add_new_product_title" value="' . (0 != $atts['product_id'] ? $this->the_product->get_title() : $args['title']) . '">');
     if ('yes' === $atts['desc_enabled']) {
         $required_html = 'yes' === $atts['desc_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['desc_required'] ? $required_mark_html_template : '';
         $table_data[] = array('<label for="wcj_add_new_product_desc">' . __('Description', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<textarea' . $required_html . ' style="' . $input_style . '" id="wcj_add_new_product_desc" name="wcj_add_new_product_desc">' . (0 != $atts['product_id'] ? get_post_field('post_content', $atts['product_id']) : $args['desc']) . '</textarea>');
     }
     if ('yes' === $atts['short_desc_enabled']) {
         $required_html = 'yes' === $atts['short_desc_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['short_desc_required'] ? $required_mark_html_template : '';
         $table_data[] = array('<label for="wcj_add_new_product_short_desc">' . __('Short Description', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<textarea' . $required_html . ' style="' . $input_style . '" id="wcj_add_new_product_short_desc" name="wcj_add_new_product_short_desc">' . (0 != $atts['product_id'] ? get_post_field('post_excerpt', $atts['product_id']) : $args['short_desc']) . '</textarea>');
     }
     if ('yes' === $atts['image_enabled']) {
         $required_html = 'yes' === $atts['image_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['image_required'] ? $required_mark_html_template : '';
         $new_image_field = '<input' . $required_html . ' type="file" id="wcj_add_new_product_image" name="wcj_add_new_product_image" accept="image/*">';
         if (0 != $atts['product_id']) {
             $the_field = '' == get_post_thumbnail_id($atts['product_id']) ? $new_image_field : '<a href="' . add_query_arg('wcj_edit_product_image_delete', $atts['product_id']) . '" onclick="return confirm(\'' . __('Are you sure?', 'woocommerce-jetpack') . '\')">' . __('Delete', 'woocommerce-jetpack') . '</a><br>' . get_the_post_thumbnail($atts['product_id'], array(50, 50), array('class' => 'alignleft'));
         } else {
             $the_field = $new_image_field;
         }
         $table_data[] = array('<label for="wcj_add_new_product_image">' . __('Image', 'woocommerce-jetpack') . $required_mark_html . '</label>', $the_field);
     }
     if ('yes' === $atts['regular_price_enabled']) {
         $required_html = 'yes' === $atts['regular_price_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['regular_price_required'] ? $required_mark_html_template : '';
         $table_data[] = array('<label for="wcj_add_new_product_regular_price">' . __('Regular Price', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<input' . $required_html . ' type="number" min="0" step="0.01" id="wcj_add_new_product_regular_price" name="wcj_add_new_product_regular_price" value="' . (0 != $atts['product_id'] ? get_post_meta($atts['product_id'], '_regular_price', true) : $args['regular_price']) . '">');
     }
     if ('yes' === $atts['sale_price_enabled']) {
         $required_html = 'yes' === $atts['sale_price_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['sale_price_required'] ? $required_mark_html_template : '';
         $table_data[] = array('<label for="wcj_add_new_product_sale_price">' . __('Sale Price', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<input' . $required_html . ' type="number" min="0" step="0.01" id="wcj_add_new_product_sale_price" name="wcj_add_new_product_sale_price" value="' . (0 != $atts['product_id'] ? get_post_meta($atts['product_id'], '_sale_price', true) : $args['sale_price']) . '">');
     }
     if ('yes' === $atts['cats_enabled']) {
         $required_html = 'yes' === $atts['cats_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['cats_required'] ? $required_mark_html_template : '';
         $current_product_categories = 0 != $atts['product_id'] ? get_the_terms($atts['product_id'], 'product_cat') : $args['cats'];
         $product_categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
         $product_categories_as_select_options = '';
         foreach ($product_categories as $product_category) {
             $selected = '';
             if (!empty($current_product_categories)) {
                 foreach ($current_product_categories as $current_product_category) {
                     if (is_object($current_product_category)) {
                         $current_product_category = $current_product_category->slug;
                     }
                     $selected .= selected($current_product_category, $product_category->slug, false);
                 }
             }
             $product_categories_as_select_options .= '<option value="' . $product_category->slug . '" ' . $selected . '>' . $product_category->name . '</option>';
         }
         $table_data[] = array('<label for="wcj_add_new_product_cats">' . __('Categories', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<select' . $required_html . ' multiple style="' . $input_style . '" id="wcj_add_new_product_cats" name="wcj_add_new_product_cats[]">' . $product_categories_as_select_options . '</select>');
     }
     if ('yes' === $atts['tags_enabled']) {
         $required_html = 'yes' === $atts['tags_required'] ? ' required' : '';
         $required_mark_html = 'yes' === $atts['tags_required'] ? $required_mark_html_template : '';
         $current_product_tags = 0 != $atts['product_id'] ? get_the_terms($atts['product_id'], 'product_tag') : $args['tags'];
         $products_tags = get_terms('product_tag', 'orderby=name&hide_empty=0');
         $products_tags_as_select_options = '';
         foreach ($products_tags as $products_tag) {
             $selected = '';
             if (!empty($current_product_tags)) {
                 foreach ($current_product_tags as $current_product_tag) {
                     if (is_object($current_product_tag)) {
                         $current_product_tag = $current_product_tag->slug;
                     }
                     $selected .= selected($current_product_tag, $products_tag->slug, false);
                 }
             }
             $products_tags_as_select_options .= '<option value="' . $products_tag->slug . '" ' . $selected . '>' . $products_tag->name . '</option>';
         }
         $table_data[] = array('<label for="wcj_add_new_product_tags">' . __('Tags', 'woocommerce-jetpack') . $required_mark_html . '</label>', '<select' . $required_html . ' multiple style="' . $input_style . '" id="wcj_add_new_product_tags" name="wcj_add_new_product_tags[]">' . $products_tags_as_select_options . '</select>');
     }
     $input_fields_html .= wcj_get_table_html($table_data, array('table_class' => 'widefat', 'table_heading_type' => 'vertical'));
     $footer_html .= '<input type="submit" class="button" name="wcj_add_new_product" value="' . (0 == $atts['product_id'] ? __('Add', 'woocommerce-jetpack') : __('Edit', 'woocommerce-jetpack')) . '">';
     $footer_html .= '</form>';
     return $notice_html . $header_html . $input_fields_html . $footer_html;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:101,代码来源:class-wcj-products-add-form-shortcodes.php

示例5: get_products_atts

 function get_products_atts()
 {
     $total_products = 0;
     $products_attributes = array();
     $attributes_names = array();
     $attributes_names['wcj_title'] = __('Product', 'woocommerce-jetpack');
     $attributes_names['wcj_category'] = __('Category', 'woocommerce-jetpack');
     $offset = 0;
     $block_size = 96;
     while (true) {
         $args_products = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $block_size, 'orderby' => 'title', 'order' => 'ASC', 'offset' => $offset);
         $loop_products = new WP_Query($args_products);
         if (!$loop_products->have_posts()) {
             break;
         }
         while ($loop_products->have_posts()) {
             $loop_products->the_post();
             $total_products++;
             $product_id = $loop_products->post->ID;
             $the_product = wc_get_product($product_id);
             $products_attributes[$product_id]['wcj_title'] = '<a href="' . get_permalink($product_id) . '">' . $the_product->get_title() . '</a>';
             $products_attributes[$product_id]['wcj_category'] = $the_product->get_categories();
             foreach ($the_product->get_attributes() as $attribute) {
                 $products_attributes[$product_id][$attribute['name']] = $the_product->get_attribute($attribute['name']);
                 if (!isset($attributes_names[$attribute['name']])) {
                     $attributes_names[$attribute['name']] = wc_attribute_label($attribute['name']);
                 }
             }
         }
         $offset += $block_size;
     }
     $table_data = array();
     if (isset($_GET['wcj_attribute']) && '' != $_GET['wcj_attribute']) {
         $table_data[] = array(__('Product', 'woocommerce-jetpack'), __('Category', 'woocommerce-jetpack'), $_GET['wcj_attribute']);
     } else {
         //			$table_data[] = array_values( $attributes_names );
         $table_data[] = array_keys($attributes_names);
     }
     foreach ($attributes_names as $attributes_name => $attribute_title) {
         if (isset($_GET['wcj_attribute']) && '' != $_GET['wcj_attribute']) {
             if ('wcj_title' != $attributes_name && 'wcj_category' != $attributes_name && $_GET['wcj_attribute'] != $attributes_name) {
                 continue;
             }
         }
         foreach ($products_attributes as $product_id => $product_attributes) {
             $table_data[$product_id][$attributes_name] = isset($product_attributes[$attributes_name]) ? $product_attributes[$attributes_name] : '';
         }
     }
     return '<p>' . __('Total Products:', 'woocommerce-jetpack') . ' ' . $total_products . '</p>' . wcj_get_table_html($table_data, array('table_class' => 'widefat striped'));
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:50,代码来源:class-wcj-general.php

示例6: create_bulk_price_converter_tool

 /**
  * create_bulk_price_converter_tool.
  *
  * @version 2.4.0
  */
 public function create_bulk_price_converter_tool()
 {
     $result_message = '';
     $multiply_prices_by = isset($_POST['multiply_prices_by']) ? $_POST['multiply_prices_by'] : 1;
     $is_preview = isset($_POST['bulk_change_prices_preview']) ? true : false;
     $result_changing_prices = '';
     if ($multiply_prices_by <= 0) {
         $result_message = '<p><div class="error"><p><strong>' . __('Multiply value must be above zero.', 'woocommerce-jetpack') . '</strong></p></div></p>';
         $multiply_prices_by = 1;
     } else {
         if (isset($_POST['bulk_change_prices']) || isset($_POST['bulk_change_prices_preview'])) {
             $result_changing_prices = $this->change_all_products_prices($multiply_prices_by, $is_preview);
             if (!$is_preview) {
                 $result_message = '<p><div class="updated"><p><strong>' . __('Prices changed successfully!', 'woocommerce-jetpack') . '</strong></p></div></p>';
                 $multiply_prices_by = 1;
             }
         }
     }
     $select_options_html = '';
     $selected_option = isset($_POST['wcj_product_cat']) ? $_POST['wcj_product_cat'] : '';
     $product_categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
     if (!empty($product_categories) && !is_wp_error($product_categories)) {
         foreach ($product_categories as $product_category) {
             $select_options_html .= '<option value="' . $product_category->slug . '"' . selected($product_category->slug, $selected_option, false) . '>' . $product_category->name . '</option>';
         }
     }
     // Output HTML
     echo '<div>';
     echo $this->get_tool_header_html('bulk_price_converter');
     echo $result_message;
     echo '<form method="post" action="">';
     $data_table = array();
     $data_table[] = array(__('Multiply all product prices by', 'woocommerce-jetpack'), '<input class="" type="number" step="0.000001" min="0.000001" name="multiply_prices_by" id="multiply_prices_by" value="' . $multiply_prices_by . '">');
     if ('' != $select_options_html) {
         $data_table[] = array(__('Category', 'woocommerce-jetpack'), '<select name="wcj_product_cat" ' . apply_filters('wcj_get_option_filter', 'disabled', '') . '>' . '<option value="wcj_any">' . __('Any', 'woocommerce-jetpack') . '</option>' . $select_options_html . '</select>' . ' ' . apply_filters('get_wc_jetpack_plus_message', '', 'desc'));
     }
     $data_table[] = array('<input class="button-primary" type="submit" name="bulk_change_prices_preview" id="bulk_change_prices_preview" value="' . __('Preview Prices', 'woocommerce-jetpack') . '">', '');
     if (isset($_POST['bulk_change_prices_preview'])) {
         $data_table[] = array('<input class="button-primary" type="submit" name="bulk_change_prices" id="bulk_change_prices" value="' . __('Change Prices', 'woocommerce-jetpack') . '">', '');
     }
     /* <input type="checkbox" name="make_pretty_prices" id="make_pretty_prices" value="">Make Pretty Prices */
     echo wcj_get_table_html($data_table, array('table_heading_type' => 'none'));
     echo '</form>';
     if ($is_preview) {
         echo $result_changing_prices;
     }
     echo '</div>';
 }
开发者ID:bailoo,项目名称:10dollrWP,代码行数:53,代码来源:class-wcj-product-bulk-price-converter.php

示例7: get_invoices_report

 /**
  * Invoices Report function.
  */
 function get_invoices_report($year, $month)
 {
     $output = '';
     $data = array();
     $data[] = array(__('Invoice Nr.', 'woocommerce-jetpack'), __('Invoice Date', 'woocommerce-jetpack'), __('Order ID', 'woocommerce-jetpack'), __('Customer Country', 'woocommerce-jetpack'), __('Tax %', 'woocommerce-jetpack'), __('Order Total Tax Excl.', 'woocommerce-jetpack'), __('Order Taxes', 'woocommerce-jetpack'), __('Order Total', 'woocommerce-jetpack'), __('Order Currency', 'woocommerce-jetpack'));
     $total_sum = 0;
     $total_sum_excl_tax = 0;
     $total_tax = 0;
     $args = array('post_type' => 'shop_order', 'post_status' => 'any', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'ASC', 'year' => $year, 'monthnum' => $month);
     $loop = new WP_Query($args);
     while ($loop->have_posts()) {
         $loop->the_post();
         $order_id = $loop->post->ID;
         $invoice_type_id = 'invoice';
         if (wcj_is_invoice_created($order_id, $invoice_type_id)) {
             $the_order = wc_get_order($order_id);
             $user_meta = get_user_meta($the_order->get_user_id());
             $billing_country = isset($user_meta['billing_country'][0]) ? $user_meta['billing_country'][0] : '';
             $shipping_country = isset($user_meta['shipping_country'][0]) ? $user_meta['shipping_country'][0] : '';
             $customer_country = '' == $billing_country ? $shipping_country : $billing_country;
             $order_total = $the_order->get_total();
             $order_tax = apply_filters('wcj_order_total_tax', $the_order->get_total_tax(), $the_order);
             //$order_tax_percent = ( isset( $taxes_by_countries_eu[ $customer_country ] ) ) ? $taxes_by_countries_eu[ $customer_country ] : 0;
             //$order_tax_percent /= 100;
             //$order_tax = $order_total * $order_tax_percent;
             $order_total_exlc_tax = $order_total - $order_tax;
             $order_tax_percent = 0 == $order_total ? 0 : $order_tax / $order_total_exlc_tax;
             $total_sum += $order_total;
             $total_sum_excl_tax += $order_total_exlc_tax;
             $total_tax += $order_tax;
             //$order_tax_html = ( 0 == $order_tax ) ? '' : sprintf( '$ %.2f', $order_tax );
             $order_tax_html = sprintf('%.2f', $order_tax);
             $data[] = array(wcj_get_invoice_number($order_id, $invoice_type_id), wcj_get_invoice_date($order_id, $invoice_type_id, 0, get_option('date_format')), $order_id, $customer_country, sprintf('%.0f %%', $order_tax_percent * 100), sprintf('%.2f', $order_total_exlc_tax), $order_tax_html, sprintf('%.2f', $order_total), $the_order->get_order_currency());
         }
     }
     /* $output .= '<h3>' . 'Total Sum Excl. Tax: ' . sprintf( '$ %.2f', $total_sum_excl_tax ) . '</h3>';
     		$output .= '<h3>' . 'Total Sum: ' . sprintf( '$ %.2f', $total_sum ) . '</h3>';
     		$output .= '<h3>' . 'Total Tax: ' . sprintf( '$ %.2f', $total_tax ) . '</h3>'; */
     $output .= wcj_get_table_html($data, array('table_class' => 'widefat'));
     /**/
     return $output;
 }
开发者ID:JaneJieYing,项目名称:kiddoonline_dvlpment,代码行数:45,代码来源:class-wcj-pdf-invoicing-report-tool.php

示例8: wcj_product_wholesale_price_table

 /**
  * wcj_product_wholesale_price_table.
  */
 function wcj_product_wholesale_price_table($atts)
 {
     if (!wcj_is_product_wholesale_enabled($this->the_product->id)) {
         return '';
     }
     $wholesale_price_levels = array();
     for ($i = 1; $i <= apply_filters('wcj_get_option_filter', 1, get_option('wcj_wholesale_price_levels_number', 1)); $i++) {
         $level_qty = get_option('wcj_wholesale_price_level_min_qty_' . $i, PHP_INT_MAX);
         $discount_percent = get_option('wcj_wholesale_price_level_discount_percent_' . $i, 0);
         $discount_koef = 1.0 - $discount_percent / 100.0;
         $wholesale_price_levels[] = array('quantity' => $level_qty, 'koef' => $discount_koef, 'discount_percent' => $discount_percent);
     }
     $data_qty = array();
     $data_price = array();
     foreach ($wholesale_price_levels as $wholesale_price_level) {
         $the_price = '';
         // Variable
         if ($this->the_product->is_type('variable')) {
             $min = $this->the_product->get_variation_price('min', false);
             $max = $this->the_product->get_variation_price('max', false);
             if ('' !== $wholesale_price_level['koef'] && is_numeric($wholesale_price_level['koef'])) {
                 $min = $min * $wholesale_price_level['koef'];
                 $max = $max * $wholesale_price_level['koef'];
             }
             if ('yes' !== $atts['hide_currency']) {
                 $min = wc_price($min);
                 $max = wc_price($max);
             }
             $the_price = sprintf('%s-%s', $min, $max);
         } else {
             //$the_price = wc_price( round( $this->the_product->get_price() * $wholesale_price_level['koef'], $precision ) );
             $the_price = $this->the_product->get_price();
             if ('' !== $wholesale_price_level['koef'] && is_numeric($wholesale_price_level['koef'])) {
                 $the_price = $the_price * $wholesale_price_level['koef'];
             }
             if ('yes' !== $atts['hide_currency']) {
                 $the_price = wc_price($the_price);
             }
         }
         $data_qty[] = str_replace('%level_qty%', $wholesale_price_level['quantity'], $atts['heading_format']);
         $data_price[] = $the_price;
         if ('yes' === $atts['add_percent_row']) {
             $data_discount_percent[] = '-' . $wholesale_price_level['discount_percent'] . '%';
         }
     }
     $table_rows = array($data_qty, $data_price);
     if ('yes' === $atts['add_percent_row']) {
         $table_rows[] = $data_discount_percent;
     }
     $table_styles = array('columns_styles' => array('text-align: center;', 'text-align: center;', 'text-align: center;'));
     return wcj_get_table_html($table_rows, $table_styles);
 }
开发者ID:bailoo,项目名称:10dollrWP,代码行数:55,代码来源:class-wcj-products-shortcodes.php

示例9: get_html

 /**
  * get_data function.
  */
 public function get_html($data, $total_customers, $report_type = 'all_countries')
 {
     $html = '';
     if ('all_countries' === $report_type) {
         $html .= '<h5>' . __('Total customers', 'woocommerce-jetpack') . ': ' . $total_customers . '</h5>';
         $html .= '<table class="widefat" style="width:100% !important;"><tbody>';
         $html .= '<tr>';
         $html .= '<th></th>';
         //'<th>' . __( 'Country Flag', 'woocommerce-jetpack' ) . '</th>';
         $html .= '<th>' . __('Country Code', 'woocommerce-jetpack') . '</th>';
         $html .= '<th>' . __('Customers Count', 'woocommerce-jetpack') . '</th>';
         $html .= '<th>' . __('Percent of total', 'woocommerce-jetpack') . '</th>';
         $html .= '<th></th>';
         $html .= '<th></th>';
         $html .= '</tr>';
         $i = 0;
         foreach ($data as $country_code => $result) {
             $result = $result['customer_counter'];
             $html .= '<tr>';
             $html .= '<td>' . ++$i . '</td>';
             $country_code_link = '<a href="' . add_query_arg(array('country' => $country_code)) . '">' . $country_code . '</a>';
             $html .= 2 == strlen($country_code) ? '<td>' . $country_code_link . '</td>' : '<td>' . $country_code . '</td>';
             $html .= '<td>' . $result . '</td>';
             $html .= 0 != $total_customers ? '<td>' . number_format($result / $total_customers * 100, 2) . '%' . '</td>' : '<td></td>';
             $country_flag_img = '<img src="' . plugins_url() . '/' . 'woocommerce-jetpack' . '/assets/images/flag-icons/' . strtolower($country_code) . '.png" title="' . wcj_get_country_name_by_code($country_code) . '">';
             $country_flag_img_link = '<a href="' . add_query_arg(array('country' => $country_code)) . '">' . $country_flag_img . ' ' . wcj_get_country_name_by_code($country_code) . '</a>';
             $html .= 2 == strlen($country_code) ? '<td>' . $country_flag_img_link . '</td>' : '<td></td>';
             $html .= '</tr>';
         }
         $html .= '</tbody></table>';
     } else {
         //if ( 'single_country' === $report_type ) {
         $country_code = $report_type;
         $html .= '<h5>' . __('Report for:', 'woocommerce-jetpack') . ' ' . wcj_get_country_name_by_code($country_code) . ' [' . $country_code . ']' . '</h5>';
         $html .= 2 == strlen($country_code) ? wcj_get_table_html($data[$country_code]['total_spent'], array('table_class' => 'widefat')) : '';
     }
     return $html;
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:41,代码来源:wcj-class-reports-customers.php

示例10: get_settings

 /**
  * get_settings.
  *
  * @version 2.5.8
  */
 function get_settings()
 {
     $settings = array(array('title' => __('Admin Tools Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_admin_tools_module_options'), array('title' => __('Logging', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_logging_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Debug', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_debuging_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('PHP Memory Limit', 'woocommerce-jetpack'), 'desc' => __('megabytes.', 'woocommerce-jetpack'), 'desc_tip' => __('Set zero to disable.', 'woocommerce-jetpack') . $this->current_php_memory_limit, 'id' => 'wcj_admin_tools_php_memory_limit', 'default' => 0, 'type' => 'number', 'custom_attributes' => array('min' => 0)), array('title' => __('System Info', 'woocommerce-jetpack'), 'id' => 'wcj_admin_tools_system_info', 'default' => '', 'type' => 'custom_link', 'link' => '<pre>' . wcj_get_table_html($this->get_system_info_table_array(), array('columns_styles' => array('padding:0;', 'padding:0;'), 'table_heading_type' => 'vertical')) . '</pre>'), array('title' => __('Show Order Meta', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_admin_tools_show_order_meta_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Show Product Meta', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_admin_tools_show_product_meta_enabled', 'default' => 'no', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_admin_tools_module_options'));
     return $this->add_standard_settings($settings);
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:10,代码来源:class-wcj-admin-tools.php

示例11: wcj_wholesale_price_table

 /**
  * wcj_wholesale_price_table (global only).
  *
  * @version 2.5.7
  * @since   2.4.8
  */
 function wcj_wholesale_price_table($atts)
 {
     if (!wcj_is_module_enabled('wholesale_price')) {
         return '';
     }
     // Check for user role options
     $role_option_name_addon = '';
     $user_roles = get_option('wcj_wholesale_price_by_user_role_roles', '');
     if (!empty($user_roles)) {
         $current_user_role = wcj_get_current_user_first_role();
         foreach ($user_roles as $user_role_key) {
             if ($current_user_role === $user_role_key) {
                 $role_option_name_addon = '_' . $user_role_key;
                 break;
             }
         }
     }
     $wholesale_price_levels = array();
     for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_wholesale_price_levels_number' . $role_option_name_addon, 1)); $i++) {
         $level_qty = get_option('wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX);
         $discount = get_option('wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0);
         $wholesale_price_levels[] = array('quantity' => $level_qty, 'discount' => $discount);
     }
     $data_qty = array();
     $data_discount = array();
     $columns_styles = array();
     $i = -1;
     foreach ($wholesale_price_levels as $wholesale_price_level) {
         $i++;
         if (0 == $wholesale_price_level['quantity'] && 'yes' === $atts['hide_if_zero_quantity']) {
             continue;
         }
         $level_max_qty = isset($wholesale_price_levels[$i + 1]['quantity']) ? $atts['before_level_max_qty'] . ($wholesale_price_levels[$i + 1]['quantity'] - 1) : $atts['last_level_max_qty'];
         $data_qty[] = str_replace(array('%level_qty%', '%level_min_qty%', '%level_max_qty%'), array($wholesale_price_level['quantity'], $wholesale_price_level['quantity'], $level_max_qty), $atts['heading_format']);
         $data_discount[] = 'fixed' === get_option('wcj_wholesale_price_discount_type', 'percent') ? '-' . wc_price($wholesale_price_level['discount']) : '-' . $wholesale_price_level['discount'] . '%';
         $columns_styles[] = 'text-align: center;';
     }
     $table_rows = array($data_qty, $data_discount);
     if ('vertical' === $atts['table_format']) {
         $table_rows_modified = array();
         foreach ($table_rows as $row_number => $table_row) {
             foreach ($table_row as $column_number => $cell) {
                 $table_rows_modified[$column_number][$row_number] = $cell;
             }
         }
         $table_rows = $table_rows_modified;
     }
     return wcj_get_table_html($table_rows, array('table_class' => 'wcj_wholesale_price_table', 'columns_styles' => $columns_styles, 'table_heading_type' => $atts['table_format']));
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:55,代码来源:class-wcj-general-shortcodes.php

示例12: get_invoices_report

 /**
  * Invoices Report function.
  *
  * @version 2.5.7
  */
 function get_invoices_report($year, $month, $invoice_type_id)
 {
     $output = '';
     $data = $this->get_invoices_report_data($year, $month, $invoice_type_id);
     $output .= wcj_get_table_html($data, array('table_class' => 'widefat'));
     return $output;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:12,代码来源:class-wcj-pdf-invoicing-report-tool.php

示例13: add_input_fields_to_frontend

 /**
  * add_input_fields_to_frontend.
  *
  * @version 2.5.2
  * @since   2.5.0
  */
 function add_input_fields_to_frontend()
 {
     if ($this->is_bookings_product(wc_get_product())) {
         $data_table = array();
         $date_from_value = isset($_POST['wcj_product_bookings_date_from']) ? $_POST['wcj_product_bookings_date_from'] : '';
         $date_to_value = isset($_POST['wcj_product_bookings_date_to']) ? $_POST['wcj_product_bookings_date_to'] : '';
         $data_table[] = array('<label for="wcj_product_bookings_date_to">' . get_option('wcj_product_bookings_label_date_from', __('Date from')) . '</label>', '<input firstday="0" dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_from" name="wcj_product_bookings_date_from" placeholder="" value="' . $date_from_value . '">');
         $data_table[] = array('<label for="wcj_product_bookings_date_to">' . get_option('wcj_product_bookings_label_date_to', __('Date to')) . '</label>', '<input firstday="0" dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_to" name="wcj_product_bookings_date_to" placeholder="" value="' . $date_to_value . '">');
         echo wcj_get_table_html($data_table, array('table_heading_type' => 'none'));
         echo '<div style="display:none !important;" name="wcj_bookings_message"><p style="color:red;"></p></div>';
     }
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:18,代码来源:class-wcj-product-bookings.php

示例14: get_products_sales

 function get_products_sales()
 {
     $products_data = array();
     $years = array();
     $total_orders = 0;
     $offset = 0;
     $block_size = 96;
     while (true) {
         $args_orders = array('post_type' => 'shop_order', 'post_status' => 'wc-completed', 'posts_per_page' => $block_size, 'orderby' => 'date', 'order' => 'DESC', 'offset' => $offset, 'date_query' => array(array('year' => $this->year)));
         $loop_orders = new WP_Query($args_orders);
         if (!$loop_orders->have_posts()) {
             break;
         }
         while ($loop_orders->have_posts()) {
             $loop_orders->the_post();
             $order_id = $loop_orders->post->ID;
             $order = new WC_Order($order_id);
             $items = $order->get_items();
             foreach ($items as $item) {
                 if (!isset($products_data[$item['product_id']]['sales'])) {
                     $products_data[$item['product_id']]['sales'] = 0;
                 }
                 $products_data[$item['product_id']]['sales'] += $item['qty'];
                 $month = date('n', get_the_time('U'));
                 $year = date('Y', get_the_time('U'));
                 $years[$year] = true;
                 if (!isset($products_data[$item['product_id']]['sales_by_month'][$year][$month])) {
                     $products_data[$item['product_id']]['sales_by_month'][$year][$month] = 0;
                 }
                 $products_data[$item['product_id']]['sales_by_month'][$year][$month] += $item['qty'];
                 if (!isset($products_data[$item['product_id']]['title'])) {
                     $products_data[$item['product_id']]['title'] = get_the_title($item['product_id']);
                 }
                 if (!isset($products_data[$item['product_id']]['last_sale'])) {
                     $products_data[$item['product_id']]['last_sale'] = date('Y-m-d H:i:s', get_the_time('U'));
                 }
             }
             $total_orders++;
         }
         $offset += $block_size;
     }
     usort($products_data, array($this, 'sort_by_total_sales'));
     $table_data = array();
     $the_header = array(__('Product', 'woocommerce-jetpack'));
     foreach ($years as $year => $value) {
         if ($year != $this->year) {
             continue;
         }
         for ($i = 12; $i >= 1; $i--) {
             $the_header[] = sprintf('%04d.%02d', $year, $i);
         }
     }
     $table_data[] = $the_header;
     foreach ($products_data as $product_id => $the_data) {
         $the_row = array($the_data['title'] . ' (' . $the_data['sales'] . ')');
         foreach ($years as $year => $value) {
             if ($year != $this->year) {
                 continue;
             }
             for ($i = 12; $i >= 1; $i--) {
                 if ($i > 1) {
                     $prev_month_data = $the_data['sales_by_month'][$year][$i - 1];
                     $color = $prev_month_data >= $the_data['sales_by_month'][$year][$i] ? 'red' : 'green';
                 } else {
                     $color = 'black';
                 }
                 $the_row[] = '<span style="color:' . $color . ';">' . $the_data['sales_by_month'][$year][$i] . '</span>';
             }
         }
         $table_data[] = $the_row;
     }
     $menu = '';
     $menu .= '<ul class="subsubsub">';
     $menu .= '<li><a href="' . add_query_arg('year', date('Y')) . '" class="' . ($this->year == date('Y') ? 'current' : '') . '">' . date('Y') . '</a> | </li>';
     $menu .= '<li><a href="' . add_query_arg('year', date('Y') - 1) . '" class="' . ($this->year == date('Y') - 1 ? 'current' : '') . '">' . (date('Y') - 1) . '</a> | </li>';
     $menu .= '</ul>';
     $menu .= '<br class="clear">';
     return '<p>' . $menu . '</p>' . wcj_get_table_html($table_data, array('table_class' => 'widefat'));
 }
开发者ID:JaneJieYing,项目名称:kiddoonline_dvlpment,代码行数:79,代码来源:wcj-class-reports-sales.php

示例15: create_export_tool

 /**
  * create_export_tool.
  *
  * @version 2.5.9
  * @since   2.4.8
  */
 function create_export_tool($tool_id)
 {
     $data = $this->export($tool_id);
     echo $this->get_tool_header_html('export_' . $tool_id);
     echo '<form method="post" action="">';
     echo '<p>' . $this->export_filter_fields($tool_id) . '</p>';
     echo '<p>';
     echo '<button class="button-primary" type="submit" name="wcj_export" value="' . $tool_id . '">' . __('Download CSV', 'woocommerce-jetpack') . '</button>';
     echo ' ';
     echo '<button class="button-primary" type="submit" name="wcj_export_xml" value="' . $tool_id . '">' . __('Download XML', 'woocommerce-jetpack') . '</button>';
     echo '<button style="float:right;margin-right:10px;" class="button-primary" type="submit" name="wcj_export_filter" value="' . $tool_id . '">' . __('Filter by All Fields', 'woocommerce-jetpack') . '</button>';
     echo '<input style="float:right;margin-right:10px;" type="text" name="wcj_export_filter_all_columns" value="' . (isset($_POST['wcj_export_filter_all_columns']) ? $_POST['wcj_export_filter_all_columns'] : '') . '">';
     echo '</p>';
     echo '</form>';
     echo is_array($data) ? wcj_get_table_html($data, array('table_class' => 'widefat striped')) : $data;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:22,代码来源:class-wcj-export-import.php


注:本文中的wcj_get_table_html函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。