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


PHP wc_product_sku_enabled函数代码示例

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


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

示例1: bf_wc_product_general

function bf_wc_product_general($thepostid, $customfield)
{
    ?>

    <div id="general_product_data"><?php 
    if (isset($customfield['product_sku']) && $customfield['product_sku'] != 'hidden') {
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            $required = $customfield['product_sku'] == 'required' ? array('required' => '') : '';
            $required_html = $customfield['product_sku'] == 'required' ? '<span class="required">* </span>' : '';
            woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sku', 'label' => $required_html . '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr><br>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce')));
        } else {
            echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />';
        }
        do_action('woocommerce_product_options_sku');
        echo '</div>';
    }
    echo '<div class="options_group show_if_external">';
    // External URL
    woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce') . '<br>', 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce')));
    // Button text
    woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce') . '<br>', 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce')));
    echo '</div>';
    echo '<div class="options_group pricing show_if_simple show_if_external">';
    $required = $customfield['product_regular_price'][0] == 'required' ? array('required' => '') : '';
    $required_html = $customfield['product_regular_price'][0] == 'required' ? '<span class="required">* </span>' : '';
    // Price
    woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_regular_price', 'label' => $required_html . __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'data_type' => 'price'));
    if (isset($customfield['product_sales_price']) && $customfield['product_sales_price'] != 'hidden') {
        $required = $customfield['product_sales_price'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price']) ? $customfield['product_sales_price'] == 'required' ? '' : '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>' : '';
        // Special Price
        woocommerce_wp_text_input(array('custom_attributes' => $required, 'id' => '_sale_price', 'data_type' => 'price', 'label' => $required_html . __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')<br>', 'description' => $description));
    } else {
        woocommerce_wp_hidden_input(array('id' => '_sale_price', 'data_type' => 'price'));
    }
    if (isset($customfield['product_sales_price_dates']) && $customfield['product_sales_price_dates'] != 'hidden') {
        $required = $customfield['product_sales_price_dates'] == 'required' ? array('required' => '') : '';
        $required_html = $customfield['product_sales_price_dates'] == 'required' ? '<span class="required">* </span>' : '';
        $description = isset($customfield['product_sales_price_dates']) ? $customfield['product_sales_price'] == 'required' ? 'style="display: block;"' : '' : '';
        // Special Price date range
        $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : '';
        $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : '';
        echo '	<p class="form-field sale_price_dates_fields" ' . $required_style . '>
            <label for="_sale_price_dates_from">' . $required_html . __('Sale Price Dates', 'woocommerce') . '</label>
            <input ' . $required . ' type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
            <input ' . $required . ' type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
            <a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a>
        </p>';
    }
    do_action('woocommerce_product_options_pricing');
    echo '</div></div>';
    do_action('bf_woocommerce_product_options_general_last', $thepostid, $customfield);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:56,代码来源:bf-wc-product-general.php

示例2: sizeof

<?php

/**
 * Single Product Meta
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post, $product;
$cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
$tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
echo beans_open_markup('woo_single_meta_wrap', 'div', array('class' => 'product_meta'));
do_action('woocommerce_product_meta_start');
if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
    echo beans_open_markup('woo_single_meta_sku_wrap', 'span', array('class' => 'sku_wrapper'));
    _e('SKU: ', 'woocommerce');
    echo beans_open_markup('woo_single_meta_sku', 'span', array('class' => 'sku', 'itemprop' => 'sku'));
    echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce') . ' ';
    echo beans_close_markup('woo_single_meta_sku', 'span');
    echo beans_close_markup('woo_single_meta_sku_wrap', 'span');
}
echo $product->get_categories(', ', beans_open_markup('woo_single_meta_category', 'span', array('class' => 'posted_in')) . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', beans_close_markup('woo_single_meta_category', 'span'));
echo ' ';
echo $product->get_tags(', ', beans_open_markup('woo_single_meta_tags', 'span', array('class' => 'tagged_as')) . _n('Tag:', 'Tags:', $tag_count, 'woocommerce') . ' ', beans_close_markup('woo_single_meta_tags', 'span'));
do_action('woocommerce_product_meta_end');
echo beans_close_markup('woo_single_meta_wrap', 'div');
开发者ID:simondowdles,项目名称:woocommerce-overrides-for-beans,代码行数:31,代码来源:meta.php

示例3: sizeof

/**
 * Single Product Meta
 *
 * @author   WooThemes
 * @package  WooCommerce/Templates
 * @version  1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
global $post, $product;
$cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
$tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
$is_sku = wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable')) ? true : false;
$product_categories = $product->get_categories(', ', '', '');
$product_tags = $product->get_tags(', ', '', '');
$is_product_meta = $is_sku || $product_categories || $product_tags ? true : false;
?>

<?php 
if ($is_product_meta) {
    ?>
	<?php 
    do_action('woocommerce_product_meta_start');
    ?>

	<table class="product_meta">
		<?php 
    if ($is_sku) {
开发者ID:j-kenneth,项目名称:Expeero,代码行数:30,代码来源:meta.php

示例4: render_shop_order_columns

        /**
         * Output custom columns for coupons
         * @param  string $column
         */
        public function render_shop_order_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = wc_get_order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->get_status()), wc_get_order_status_name($the_order->get_status()), wc_get_order_status_name($the_order->get_status()));
                    break;
                case 'order_date':
                    if ('0000-00-00 00:00:00' == $post->post_date) {
                        $t_time = $h_time = __('Unpublished', 'woocommerce');
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                        $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
                    break;
                case 'customer_message':
                    if ($the_order->customer_message) {
                        echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_items':
                    echo '<a href="#" class="show_order_items">' . apply_filters('woocommerce_admin_order_item_count', sprintf(_n('%d item', '%d items', $the_order->get_item_count(), 'woocommerce'), $the_order->get_item_count()), $the_order) . '</a>';
                    if (sizeof($the_order->get_items()) > 0) {
                        echo '<table class="order_items" cellspacing="0">';
                        foreach ($the_order->get_items() as $item) {
                            $product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item, $product);
                            $item_meta_html = $item_meta->display(true, true);
                            ?>
						<tr class="<?php 
                            echo apply_filters('woocommerce_admin_order_item_class', '', $item);
                            ?>
">
							<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
							<td class="name">
								<?php 
                            if ($product) {
                                ?>
									<?php 
                                echo wc_product_sku_enabled() && $product->get_sku() ? $product->get_sku() . ' - ' : '';
                                ?>
<a href="<?php 
                                echo get_edit_post_link($product->id);
                                ?>
" title="<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
"><?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
</a>
								<?php 
                            } else {
                                ?>
									<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
								<?php 
                            }
                            ?>
								<?php 
                            if (!empty($item_meta_html)) {
                                ?>
									<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&ndash;';
                    }
                    break;
                case 'shipping_address':
                    if ($address = $the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url($the_order->get_shipping_address_map_url()) . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $address)) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->get_shipping_method()) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->get_shipping_method()) . '</small>';
//.........这里部分代码省略.........
开发者ID:vkolova,项目名称:bgscena,代码行数:101,代码来源:class-wc-admin-post-types.php

示例5: render_shop_subscription_columns


//.........这里部分代码省略.........
                $username = '';
                if ($the_subscription->get_user_id() && false !== ($user_info = get_userdata($the_subscription->get_user_id()))) {
                    $username = '<a href="user-edit.php?user_id=' . absint($user_info->ID) . '">';
                    if ($the_subscription->billing_first_name || $the_subscription->billing_last_name) {
                        $username .= esc_html(ucfirst($the_subscription->billing_first_name) . ' ' . ucfirst($the_subscription->billing_last_name));
                    } elseif ($user_info->first_name || $user_info->last_name) {
                        $username .= esc_html(ucfirst($user_info->first_name) . ' ' . ucfirst($user_info->last_name));
                    } else {
                        $username .= esc_html(ucfirst($user_info->display_name));
                    }
                    $username .= '</a>';
                } elseif ($the_subscription->billing_first_name || $the_subscription->billing_last_name) {
                    $username = trim($the_subscription->billing_first_name . ' ' . $the_subscription->billing_last_name);
                }
                // translators: $1: is opening link, $2: is subscription order number, $3: is closing link tag, $4: is user's name
                $column_content = sprintf(_x('%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'woocommerce-subscriptions'), '<a href="' . esc_url(admin_url('post.php?post=' . absint($post->ID) . '&action=edit')) . '">', '<strong>' . esc_attr($the_subscription->get_order_number()) . '</strong>', '</a>', $username);
                $column_content .= '</div>';
                $column_content .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'woocommerce-subscriptions') . '</span></button>';
                break;
            case 'order_items':
                // Display either the item name or item count with a collapsed list of items
                $subscription_items = $the_subscription->get_items();
                switch (count($subscription_items)) {
                    case 0:
                        $column_content .= '&ndash;';
                        break;
                    case 1:
                        foreach ($subscription_items as $item) {
                            $_product = apply_filters('woocommerce_order_item_product', $the_subscription->get_product_from_item($item), $item);
                            $item_meta = wcs_get_order_item_meta($item, $_product);
                            $item_meta_html = $item_meta->display(true, true);
                            $item_quantity = absint($item['qty']);
                            $item_name = '';
                            if (wc_product_sku_enabled() && $_product && $_product->get_sku()) {
                                $item_name .= $_product->get_sku() . ' - ';
                            }
                            $item_name .= $item['name'];
                            $item_name = apply_filters('woocommerce_order_item_name', $item_name, $item);
                            $item_name = esc_html($item_name);
                            if ($item_quantity > 1) {
                                $item_name = sprintf('%s &times; %s', absint($item_quantity), $item_name);
                            }
                            if ($_product) {
                                $item_name = sprintf('<a href="%s">%s</a>', get_edit_post_link($_product->id), $item_name);
                            }
                            ob_start();
                            ?>
							<div class="order-item">
								<?php 
                            echo wp_kses($item_name, array('a' => array('href' => array())));
                            ?>
								<?php 
                            if ($item_meta_html) {
                                ?>
								<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
								<?php 
                            }
                            ?>
							</div>
							<?php 
                            $column_content .= ob_get_clean();
                        }
                        break;
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:67,代码来源:class-wcs-admin-post-types.php

示例6: wr_ferado_product_slider


//.........这里部分代码省略.........
				<div id="<?php 
                echo $id;
                ?>
" class="owl-carousel <?php 
                echo $class;
                ?>
">

					<?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    global $product;
                    $cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
                    $tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
                    ?>
							<li <?php 
                    post_class();
                    ?>
>

								<div class="p-inner">

									<div class="p-grid">
										<span class="p-image">
											<?php 
                    if (class_exists('YITH_WCWL_UI')) {
                        echo wr_ferado_wishlist_button();
                    }
                    do_action('woocommerce_before_shop_loop_item_title');
                    ?>
											<div class="p-mask">
												<h3><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
												<?php 
                    woocommerce_get_template('loop/rating.php');
                    ?>
												<span class="p-desc">
													<?php 
                    if (!apply_filters('woocommerce_short_description', $post->post_excerpt)) {
                        $content = $post->post_content;
                        echo wp_trim_words(wpautop($content), 15);
                    } else {
                        echo wp_trim_words(apply_filters('woocommerce_short_description', $post->post_excerpt), 15);
                    }
                    ?>
												</span>
												<?php 
                    if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
                        ?>
													<span class="sku_wrapper"><?php 
                        _e('SKU:', 'woocommerce');
                        ?>
 <span class="sku" itemprop="sku"><?php 
                        echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce');
                        ?>
</span>.</span>
												<?php 
                    }
                    ?>
													<?php 
                    echo $product->get_categories(', ', '<span class="posted_in">' . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', '.</span>');
                    ?>
												<?php 
                    echo $product->get_tags(', ', '<span class="tagged_as">' . _n('Tag:', 'Tags:', $tag_count, 'woocommerce') . ' ', '.</span>');
                    ?>
											</div>
										</span>
										<span class="p-info">
											<div class="p-cart">
												<?php 
                    woocommerce_get_template('loop/add-to-cart.php');
                    ?>
											</div>
											<?php 
                    do_action('woocommerce_after_shop_loop_item_title');
                    ?>
										</span>
									</div>
								</div>
							</li>
							<?php 
                }
                ?>

				</div>

				<?php 
                if (function_exists('woocommerce_product_loop_end')) {
                    woocommerce_product_loop_end();
                }
            }
            // Restore original Post Data
            wp_reset_postdata();
            return '<div class="woocommerce product-slider">' . ob_get_clean() . '</div>';
        }
开发者ID:JaneJieYing,项目名称:HiFridays,代码行数:101,代码来源:product_slider.php

示例7: edit_columns

 /**
  * Change the columns shown in admin.
  */
 public function edit_columns($existing_columns)
 {
     if (empty($existing_columns) && !is_array($existing_columns)) {
         $existing_columns = array();
     }
     unset($existing_columns['title'], $existing_columns['comments'], $existing_columns['date']);
     $columns = array();
     $columns["cb"] = "<input type=\"checkbox\" />";
     $columns["thumb"] = '<span class="wc-image tips" data-tip="' . __('Image', 'woocommerce') . '">' . __('Image', 'woocommerce') . '</span>';
     $columns["name"] = __('Name', 'woocommerce');
     if (wc_product_sku_enabled()) {
         $columns["sku"] = __('SKU', 'woocommerce');
     }
     if (get_option('woocommerce_manage_stock') == 'yes') {
         $columns["is_in_stock"] = __('Stock', 'woocommerce');
     }
     $columns["price"] = __('Price', 'woocommerce');
     $columns["product_cat"] = __('Categories', 'woocommerce');
     $columns["product_tag"] = __('Tags', 'woocommerce');
     $columns["featured"] = '<span class="wc-featured tips" data-tip="' . __('Featured', 'woocommerce') . '">' . __('Featured', 'woocommerce') . '</span>';
     $columns["product_type"] = '<span class="wc-type tips" data-tip="' . __('Type', 'woocommerce') . '">' . __('Type', 'woocommerce') . '</span>';
     $columns["date"] = __('Date', 'woocommerce');
     return array_merge($columns, $existing_columns);
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:27,代码来源:class-wc-admin-cpt-product.php

示例8: bf_wc_variations_custom


//.........这里部分代码省略.........
            <div class="data">
                <p class="form-row form-row-first upload_image">
                    <a href="#" class="upload_image_button tips <?php 
    if ($_thumbnail_id > 0) {
        echo 'remove';
    }
    ?>
" data-tip="<?php 
    if ($_thumbnail_id > 0) {
        echo __('Remove this image', 'woocommerce');
    } else {
        echo __('Upload an image', 'woocommerce');
    }
    ?>
" rel="<?php 
    echo esc_attr($variation_id);
    ?>
"><img src="<?php 
    if (!empty($image)) {
        echo esc_attr($image);
    } else {
        echo esc_attr(wc_placeholder_img_src());
    }
    ?>
" /><input type="hidden" name="upload_image_id[<?php 
    echo $loop;
    ?>
]" class="upload_image_id" value="<?php 
    echo esc_attr($_thumbnail_id);
    ?>
" /></a>
                </p>
                <?php 
    if (wc_product_sku_enabled()) {
        ?>
                    <p class="sku form-row form-row-last">
                        <label><?php 
        _e('SKU', 'woocommerce');
        ?>
: <a class="tips" data-tip="<?php 
        esc_attr_e('Enter a SKU for this variation or leave blank to use the parent product SKU.', 'woocommerce');
        ?>
" href="#">[?]</a></label>
                        <input type="text" size="5" name="variable_sku[<?php 
        echo $loop;
        ?>
]" value="<?php 
        if (isset($_sku)) {
            echo esc_attr($_sku);
        }
        ?>
" placeholder="<?php 
        echo esc_attr($parent_data['sku']);
        ?>
" />
                    </p>
                <?php 
    } else {
        ?>
                    <input type="hidden" name="variable_sku[<?php 
        echo $loop;
        ?>
]" value="<?php 
        if (isset($_sku)) {
            echo esc_attr($_sku);
        }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:67,代码来源:bf-wc-product-variations.php

示例9: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $post, $wpdb, $thepostid;
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $thepostid = $post->ID;
        if ($terms = wp_get_object_terms($post->ID, 'product_type')) {
            $product_type = sanitize_title(current($terms)->name);
        } else {
            $product_type = apply_filters('default_product_type', 'simple');
        }
        $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate product', 'woocommerce'), 'variable' => __('Variable product', 'woocommerce')), $product_type);
        $type_box = '<label for="product-type"><select id="product-type" name="product-type"><optgroup label="' . __('Product Type', 'woocommerce') . '">';
        foreach ($product_type_selector as $value => $label) {
            $type_box .= '<option value="' . esc_attr($value) . '" ' . selected($product_type, $value, false) . '>' . esc_html($label) . '</option>';
        }
        $type_box .= '</optgroup></select></label>';
        $product_type_options = apply_filters('product_type_options', array('virtual' => array('id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Virtual products are intangible and aren\'t shipped.', 'woocommerce'), 'default' => 'no'), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce'), 'default' => 'no')));
        foreach ($product_type_options as $key => $option) {
            $selected_value = get_post_meta($post->ID, '_' . $key, true);
            if ($selected_value == '' && isset($option['default'])) {
                $selected_value = $option['default'];
            }
            $type_box .= '<label for="' . esc_attr($option['id']) . '" class="' . esc_attr($option['wrapper_class']) . ' tips" data-tip="' . esc_attr($option['description']) . '">' . esc_html($option['label']) . ': <input type="checkbox" name="' . esc_attr($option['id']) . '" id="' . esc_attr($option['id']) . '" ' . checked($selected_value, 'yes', false) . ' /></label>';
        }
        ?>
		<div class="panel-wrap product_data">

			<span class="type_box"> &mdash; <?php 
        echo $type_box;
        ?>
</span>

			<div class="wc-tabs-back"></div>

			<ul class="product_data_tabs wc-tabs" style="display:none;">
				<?php 
        $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_product_data', 'class' => array('hide_if_grouped')), 'inventory' => array('label' => __('Inventory', 'woocommerce'), 'target' => 'inventory_product_data', 'class' => array('show_if_simple', 'show_if_variable', 'show_if_grouped')), 'shipping' => array('label' => __('Shipping', 'woocommerce'), 'target' => 'shipping_product_data', 'class' => array('hide_if_virtual', 'hide_if_grouped', 'hide_if_external')), 'linked_product' => array('label' => __('Linked Products', 'woocommerce'), 'target' => 'linked_product_data', 'class' => array()), 'attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', 'class' => array()), 'variations' => array('label' => __('Variations', 'woocommerce'), 'target' => 'variable_product_options', 'class' => array('variations_tab', 'show_if_variable')), 'advanced' => array('label' => __('Advanced', 'woocommerce'), 'target' => 'advanced_product_data', 'class' => array())));
        foreach ($product_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        do_action('woocommerce_product_write_panel_tabs');
        ?>
			</ul>
			<div id="general_product_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            woocommerce_wp_text_input(array('id' => '_sku', 'label' => '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce')));
        } else {
            echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />';
        }
        do_action('woocommerce_product_options_sku');
        echo '</div>';
        echo '<div class="options_group show_if_external">';
        // External URL
        woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce'), 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce')));
        // Button text
        woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce'), 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce')));
        echo '</div>';
        echo '<div class="options_group pricing show_if_simple show_if_external">';
        // Price
        woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        // Special Price
        woocommerce_wp_text_input(array('id' => '_sale_price', 'data_type' => 'price', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>'));
        // Special Price date range
        $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : '';
        $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : '';
        echo '	<p class="form-field sale_price_dates_fields">
								<label for="_sale_price_dates_from">' . __('Sale Price Dates', 'woocommerce') . '</label>
								<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a>
							</p>';
        do_action('woocommerce_product_options_pricing');
        echo '</div>';
        echo '<div class="options_group show_if_downloadable">';
        ?>
					<div class="form-field downloadable_files">
						<label><?php 
//.........这里部分代码省略.........
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:101,代码来源:class-wc-meta-box-product-data.php

示例10: set_product_meta

 public static function set_product_meta()
 {
     global $post, $product;
     $cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
     $tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
     echo '<div class="product_meta_pwyw">';
     do_action('woocommerce_product_meta_start');
     if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
         $sku = $product->get_sku();
         if ($sku) {
             __('N/A', 'woocommerce');
         }
         echo '<span class="sku_wrapper">' . _e('SKU: ', 'woocommerce') . '<span class="sku" itemprop="sku">' . $sku . '</span>.</span><br>';
     }
     echo $product->get_categories(', ', '<span class="posted_in">' . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', '.</span>') . '<br>';
     echo $product->get_tags(', ', '<span class="tagged_as">' . _n('Tag:', 'Tags:', $tag_count, 'woocommerce') . ' ', '.</span>');
     do_action('woocommerce_product_meta_end');
     echo "</div>";
 }
开发者ID:arifur,项目名称:woocommerce-pay-what-you-want,代码行数:19,代码来源:woocommerce-pay-what-you-want.php

示例11: custom_columns

        /**
         * Define our custom columns shown in admin.
         * @param  string $column
         */
        public function custom_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = new WC_Order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->status), esc_html__($the_order->status, 'woocommerce'), esc_html__($the_order->status, 'woocommerce'));
                    break;
                case 'order_date':
                    if ('0000-00-00 00:00:00' == $post->post_date) {
                        $t_time = $h_time = __('Unpublished', 'woocommerce');
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                        $gmt_time = strtotime($post->post_date_gmt . ' UTC');
                        $time_diff = current_time('timestamp', 1) - $gmt_time;
                        $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
                    break;
                case 'customer_message':
                    if ($the_order->customer_message) {
                        echo '<span class="note-on tips" data-tip="' . esc_attr($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'billing_address':
                    if ($the_order->get_formatted_billing_address()) {
                        echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_billing_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_billing_address())) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_items':
                    printf('<a href="#" class="show_order_items">' . _n('%d item', '%d items', sizeof($the_order->get_items()), 'woocommerce') . '</a>', sizeof($the_order->get_items()));
                    if (sizeof($the_order->get_items()) > 0) {
                        echo '<table class="order_items" cellspacing="0">';
                        foreach ($the_order->get_items() as $item) {
                            $_product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item['item_meta']);
                            $item_meta_html = $item_meta->display(true, true);
                            ?>
						<tr>
							<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
							<td class="name">
								<?php 
                            if (wc_product_sku_enabled() && $_product && $_product->get_sku()) {
                                echo $_product->get_sku() . ' - ';
                            }
                            echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
                            ?>
								<?php 
                            if ($item_meta_html) {
                                ?>
									<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&ndash;';
                    }
                    break;
                case 'shipping_address':
                    if ($the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_shipping_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_shipping_address())) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->get_shipping_method()) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->get_shipping_method()) . '</small>';
                    }
                    break;
                case 'order_notes':
                    if ($post->comment_count) {
                        // check the status of the post
                        $post->post_status !== 'trash' ? $status = '' : ($status = 'post-trashed');
                        $latest_notes = get_comments(array('post_id' => $post->ID, 'number' => 1, 'status' => $status));
                        $latest_note = current($latest_notes);
                        if ($post->comment_count == 1) {
                            echo '<span class="note-on tips" data-tip="' . esc_attr($latest_note->comment_content) . '">' . __('Yes', 'woocommerce') . '</span>';
//.........这里部分代码省略.........
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:101,代码来源:class-wc-admin-cpt-shop_order.php

示例12: sizeof

if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
global $post, $product, $porto_settings;
$cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
$tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
?>
<div class="product_meta">

	<?php 
do_action('woocommerce_product_meta_start');
?>

	<?php 
if (in_array('sku', $porto_settings['product-metas']) && wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
    ?>

		<span class="sku_wrapper"><?php 
    _e('SKU:', 'woocommerce');
    ?>
 <span class="sku" itemprop="sku"><?php 
    echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce');
    ?>
</span></span>

	<?php 
}
?>

	<?php 
开发者ID:booklein,项目名称:wpbookle,代码行数:31,代码来源:meta.php

示例13: edit_columns

 /**
  * Change the columns shown in admin.
  */
 public function edit_columns($existing_columns)
 {
     if (empty($existing_columns) && !is_array($existing_columns)) {
         $existing_columns = array();
     }
     unset($existing_columns['title'], $existing_columns['comments'], $existing_columns['date']);
     $columns = array();
     $columns['cb'] = '<input type="checkbox" />';
     $columns['thumb'] = '<span class="wc-image tips" data-tip="' . __('Image', 'woocommerce') . '">' . __('Image', 'woocommerce') . '</span>';
     $columns['name'] = __('Name', 'woocommerce');
     if (wc_product_sku_enabled()) {
         $columns['sku'] = __('SKU', 'woocommerce');
     }
     if ('yes' == get_option('woocommerce_manage_stock')) {
         $columns['is_in_stock'] = __('Stock', 'woocommerce');
     }
     $columns['price'] = __('Price', 'woocommerce');
     $columns['product_cat'] = __('Categories', 'woocommerce');
     $columns['product_tag'] = __('Tags', 'woocommerce');
     $columns['featured'] = '<span class="wc-featured tips" data-tip="' . __('Featured', 'woocommerce') . '">' . __('Featured', 'woocommerce') . '</span>';
     $columns['product_type'] = '<span class="wc-type tips" data-tip="' . __('Type', 'woocommerce') . '">' . __('Type', 'woocommerce') . '</span>';
     $columns['date'] = __('Date', 'woocommerce');
     return array_merge($columns, $existing_columns);
 }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:27,代码来源:class-wc-admin-cpt-product.php

示例14: snpshpwp_woo_single_sku

        function snpshpwp_woo_single_sku()
        {
            global $product;
            if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
                ?>
<span class="sku_wrapper"><?php 
                _e('SKU:', 'woocommerce');
                ?>
 <span class="sku" itemprop="sku"><?php 
                echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce');
                ?>
</span></span><?php 
            }
        }
开发者ID:bergvogel,项目名称:stayuplate,代码行数:14,代码来源:functions.php

示例15: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $post, $thepostid;
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $thepostid = $post->ID;
        if ($terms = wp_get_object_terms($post->ID, 'product_type')) {
            $product_type = sanitize_title(current($terms)->name);
        } else {
            $product_type = apply_filters('default_product_type', 'simple');
        }
        $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate product', 'woocommerce'), 'variable' => __('Variable product', 'woocommerce')), $product_type);
        $type_box = '<label for="product-type"><select id="product-type" name="product-type"><optgroup label="' . __('Product Type', 'woocommerce') . '">';
        foreach ($product_type_selector as $value => $label) {
            $type_box .= '<option value="' . esc_attr($value) . '" ' . selected($product_type, $value, false) . '>' . esc_html($label) . '</option>';
        }
        $type_box .= '</optgroup></select></label>';
        $product_type_options = apply_filters('product_type_options', array('virtual' => array('id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Virtual products are intangible and aren\'t shipped.', 'woocommerce'), 'default' => 'no'), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce'), 'default' => 'no')));
        foreach ($product_type_options as $key => $option) {
            $selected_value = get_post_meta($post->ID, '_' . $key, true);
            if ('' == $selected_value && isset($option['default'])) {
                $selected_value = $option['default'];
            }
            $type_box .= '<label for="' . esc_attr($option['id']) . '" class="' . esc_attr($option['wrapper_class']) . ' tips" data-tip="' . esc_attr($option['description']) . '">' . esc_html($option['label']) . ': <input type="checkbox" name="' . esc_attr($option['id']) . '" id="' . esc_attr($option['id']) . '" ' . checked($selected_value, 'yes', false) . ' /></label>';
        }
        ?>
		<div class="panel-wrap product_data">

			<span class="type_box"> &mdash; <?php 
        echo $type_box;
        ?>
</span>

			<ul class="product_data_tabs wc-tabs" style="display:none;">
				<?php 
        $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_product_data', 'class' => array('hide_if_grouped')), 'inventory' => array('label' => __('Inventory', 'woocommerce'), 'target' => 'inventory_product_data', 'class' => array('show_if_simple', 'show_if_variable', 'show_if_grouped')), 'shipping' => array('label' => __('Shipping', 'woocommerce'), 'target' => 'shipping_product_data', 'class' => array('hide_if_virtual', 'hide_if_grouped', 'hide_if_external')), 'linked_product' => array('label' => __('Linked Products', 'woocommerce'), 'target' => 'linked_product_data', 'class' => array()), 'attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', 'class' => array()), 'variations' => array('label' => __('Variations', 'woocommerce'), 'target' => 'variable_product_options', 'class' => array('variations_tab', 'show_if_variable')), 'advanced' => array('label' => __('Advanced', 'woocommerce'), 'target' => 'advanced_product_data', 'class' => array())));
        foreach ($product_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        do_action('woocommerce_product_write_panel_tabs');
        ?>
			</ul>
			<div id="general_product_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group hide_if_grouped">';
        // SKU
        if (wc_product_sku_enabled()) {
            woocommerce_wp_text_input(array('id' => '_sku', 'label' => '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce')));
        } else {
            echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />';
        }
        do_action('woocommerce_product_options_sku');
        echo '</div>';
        echo '<div class="options_group show_if_external">';
        // External URL
        woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce'), 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce')));
        // Button text
        woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce'), 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce')));
        echo '</div>';
        echo '<div class="options_group pricing show_if_simple show_if_external">';
        // Price
        woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
        // Special Price
        woocommerce_wp_text_input(array('id' => '_sale_price', 'data_type' => 'price', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>'));
        // Special Price date range
        $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : '';
        $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : '';
        echo '<p class="form-field sale_price_dates_fields">
								<label for="_sale_price_dates_from">' . __('Sale Price Dates', 'woocommerce') . '</label>
								<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
								<a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a>
								<img class="help_tip" style="margin-top: 21px;" data-tip="' . __('The sale will end at the beginning of the set date.', 'woocommerce') . '" src="' . esc_url(WC()->plugin_url()) . '/assets/images/help.png" height="16" width="16" />
							</p>';
        do_action('woocommerce_product_options_pricing');
        echo '</div>';
        echo '<div class="options_group show_if_downloadable">';
        ?>
					<div class="form-field downloadable_files">
						<label><?php 
        _e('Downloadable Files', 'woocommerce');
//.........这里部分代码省略.........
开发者ID:WordCommerce,项目名称:woocommerce,代码行数:101,代码来源:class-wc-meta-box-product-data.php


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