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);
}
<?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');
Example #3
0
/**
 * 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) {
        /**
         * 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>';
                    }
                    break;
                case 'order_notes':
                    if ($post->comment_count) {
                        // check the status of the post
                        $status = 'trash' !== $post->post_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="' . wc_sanitize_tooltip($latest_note->comment_content) . '">' . __('Yes', 'woocommerce') . '</span>';
                        } elseif (isset($latest_note->comment_content)) {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($latest_note->comment_content . '<br/><small style="display:block">' . sprintf(_n('plus %d other note', 'plus %d other notes', $post->comment_count - 1, 'woocommerce'), $post->comment_count - 1) . '</small>') . '">' . __('Yes', 'woocommerce') . '</span>';
                        } else {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip(sprintf(_n('%d note', '%d notes', $post->comment_count, 'woocommerce'), $post->comment_count)) . '">' . __('Yes', 'woocommerce') . '</span>';
                        }
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_total':
                    echo $the_order->get_formatted_order_total();
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_title':
                    $customer_tip = array();
                    if ($address = $the_order->get_formatted_billing_address()) {
                        $customer_tip[] = __('Billing:', 'woocommerce') . ' ' . $address . '<br/><br/>';
                    }
                    if ($the_order->billing_phone) {
                        $customer_tip[] = __('Tel:', 'woocommerce') . ' ' . $the_order->billing_phone;
                    }
                    if ($the_order->user_id) {
                        $user_info = get_userdata($the_order->user_id);
                    }
                    if (!empty($user_info)) {
                        $username = '******' . absint($user_info->ID) . '">';
                        if ($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>';
                    } else {
                        if ($the_order->billing_first_name || $the_order->billing_last_name) {
                            $username = trim($the_order->billing_first_name . ' ' . $the_order->billing_last_name);
                        } else {
                            $username = __('Guest', 'woocommerce');
                        }
                    }
                    printf(_x('%s by %s', 'Order number by X', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '" class="row-title"><strong>#' . esc_attr($the_order->get_order_number()) . '</strong></a>', $username);
                    if ($the_order->billing_email) {
                        echo '<small class="meta email"><a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
                    }
                    echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'woocommerce') . '</span></button>';
                    break;
                case 'order_actions':
                    ?>
<p>
					<?php 
                    do_action('woocommerce_admin_order_actions_start', $the_order);
                    $actions = array();
                    if ($the_order->has_status(array('pending', 'on-hold'))) {
                        $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $post->ID), 'woocommerce-mark-order-status'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
                    }
                    if ($the_order->has_status(array('pending', 'on-hold', 'processing'))) {
                        $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $post->ID), 'woocommerce-mark-order-status'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
                    }
                    $actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
                    $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
                    foreach ($actions as $action) {
                        printf('<a class="button tips %s" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
                    }
                    do_action('woocommerce_admin_order_actions_end', $the_order);
                    ?>
				</p><?php 
                    break;
            }
        }
    /**
     * Output custom columns for subscriptions
     * @param  string $column
     */
    public function render_shop_subscription_columns($column)
    {
        global $post, $the_subscription, $wp_list_table;
        if (empty($the_subscription) || $the_subscription->id != $post->ID) {
            $the_subscription = wcs_get_subscription($post->ID);
        }
        $column_content = '';
        switch ($column) {
            case 'status':
                // The status label
                $column_content = sprintf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_subscription->get_status()), wcs_get_subscription_status_name($the_subscription->get_status()), wcs_get_subscription_status_name($the_subscription->get_status()));
                $post_type_object = get_post_type_object($post->post_type);
                $actions = array();
                $action_url = add_query_arg(array('post' => $the_subscription->id, '_wpnonce' => wp_create_nonce('bulk-posts')));
                if (isset($_REQUEST['status'])) {
                    $action_url = add_query_arg(array('status' => $_REQUEST['status']), $action_url);
                }
                $all_statuses = array('active' => __('Reactivate', 'woocommerce-subscriptions'), 'on-hold' => __('Suspend', 'woocommerce-subscriptions'), 'cancelled' => _x('Cancel', 'an action on a subscription', 'woocommerce-subscriptions'), 'trash' => __('Trash', 'woocommerce-subscriptions'), 'deleted' => __('Delete Permanently', 'woocommerce-subscriptions'));
                foreach ($all_statuses as $status => $label) {
                    if ($the_subscription->can_be_updated_to($status)) {
                        if (in_array($status, array('trash', 'deleted'))) {
                            if (current_user_can($post_type_object->cap->delete_post, $post->ID)) {
                                if ('trash' == $post->post_status) {
                                    $actions['untrash'] = '<a title="' . esc_attr(__('Restore this item from the Trash', 'woocommerce-subscriptions')) . '" href="' . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . '">' . __('Restore', 'woocommerce-subscriptions') . '</a>';
                                } elseif (EMPTY_TRASH_DAYS) {
                                    $actions['trash'] = '<a class="submitdelete" title="' . esc_attr(__('Move this item to the Trash', 'woocommerce-subscriptions')) . '" href="' . get_delete_post_link($post->ID) . '">' . __('Trash', 'woocommerce-subscriptions') . '</a>';
                                }
                                if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
                                    $actions['delete'] = '<a class="submitdelete" title="' . esc_attr(__('Delete this item permanently', 'woocommerce-subscriptions')) . '" href="' . get_delete_post_link($post->ID, '', true) . '">' . __('Delete Permanently', 'woocommerce-subscriptions') . '</a>';
                                }
                            }
                        } else {
                            if ('pending-cancel' === $the_subscription->get_status()) {
                                $label = __('Cancel Now', 'woocommerce-subscriptions');
                            }
                            $actions[$status] = sprintf('<a href="%s">%s</a>', add_query_arg('action', $status, $action_url), $label);
                        }
                    }
                }
                if ('pending' === $the_subscription->get_status()) {
                    unset($actions['active']);
                    unset($actions['trash']);
                } elseif (!in_array($the_subscription->get_status(), array('cancelled', 'pending-cancel', 'expired', 'switched', 'suspended'))) {
                    unset($actions['trash']);
                }
                $actions = apply_filters('woocommerce_subscription_list_table_actions', $actions, $the_subscription);
                $column_content .= $wp_list_table->row_actions($actions);
                $column_content = apply_filters('woocommerce_subscription_list_table_column_status_content', $column_content, $the_subscription, $actions);
                break;
            case 'order_title':
                $customer_tip = '';
                if ($address = $the_subscription->get_formatted_billing_address()) {
                    $customer_tip .= _x('Billing:', 'meaning billing address', 'woocommerce-subscriptions') . ' ' . esc_html($address);
                }
                if ($the_subscription->billing_email) {
                    // translators: placeholder is customer's billing email
                    $customer_tip .= '<br/><br/>' . sprintf(__('Email: %s', 'woocommerce-subscriptions'), esc_attr($the_subscription->billing_email));
                }
                if ($the_subscription->billing_phone) {
                    // translators: placeholder is customer's billing phone number
                    $customer_tip .= '<br/><br/>' . sprintf(__('Tel: %s', 'woocommerce-subscriptions'), esc_html($the_subscription->billing_phone));
                }
                if (!empty($customer_tip)) {
                    echo '<div class="tips" data-tip="' . esc_attr($customer_tip) . '">';
                }
                // This is to stop PHP from complaining
                $username = '';
                if ($the_subscription->get_user_id() && false !== ($user_info = get_userdata($the_subscription->get_user_id()))) {
                    $username = '******' . 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;
                    default:
                        $column_content .= '<a href="#" class="show_order_items">' . esc_html(apply_filters('woocommerce_admin_order_item_count', sprintf(_n('%d item', '%d items', $the_subscription->get_item_count(), 'woocommerce-subscriptions'), $the_subscription->get_item_count()), $the_subscription)) . '</a>';
                        $column_content .= '<table class="order_items" cellspacing="0">';
                        foreach ($the_subscription->get_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);
                            ob_start();
                            ?>
							<tr class="<?php 
                            echo esc_attr(apply_filters('woocommerce_admin_order_item_class', '', $item));
                            ?>
">
								<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
								<td class="name">
									<?php 
                            if (wc_product_sku_enabled() && $_product && $_product->get_sku()) {
                                echo esc_html($_product->get_sku()) . ' - ';
                            }
                            echo esc_html(apply_filters('woocommerce_order_item_name', $item['name'], $item));
                            if ($item_meta_html) {
                                ?>
										<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
									<?php 
                            }
                            ?>
								</td>
							</tr>
							<?php 
                            $column_content .= ob_get_clean();
                        }
                        $column_content .= '</table>';
                        break;
                }
                break;
            case 'recurring_total':
                $column_content .= esc_html(strip_tags($the_subscription->get_formatted_order_total()));
                // translators: placeholder is the display name of a payment gateway a subscription was paid by
                $column_content .= '<small class="meta">' . esc_html(sprintf(__('Via %s', 'woocommerce-subscriptions'), $the_subscription->get_payment_method_to_display())) . '</small>';
                break;
            case 'start_date':
            case 'trial_end_date':
            case 'next_payment_date':
            case 'last_payment_date':
            case 'end_date':
                if (0 == $the_subscription->get_time($column, 'gmt')) {
                    $column_content .= '-';
                } else {
                    $column_content .= sprintf('<time class="%s" title="%s">%s</time>', esc_attr($column), esc_attr(date(__('Y/m/d g:i:s A', 'woocommerce-subscriptions'), $the_subscription->get_time($column, 'site'))), esc_html($the_subscription->get_date_to_display($column)));
                    if ('next_payment_date' == $column && $the_subscription->payment_method_supports('gateway_scheduled_payments') && !$the_subscription->is_manual() && $the_subscription->has_status('active')) {
                        $column_content .= '<div class="woocommerce-help-tip" data-tip="' . esc_attr__('This date should be treated as an estimate only. The payment gateway for this subscription controls when payments are processed.', 'woocommerce-subscriptions') . '"></div>';
                    }
                }
                $column_content = $column_content;
                break;
            case 'orders':
                $column_content .= $this->get_related_orders_link($the_subscription);
                break;
        }
        echo wp_kses(apply_filters('woocommerce_subscription_list_table_column_content', $column_content, $the_subscription, $column), array('a' => array('class' => array(), 'href' => array(), 'data-tip' => array(), 'title' => array()), 'time' => array('class' => array(), 'title' => array()), 'mark' => array('class' => array(), 'data-tip' => array()), 'small' => array('class' => array()), 'table' => array('class' => array(), 'cellspacing' => array(), 'cellpadding' => array()), 'tr' => array('class' => array()), 'td' => array('class' => array()), 'div' => array('class' => array(), 'data-tip' => array()), 'br' => array(), 'strong' => array(), 'span' => array('class' => array()), 'p' => array('class' => array()), 'button' => array('type' => array(), 'class' => array())));
    }
Example #6
0
        function wr_ferado_product_slider($atts, $content = null)
        {
            $limit = $orderby = $order = $single = $class = $effect_output = '';
            extract(shortcode_atts(array('limit' => '10', 'orderby' => 'date', 'order' => 'desc', 'pagination' => 'false', 'navigation' => 'false', 'item' => 6, 'single' => 'false', 'cat' => '', 'title' => '', 'full' => '', 'effect' => ''), $atts));
            global $product, $woocommerce_loop, $post;
            // The meta query for the page
            $meta_query = WC()->query->get_meta_query();
            // Generate random id
            $length = 10;
            $id = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
            // Filter product post type
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => $orderby, 'order' => $order, 'meta_query' => $meta_query, 'posts_per_page' => $limit);
            if (!empty($cat)) {
                $args['tax_query'] = array('relation' => 'AND', array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(',', $cat)));
            }
            if ($effect) {
                $effect_output = '
					beforeMove: updateCarousel,
					afterInit: function() {
						setTimeout(updateCarousel, 100)
					}';
            }
            ob_start();
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
            echo '
				<scr' . 'ipt>
					(function($) {
						"use strict";
						$(document).ready(function() {
							var owl = $("#' . $id . '");
							owl.owlCarousel({
								navigation: ' . $navigation . ',
								navigationText: [
									"<i class=\\"dashicons dashicons-arrow-left-alt2\\"></i>",
									"<i class=\\"dashicons dashicons-arrow-right-alt2\\"></i>",
								],
								pagination: ' . $pagination . ',
								singleItem: ' . $single . ',
								items: ' . $item . ',
								itemsMobile : [540,1],
								itemsTablet : [768,2],
								itemsDesktopSmall : [1366,4],
								itemsDesktop: [1920,6],
								slideSpeed : 600,
								' . $effect_output . '
							});
							function updateCarousel() {
								var start = data.currentItem;
								var count = data.options.items;

								if ( window.innerWidth < 1921 ) {
									var endStart = start+count-1;
									var first2 = owl.find(".owl-item").slice(start,start+1);
									var last2 = owl.find(".owl-item").slice(endStart, endStart+1);
								} else {
									var endStart = start+count-2;
									var first2 = owl.find(".owl-item").slice(start,start+2);
									var last2 = owl.find(".owl-item").slice(endStart, endStart+2);
								}

								owl.find(".owl-item").removeClass("blur");
								first2.addClass("blur");
								last2.addClass("blur");

							}
							var data = owl.data("owlCarousel");
						});
					})(jQuery);
				</scr' . 'ipt>';
            if ('true' == $single) {
                $class .= 'single-gal';
            }
            if ('true' != $single && $title) {
                echo '<div class="h-slider"><h4 class="slider-title">' . $title . '</h4></div>';
            }
            // Begin the loop
            if ($products->have_posts()) {
                if (function_exists('woocommerce_product_loop_start')) {
                    woocommerce_product_loop_start();
                }
                ?>
				<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>';
        }
 /**
  * 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);
 }
function bf_wc_variations_custom($thepostid, $customfield)
{
    global $variation_data, $post;
    $post = get_post($thepostid);
    $variation_data = new WC_Product_Variation($post);
    $variation_data->get_variation_attributes();
    $variation_data = (array) $variation_data;
    echo '<pre>';
    print_r($variation_data);
    echo '</pre>';
    extract($variation_data);
    ?>
    <div class="woocommerce_variation wc-metabox closed">
        <h3>
            <a href="#" class="remove_variation delete" rel="<?php 
    echo esc_attr($variation_id);
    ?>
"><?php 
    _e('Remove', 'woocommerce');
    ?>
</a>
            <div class="handlediv" title="<?php 
    esc_attr_e('Click to toggle', 'woocommerce');
    ?>
"></div>
            <div class="tips sort" data-tip="<?php 
    esc_attr_e('Drag and drop, or click to set menu order manually', 'woocommerce');
    ?>
"></div>
            <strong>#<?php 
    echo esc_html($variation_id);
    ?>
: </strong>
            <?php 
    if (isset($parent_data)) {
        foreach ($parent_data['attributes'] as $attribute) {
            // Only deal with attributes that are variations
            if (!$attribute['is_variation']) {
                continue;
            }
            // Get current value for variation (if set)
            $variation_selected_value = isset($variation_data['attribute_' . sanitize_title($attribute['name'])]) ? $variation_data['attribute_' . sanitize_title($attribute['name'])] : '';
            // Name will be something like attribute_pa_color
            echo '<select name="attribute_' . sanitize_title($attribute['name']) . '[' . $loop . ']"><option value="">' . __('Any', 'woocommerce') . ' ' . esc_html(wc_attribute_label($attribute['name'])) . '&hellip;</option>';
            // Get terms for attribute taxonomy or value if its a custom attribute
            if ($attribute['is_taxonomy']) {
                $post_terms = wp_get_post_terms($parent_data['id'], $attribute['name']);
                foreach ($post_terms as $term) {
                    echo '<option ' . selected($variation_selected_value, $term->slug, false) . ' value="' . esc_attr($term->slug) . '">' . apply_filters('woocommerce_variation_option_name', esc_html($term->name)) . '</option>';
                }
            } else {
                $options = wc_get_text_attributes($attribute['value']);
                foreach ($options as $option) {
                    $selected = sanitize_title($variation_selected_value) === $variation_selected_value ? selected($variation_selected_value, sanitize_title($option), false) : selected($variation_selected_value, $option, false);
                    echo '<option ' . $selected . ' value="' . esc_attr($option) . '">' . esc_html(apply_filters('woocommerce_variation_option_name', $option)) . '</option>';
                }
            }
            echo '</select>';
        }
    }
    ?>
            <input type="hidden" name="variable_post_id[<?php 
    echo $loop;
    ?>
]" value="<?php 
    echo esc_attr($variation_id);
    ?>
" />
            <input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php 
    echo $loop;
    ?>
]" value="<?php 
    echo absint($menu_order);
    ?>
" />
        </h3>
        <div class="woocommerce_variable_attributes wc-metabox-content" style="display: none;">
            <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);
        }
        ?>
" />
                <?php 
    }
    ?>

                <p class="form-row form-row-full options">
                    <label><input type="checkbox" class="checkbox" name="variable_enabled[<?php 
    echo $loop;
    ?>
]" <?php 
    checked($variation->post_status, 'publish');
    ?>
 /> <?php 
    _e('Enabled', 'woocommerce');
    ?>
</label>

                    <label><input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php 
    echo $loop;
    ?>
]" <?php 
    checked(isset($_downloadable) ? $_downloadable : '', 'yes');
    ?>
 /> <?php 
    _e('Downloadable', 'woocommerce');
    ?>
 <a class="tips" data-tip="<?php 
    esc_attr_e('Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce');
    ?>
" href="#">[?]</a></label>

                    <label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php 
    echo $loop;
    ?>
]" <?php 
    checked(isset($_virtual) ? $_virtual : '', 'yes');
    ?>
 /> <?php 
    _e('Virtual', 'woocommerce');
    ?>
 <a class="tips" data-tip="<?php 
    esc_attr_e('Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce');
    ?>
" href="#">[?]</a></label>

                    <?php 
    if (get_option('woocommerce_manage_stock') == 'yes') {
        ?>

                        <label><input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php 
        echo $loop;
        ?>
]" <?php 
        checked(isset($_manage_stock) ? $_manage_stock : '', 'yes');
        ?>
 /> <?php 
        _e('Manage stock?', 'woocommerce');
        ?>
 <a class="tips" data-tip="<?php 
        esc_attr_e('Enable this option to enable stock management at variation level', 'woocommerce');
        ?>
" href="#">[?]</a></label>

                    <?php 
    }
    ?>

                    <?php 
    do_action('woocommerce_variation_options', $loop, $variation_data, $variation);
    ?>
                </p>

                <div class="variable_pricing">
                    <p class="form-row form-row-first">
                        <label><?php 
    echo __('Regular Price:', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')';
    ?>
</label>
                        <input type="text" size="5" name="variable_regular_price[<?php 
    echo $loop;
    ?>
]" value="<?php 
    if (isset($_regular_price)) {
        echo esc_attr($_regular_price);
    }
    ?>
" class="wc_input_price" placeholder="<?php 
    esc_attr_e('Variation price (required)', 'woocommerce');
    ?>
" />
                    </p>
                    <p class="form-row form-row-last">
                        <label><?php 
    echo __('Sale Price:', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')';
    ?>
 <a href="#" class="sale_schedule"><?php 
    _e('Schedule', 'woocommerce');
    ?>
</a><a href="#" class="cancel_sale_schedule" style="display:none"><?php 
    _e('Cancel schedule', 'woocommerce');
    ?>
</a></label>
                        <input type="text" size="5" name="variable_sale_price[<?php 
    echo $loop;
    ?>
]" value="<?php 
    if (isset($_sale_price)) {
        echo esc_attr($_sale_price);
    }
    ?>
" class="wc_input_price" />
                    </p>

                    <div class="sale_price_dates_fields" style="display: none">
                        <p class="form-row form-row-first">
                            <label><?php 
    _e('Sale start date:', 'woocommerce');
    ?>
</label>
                            <input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[<?php 
    echo $loop;
    ?>
]" value="<?php 
    echo !empty($_sale_price_dates_from) ? date_i18n('Y-m-d', $_sale_price_dates_from) : '';
    ?>
" placeholder="<?php 
    echo esc_attr_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])" />
                        </p>
                        <p class="form-row form-row-last">
                            <label><?php 
    _e('Sale end date:', 'woocommerce');
    ?>
</label>
                            <input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[<?php 
    echo $loop;
    ?>
]" value="<?php 
    echo !empty($_sale_price_dates_to) ? date_i18n('Y-m-d', $_sale_price_dates_to) : '';
    ?>
" placeholder="<?php 
    echo esc_attr_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])" />
                        </p>
                    </div>
                </div>

                <?php 
    if ('yes' == get_option('woocommerce_manage_stock')) {
        ?>
                    <div class="show_if_variation_manage_stock" style="display: none;">
                        <p class="form-row form-row-first">
                            <label><?php 
        _e('Stock Qty:', 'woocommerce');
        ?>
 <a class="tips" data-tip="<?php 
        esc_attr_e('Enter a quantity to enable stock management at variation level, or leave blank to use the parent product\'s options.', 'woocommerce');
        ?>
" href="#">[?]</a></label>
                            <input type="number" size="5" name="variable_stock[<?php 
        echo $loop;
        ?>
]" value="<?php 
        if (isset($_stock)) {
            echo esc_attr(wc_stock_amount($_stock));
        }
        ?>
" step="any" />
                        </p>
                        <p class="form-row form-row-last">
                            <label><?php 
        _e('Allow Backorders?', 'woocommerce');
        ?>
</label>
                            <select name="variable_backorders[<?php 
        echo $loop;
        ?>
]">
                                <?php 
        foreach ($parent_data['backorder_options'] as $key => $value) {
            echo '<option value="' . esc_attr($key) . '" ' . selected($key === $_backorders, true, false) . '>' . esc_html($value) . '</option>';
        }
        ?>
                            </select>
                        </p>
                    </div>
                <?php 
    }
    ?>

                <div class="">
                    <p class="form-row form-row-full">
                        <label><?php 
    _e('Stock status', 'woocommerce');
    ?>
 <a class="tips" data-tip="<?php 
    esc_attr_e('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce');
    ?>
" href="#">[?]</a></label>
                        <select name="variable_stock_status[<?php 
    echo $loop;
    ?>
]">
                            <?php 
    foreach ($parent_data['stock_status_options'] as $key => $value) {
        echo '<option value="' . esc_attr($key === $_stock_status ? '' : $key) . '" ' . selected($key === $_stock_status, true, false) . '>' . esc_html($value) . '</option>';
    }
    ?>
                        </select>
                    </p>
                </div>

                <?php 
    if (wc_product_weight_enabled() || wc_product_dimensions_enabled()) {
        ?>
                    <div>
                        <?php 
        if (wc_product_weight_enabled()) {
            ?>
                            <p class="form-row hide_if_variation_virtual form-row-first">
                                <label><?php 
            echo __('Weight', 'woocommerce') . ' (' . esc_html(get_option('woocommerce_weight_unit')) . '):';
            ?>
 <a class="tips" data-tip="<?php 
            esc_attr_e('Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce');
            ?>
" href="#">[?]</a></label>
                                <input type="text" size="5" name="variable_weight[<?php 
            echo $loop;
            ?>
]" value="<?php 
            if (isset($_weight)) {
                echo esc_attr($_weight);
            }
            ?>
" placeholder="<?php 
            echo esc_attr($parent_data['weight']);
            ?>
" class="wc_input_decimal" />
                            </p>
                        <?php 
        } else {
            ?>
                            <p>&nbsp;</p>
                        <?php 
        }
        ?>
                        <?php 
        if (wc_product_dimensions_enabled()) {
            ?>
                            <p class="form-row dimensions_field hide_if_variation_virtual form-row-last">
                                <label for="product_length"><?php 
            echo __('Dimensions (L&times;W&times;H)', 'woocommerce') . ' (' . esc_html(get_option('woocommerce_dimension_unit')) . '):';
            ?>
</label>
                                <input id="product_length" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php 
            echo $loop;
            ?>
]" value="<?php 
            if (isset($_length)) {
                echo esc_attr($_length);
            }
            ?>
" placeholder="<?php 
            echo esc_attr($parent_data['length']);
            ?>
" />
                                <input class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php 
            echo $loop;
            ?>
]" value="<?php 
            if (isset($_width)) {
                echo esc_attr($_width);
            }
            ?>
" placeholder="<?php 
            echo esc_attr($parent_data['width']);
            ?>
" />
                                <input class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php 
            echo $loop;
            ?>
]" value="<?php 
            if (isset($_height)) {
                echo esc_attr($_height);
            }
            ?>
" placeholder="<?php 
            echo esc_attr($parent_data['height']);
            ?>
" />
                            </p>
                        <?php 
        } else {
            ?>
                            <p>&nbsp;</p>
                        <?php 
        }
        ?>
                    </div>
                <?php 
    }
    ?>
                <div>
                    <p class="form-row hide_if_variation_virtual form-row-full"><label><?php 
    _e('Shipping class:', 'woocommerce');
    ?>
</label> <?php 
    $args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('Same as parent', 'woocommerce'), 'name' => 'variable_shipping_class[' . $loop . ']', 'id' => '', 'selected' => isset($shipping_class) ? esc_attr($shipping_class) : '', 'echo' => 0);
    echo wp_dropdown_categories($args);
    ?>
</p>

                    <?php 
    if (wc_tax_enabled()) {
        ?>
                        <p class="form-row form-row-full">
                            <label><?php 
        _e('Tax class:', 'woocommerce');
        ?>
</label>
                            <select name="variable_tax_class[<?php 
        echo $loop;
        ?>
]">
                                <option value="parent" <?php 
        selected(is_null($_tax_class), true);
        ?>
><?php 
        _e('Same as parent', 'woocommerce');
        ?>
</option>
                                <?php 
        foreach ($parent_data['tax_class_options'] as $key => $value) {
            echo '<option value="' . esc_attr($key) . '" ' . selected($key === $_tax_class, true, false) . '>' . esc_html($value) . '</option>';
        }
        ?>
</select>
                        </p>
                    <?php 
    }
    ?>

                    <p class="form-row form-row-full">
                        <label><?php 
    _e('Variation Description:', 'woocommerce');
    ?>
</label>
                        <textarea name="variable_description[<?php 
    echo $loop;
    ?>
]" rows="3" style="width:100%;"><?php 
    echo isset($variation_data['_variation_description']) ? esc_textarea($variation_data['_variation_description']) : '';
    ?>
</textarea>
                    </p>
                </div>
                <div class="show_if_variation_downloadable" style="display: none;">
                    <div class="form-row form-row-full downloadable_files">
                        <label><?php 
    _e('Downloadable Files', 'woocommerce');
    ?>
:</label>
                        <table class="widefat">
                            <thead>
                            <div>
                                <th><?php 
    _e('Name', 'woocommerce');
    ?>
 <span class="tips" data-tip="<?php 
    esc_attr_e('This is the name of the download shown to the customer.', 'woocommerce');
    ?>
">[?]</span></th>
                                <th colspan="2"><?php 
    _e('File URL', 'woocommerce');
    ?>
 <span class="tips" data-tip="<?php 
    esc_attr_e('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce');
    ?>
">[?]</span></th>
                                <th>&nbsp;</th>
                            </div>
                            </thead>
                            <tbody>
                            <?php 
    if ($_downloadable_files) {
        foreach ($_downloadable_files as $key => $file) {
            if (!is_array($file)) {
                $file = array('file' => $file, 'name' => '');
            }
            include 'html-product-variation-download.php';
        }
    }
    ?>
                            </tbody>
                            <tfoot>
                            <div>
                                <th colspan="4">
                                    <a href="#" class="button insert" data-row="<?php 
    $file = array('file' => '', 'name' => '');
    ob_start();
    include 'html-product-variation-download.php';
    echo esc_attr(ob_get_clean());
    ?>
"><?php 
    _e('Add File', 'woocommerce');
    ?>
</a>
                                </th>
                            </div>
                            </tfoot>
                        </table>
                    </div>
                </div>
                <div class="show_if_variation_downloadable" style="display: none;">
                    <p class="form-row form-row-first">
                        <label><?php 
    _e('Download Limit:', 'woocommerce');
    ?>
 <a class="tips" data-tip="<?php 
    esc_attr_e('Leave blank for unlimited re-downloads.', 'woocommerce');
    ?>
" href="#">[?]</a></label>
                        <input type="number" size="5" name="variable_download_limit[<?php 
    echo $loop;
    ?>
]" value="<?php 
    if (isset($_download_limit)) {
        echo esc_attr($_download_limit);
    }
    ?>
" placeholder="<?php 
    esc_attr_e('Unlimited', 'woocommerce');
    ?>
" step="1" min="0" />
                    </p>
                    <p class="form-row form-row-last">
                        <label><?php 
    _e('Download Expiry:', 'woocommerce');
    ?>
 <a class="tips" data-tip="<?php 
    esc_attr_e('Enter the number of days before a download link expires, or leave blank.', 'woocommerce');
    ?>
" href="#">[?]</a></label>
                        <input type="number" size="5" name="variable_download_expiry[<?php 
    echo $loop;
    ?>
]" value="<?php 
    if (isset($_download_expiry)) {
        echo esc_attr($_download_expiry);
    }
    ?>
" placeholder="<?php 
    esc_attr_e('Unlimited', 'woocommerce');
    ?>
" step="1" min="0" />
                    </p>
                </div>
                <?php 
    do_action('woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation);
    ?>
            </div>
        </div>
    </div>

    <?php 
}
    /**
     * 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 
        _e('Downloadable Files', 'woocommerce');
        ?>
:</label>
						<table class="widefat">
							<thead>
								<tr>
									<th class="sort">&nbsp;</th>
									<th><?php 
        _e('Name', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the name of the download shown to the customer.', 'woocommerce');
        ?>
">[?]</span></th>
									<th colspan="2"><?php 
        _e('File URL', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the URL or absolute path to the file which customers will get access to.', 'woocommerce');
        ?>
">[?]</span></th>
									<th>&nbsp;</th>
								</tr>
							</thead>
							<tfoot>
								<tr>
									<th colspan="5">
										<a href="#" class="button insert" data-row="<?php 
        $file = array('file' => '', 'name' => '');
        ob_start();
        include 'views/html-product-download.php';
        echo esc_attr(ob_get_clean());
        ?>
"><?php 
        _e('Add File', 'woocommerce');
        ?>
</a>
									</th>
								</tr>
							</tfoot>
							<tbody>
								<?php 
        $downloadable_files = get_post_meta($post->ID, '_downloadable_files', true);
        if ($downloadable_files) {
            foreach ($downloadable_files as $key => $file) {
                include 'views/html-product-download.php';
            }
        }
        ?>
							</tbody>
						</table>
					</div>
					<?php 
        // Download Limit
        woocommerce_wp_text_input(array('id' => '_download_limit', 'label' => __('Download Limit', 'woocommerce'), 'placeholder' => __('Unlimited', 'woocommerce'), 'description' => __('Leave blank for unlimited re-downloads.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Expirey
        woocommerce_wp_text_input(array('id' => '_download_expiry', 'label' => __('Download Expiry', 'woocommerce'), 'placeholder' => __('Never', 'woocommerce'), 'description' => __('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Download Type
        woocommerce_wp_select(array('id' => '_download_type', 'label' => __('Download Type', 'woocommerce'), 'description' => sprintf(__('Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce'), 'http://schema.org/'), 'options' => array('' => __('Standard Product', 'woocommerce'), 'application' => __('Application/Software', 'woocommerce'), 'music' => __('Music', 'woocommerce'))));
        do_action('woocommerce_product_options_downloads');
        echo '</div>';
        if (get_option('woocommerce_calc_taxes') == 'yes') {
            echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
            // Tax
            woocommerce_wp_select(array('id' => '_tax_status', 'label' => __('Tax Status', 'woocommerce'), 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'shipping' => __('Shipping only', 'woocommerce'), 'none' => _x('None', 'Tax status', 'woocommerce'))));
            $tax_classes = array_filter(array_map('trim', explode("\n", get_option('woocommerce_tax_classes'))));
            $classes_options = array();
            $classes_options[''] = __('Standard', 'woocommerce');
            if ($tax_classes) {
                foreach ($tax_classes as $class) {
                    $classes_options[sanitize_title($class)] = esc_html($class);
                }
            }
            woocommerce_wp_select(array('id' => '_tax_class', 'label' => __('Tax Class', 'woocommerce'), 'options' => $classes_options));
            do_action('woocommerce_product_options_tax');
            echo '</div>';
        }
        do_action('woocommerce_product_options_general_product_data');
        ?>
			</div>

			<div id="inventory_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        if (get_option('woocommerce_manage_stock') == 'yes') {
            // manage stock
            woocommerce_wp_checkbox(array('id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce'), 'description' => __('Enable stock management at product level (not needed if managing stock at variation level)', 'woocommerce')));
            do_action('woocommerce_product_options_stock');
            echo '<div class="stock_fields show_if_simple show_if_variable">';
            // Stock
            woocommerce_wp_text_input(array('id' => '_stock', 'label' => __('Stock Qty', 'woocommerce'), 'desc_tip' => true, 'description' => __('Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any')));
            do_action('woocommerce_product_options_stock_fields');
            echo '</div>';
        }
        // Stock status
        woocommerce_wp_select(array('id' => '_stock_status', 'label' => __('Stock status', 'woocommerce'), 'options' => array('instock' => __('In stock', 'woocommerce'), 'outofstock' => __('Out of stock', 'woocommerce')), 'desc_tip' => true, 'description' => __('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce')));
        if (get_option('woocommerce_manage_stock') == 'yes') {
            echo '<div class="show_if_simple show_if_variable">';
            // Backorders?
            woocommerce_wp_select(array('id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array('no' => __('Do not allow', 'woocommerce'), 'notify' => __('Allow, but notify customer', 'woocommerce'), 'yes' => __('Allow', 'woocommerce')), 'desc_tip' => true, 'description' => __('If managing stock, this controls whether or not backorders are allowed for this product and variations. If enabled, stock quantity can go below 0.', 'woocommerce')));
            echo '</div>';
        }
        do_action('woocommerce_product_options_stock_status');
        echo '</div>';
        echo '<div class="options_group show_if_simple show_if_variable">';
        // Individual product
        woocommerce_wp_checkbox(array('id' => '_sold_individually', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce')));
        do_action('woocommerce_product_options_sold_individually');
        echo '</div>';
        do_action('woocommerce_product_options_inventory_product_data');
        ?>

			</div>

			<div id="shipping_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        // Weight
        if (wc_product_weight_enabled()) {
            woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => wc_format_localized_decimal(0), 'desc_tip' => 'true', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'text', 'data_type' => 'decimal'));
        }
        // Size fields
        if (wc_product_dimensions_enabled()) {
            ?>
<p class="form-field dimensions_field">
							<label for="product_length"><?php 
            echo __('Dimensions', 'woocommerce') . ' (' . get_option('woocommerce_dimension_unit') . ')';
            ?>
</label>
							<span class="wrap">
								<input id="product_length" placeholder="<?php 
            _e('Length', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_length" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_length', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Width', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_width" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_width', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Height', 'woocommerce');
            ?>
" class="input-text wc_input_decimal last" size="6" type="text" name="_height" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_height', true)));
            ?>
" />
							</span>
							<img class="help_tip" data-tip="<?php 
            esc_attr_e('LxWxH in decimal form', 'woocommerce');
            ?>
" src="<?php 
            echo esc_url(WC()->plugin_url());
            ?>
/assets/images/help.png" height="16" width="16" />
						</p><?php 
        }
        do_action('woocommerce_product_options_dimensions');
        echo '</div>';
        echo '<div class="options_group">';
        // Shipping Class
        $classes = get_the_terms($thepostid, 'product_shipping_class');
        if ($classes && !is_wp_error($classes)) {
            $current_shipping_class = current($classes)->term_id;
        } else {
            $current_shipping_class = '';
        }
        $args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('No shipping class', 'woocommerce'), 'name' => 'product_shipping_class', 'id' => 'product_shipping_class', 'selected' => $current_shipping_class, 'class' => 'select short');
        ?>
<p class="form-field dimensions_field"><label for="product_shipping_class"><?php 
        _e('Shipping class', 'woocommerce');
        ?>
</label> <?php 
        wp_dropdown_categories($args);
        ?>
 <img class="help_tip" data-tip="<?php 
        esc_attr_e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce');
        ?>
" src="<?php 
        echo esc_url(WC()->plugin_url());
        ?>
/assets/images/help.png" height="16" width="16" /></p><?php 
        do_action('woocommerce_product_options_shipping');
        echo '</div>';
        ?>

			</div>

			<div id="product_attributes" class="panel wc-metaboxes-wrapper">

				<p class="toolbar">
					<a href="#" class="close_all"><?php 
        _e('Close all', 'woocommerce');
        ?>
</a><a href="#" class="expand_all"><?php 
        _e('Expand all', 'woocommerce');
        ?>
</a>
				</p>

				<div class="product_attributes wc-metaboxes">

					<?php 
        // Array of defined attribute taxonomies
        $attribute_taxonomies = wc_get_attribute_taxonomies();
        // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set
        $attributes = maybe_unserialize(get_post_meta($thepostid, '_product_attributes', true));
        $i = -1;
        // Taxonomies
        if ($attribute_taxonomies) {
            foreach ($attribute_taxonomies as $tax) {
                // Get name of taxonomy we're now outputting (pa_xxx)
                $attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name);
                // Ensure it exists
                if (!taxonomy_exists($attribute_taxonomy_name)) {
                    continue;
                }
                $i++;
                // Get product data values for current taxonomy - this contains ordering and visibility data
                if (isset($attributes[sanitize_title($attribute_taxonomy_name)])) {
                    $attribute = $attributes[sanitize_title($attribute_taxonomy_name)];
                }
                $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
                // Get terms of this taxonomy associated with current product
                $post_terms = wp_get_post_terms($thepostid, $attribute_taxonomy_name);
                // Any set?
                $has_terms = is_wp_error($post_terms) || !$post_terms || sizeof($post_terms) == 0 ? 0 : 1;
                ?>
					    		<div class="woocommerce_attribute wc-metabox closed taxonomy <?php 
                echo $attribute_taxonomy_name;
                ?>
" rel="<?php 
                echo $position;
                ?>
" <?php 
                if (!$has_terms) {
                    echo 'style="display:none"';
                }
                ?>
>
									<h3>
										<button type="button" class="remove_row button"><?php 
                _e('Remove', 'woocommerce');
                ?>
</button>
										<div class="handlediv" title="<?php 
                _e('Click to toggle', 'woocommerce');
                ?>
"></div>
										<strong class="attribute_name"><?php 
                echo apply_filters('woocommerce_attribute_label', $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name, $tax->attribute_name);
                ?>
</strong>
									</h3>
									<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content">
										<tbody>
											<tr>
												<td class="attribute_name">
													<label><?php 
                _e('Name', 'woocommerce');
                ?>
:</label>
													<strong><?php 
                echo $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
                ?>
</strong>

													<input type="hidden" name="attribute_names[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo esc_attr($attribute_taxonomy_name);
                ?>
" />
													<input type="hidden" name="attribute_position[<?php 
                echo $i;
                ?>
]" class="attribute_position" value="<?php 
                echo esc_attr($position);
                ?>
" />
													<input type="hidden" name="attribute_is_taxonomy[<?php 
                echo $i;
                ?>
]" value="1" />
												</td>
												<td rowspan="3">
													<label><?php 
                _e('Value(s)', 'woocommerce');
                ?>
:</label>
													<?php 
                if ($tax->attribute_type == "select") {
                    ?>
														<select multiple="multiple" data-placeholder="<?php 
                    _e('Select terms', 'woocommerce');
                    ?>
" class="multiselect attribute_values" name="attribute_values[<?php 
                    echo $i;
                    ?>
][]">
															<?php 
                    $all_terms = get_terms($attribute_taxonomy_name, 'orderby=name&hide_empty=0');
                    if ($all_terms) {
                        foreach ($all_terms as $term) {
                            $has_term = has_term((int) $term->term_id, $attribute_taxonomy_name, $thepostid) ? 1 : 0;
                            echo '<option value="' . esc_attr($term->slug) . '" ' . selected($has_term, 1, false) . '>' . $term->name . '</option>';
                        }
                    }
                    ?>
														</select>

														<button class="button plus select_all_attributes"><?php 
                    _e('Select all', 'woocommerce');
                    ?>
</button> <button class="button minus select_no_attributes"><?php 
                    _e('Select none', 'woocommerce');
                    ?>
</button>

														<button class="button fr plus add_new_attribute" data-attribute="<?php 
                    echo $attribute_taxonomy_name;
                    ?>
"><?php 
                    _e('Add new', 'woocommerce');
                    ?>
</button>

													<?php 
                } elseif ($tax->attribute_type == "text") {
                    ?>
														<input type="text" name="attribute_values[<?php 
                    echo $i;
                    ?>
]" value="<?php 
                    // Text attributes should list terms pipe separated
                    if ($post_terms) {
                        $values = array();
                        foreach ($post_terms as $term) {
                            $values[] = $term->name;
                        }
                        echo esc_attr(implode(' ' . WC_DELIMITER . ' ', $values));
                    }
                    ?>
" placeholder="<?php 
                    _e('Pipe (|) separate terms', 'woocommerce');
                    ?>
" />
													<?php 
                }
                ?>
													<?php 
                do_action('woocommerce_product_option_terms', $tax, $i);
                ?>
												</td>
											</tr>
											<tr>
												<td>
													<label><input type="checkbox" class="checkbox" <?php 
                if (isset($attribute['is_visible'])) {
                    checked($attribute['is_visible'], 1);
                } else {
                    checked(apply_filters('default_attribute_visibility', false, $tax), true);
                }
                ?>
 name="attribute_visibility[<?php 
                echo $i;
                ?>
]" value="1" /> <?php 
                _e('Visible on the product page', 'woocommerce');
                ?>
</label>
												</td>
											</tr>
											<tr>
												<td>
													<div class="enable_variation show_if_variable">
													<label><input type="checkbox" class="checkbox" <?php 
                if (isset($attribute['is_variation'])) {
                    checked($attribute['is_variation'], 1);
                } else {
                    checked(apply_filters('default_attribute_variation', false, $tax), true);
                }
                ?>
 name="attribute_variation[<?php 
                echo $i;
                ?>
]" value="1" /> <?php 
                _e('Used for variations', 'woocommerce');
                ?>
</label>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
					    		<?php 
            }
        }
        // Custom Attributes
        if (!empty($attributes)) {
            foreach ($attributes as $attribute) {
                if ($attribute['is_taxonomy']) {
                    continue;
                }
                $i++;
                $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
                ?>
				    		<div class="woocommerce_attribute wc-metabox closed" rel="<?php 
                echo $position;
                ?>
">
								<h3>
									<button type="button" class="remove_row button"><?php 
                _e('Remove', 'woocommerce');
                ?>
</button>
									<div class="handlediv" title="<?php 
                _e('Click to toggle', 'woocommerce');
                ?>
"></div>
									<strong class="attribute_name"><?php 
                echo apply_filters('woocommerce_attribute_label', esc_html($attribute['name']), esc_html($attribute['name']));
                ?>
</strong>
								</h3>
								<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content">
									<tbody>
										<tr>
											<td class="attribute_name">
												<label><?php 
                _e('Name', 'woocommerce');
                ?>
:</label>
												<input type="text" class="attribute_name" name="attribute_names[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo esc_attr($attribute['name']);
                ?>
" />
												<input type="hidden" name="attribute_position[<?php 
                echo $i;
                ?>
]" class="attribute_position" value="<?php 
                echo esc_attr($position);
                ?>
" />
												<input type="hidden" name="attribute_is_taxonomy[<?php 
                echo $i;
                ?>
]" value="0" />
											</td>
											<td rowspan="3">
												<label><?php 
                _e('Value(s)', 'woocommerce');
                ?>
:</label>
												<textarea name="attribute_values[<?php 
                echo $i;
                ?>
]" cols="5" rows="5" placeholder="<?php 
                _e('Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce');
                ?>
"><?php 
                echo esc_textarea($attribute['value']);
                ?>
</textarea>
											</td>
										</tr>
										<tr>
											<td>
												<label><input type="checkbox" class="checkbox" <?php 
                checked($attribute['is_visible'], 1);
                ?>
 name="attribute_visibility[<?php 
                echo $i;
                ?>
]" value="1" /> <?php 
                _e('Visible on the product page', 'woocommerce');
                ?>
</label>
											</td>
										</tr>
										<tr>
											<td>
												<div class="enable_variation show_if_variable">
												<label><input type="checkbox" class="checkbox" <?php 
                checked($attribute['is_variation'], 1);
                ?>
 name="attribute_variation[<?php 
                echo $i;
                ?>
]" value="1" /> <?php 
                _e('Used for variations', 'woocommerce');
                ?>
</label>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
							<?php 
            }
        }
        ?>
				</div>

				<p class="toolbar">
					<button type="button" class="button button-primary add_attribute"><?php 
        _e('Add', 'woocommerce');
        ?>
</button>
					<select name="attribute_taxonomy" class="attribute_taxonomy">
						<option value=""><?php 
        _e('Custom product attribute', 'woocommerce');
        ?>
</option>
						<?php 
        if ($attribute_taxonomies) {
            foreach ($attribute_taxonomies as $tax) {
                $attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name);
                $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
                echo '<option value="' . esc_attr($attribute_taxonomy_name) . '">' . esc_html($label) . '</option>';
            }
        }
        ?>
					</select>

					<button type="button" class="button save_attributes"><?php 
        _e('Save attributes', 'woocommerce');
        ?>
</button>
				</p>
			</div>
			<div id="linked_product_data" class="panel woocommerce_options_panel">

				<div class="options_group">

				<p class="form-field"><label for="upsell_ids"><?php 
        _e('Up-Sells', 'woocommerce');
        ?>
</label>
				<select id="upsell_ids" name="upsell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
">
					<?php 
        $upsell_ids = get_post_meta($post->ID, '_upsell_ids', true);
        $product_ids = !empty($upsell_ids) ? array_map('absint', $upsell_ids) : null;
        if ($product_ids) {
            foreach ($product_ids as $product_id) {
                $product = get_product($product_id);
                if ($product) {
                    echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product->get_formatted_name()) . '</option>';
                }
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>

				<p class="form-field"><label for="crosssell_ids"><?php 
        _e('Cross-Sells', 'woocommerce');
        ?>
</label>
				<select id="crosssell_ids" name="crosssell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
">
					<?php 
        $crosssell_ids = get_post_meta($post->ID, '_crosssell_ids', true);
        $product_ids = !empty($crosssell_ids) ? array_map('absint', $crosssell_ids) : null;
        if ($product_ids) {
            foreach ($product_ids as $product_id) {
                $product = get_product($product_id);
                if ($product) {
                    echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product->get_formatted_name()) . '</option>';
                }
            }
        }
        ?>
				</select> <img class="help_tip" data-tip='<?php 
        _e('Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" /></p>

				</div>

				<?php 
        echo '<div class="options_group grouping show_if_simple show_if_external">';
        // List Grouped products
        $post_parents = array();
        $post_parents[''] = __('Choose a grouped product&hellip;', 'woocommerce');
        if ($grouped_term = get_term_by('slug', 'grouped', 'product_type')) {
            $posts_in = array_unique((array) get_objects_in_term($grouped_term->term_id, 'product_type'));
            if (sizeof($posts_in) > 0) {
                $args = array('post_type' => 'product', 'post_status' => 'any', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'asc', 'post_parent' => 0, 'include' => $posts_in);
                $grouped_products = get_posts($args);
                if ($grouped_products) {
                    foreach ($grouped_products as $product) {
                        if ($product->ID == $post->ID) {
                            continue;
                        }
                        $post_parents[$product->ID] = $product->post_title;
                    }
                }
            }
        }
        woocommerce_wp_select(array('id' => 'parent_id', 'label' => __('Grouping', 'woocommerce'), 'value' => absint($post->post_parent), 'options' => $post_parents, 'desc_tip' => true, 'description' => __('Set this option to make this product part of a grouped product.', 'woocommerce')));
        woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent)));
        do_action('woocommerce_product_options_grouping');
        echo '</div>';
        ?>

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

			</div>

			<div id="advanced_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group hide_if_external">';
        // Purchase note
        woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce')));
        echo '</div>';
        echo '<div class="options_group">';
        // menu_order
        woocommerce_wp_text_input(array('id' => 'menu_order', 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Custom ordering position.', 'woocommerce'), 'value' => intval($post->menu_order), 'type' => 'number', 'custom_attributes' => array('step' => '1')));
        echo '</div>';
        echo '<div class="options_group reviews">';
        woocommerce_wp_checkbox(array('id' => 'comment_status', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open', 'value' => esc_attr($post->comment_status)));
        do_action('woocommerce_product_options_reviews');
        echo '</div>';
        ?>

			</div>

			<?php 
        self::output_variations();
        do_action('woocommerce_product_data_panels');
        do_action('woocommerce_product_write_panels');
        // _deprecated
        ?>

			<div class="clear"></div>

		</div>
		<?php 
    }
 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>";
 }
        /**
         * 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>';
                        } else {
                            $note_tip = isset($latest_note->comment_content) ? esc_attr($latest_note->comment_content . '<small style="display:block">' . sprintf(_n('plus %d other note', 'plus %d other notes', $post->comment_count - 1, 'woocommerce'), $post->comment_count - 1) . '</small>') : sprintf(_n('%d note', '%d notes', $post->comment_count, 'woocommerce'), $post->comment_count);
                            echo '<span class="note-on tips" data-tip="' . $note_tip . '">' . __('Yes', 'woocommerce') . '</span>';
                        }
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_total':
                    echo esc_html(strip_tags($the_order->get_formatted_order_total()));
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_title':
                    $customer_tip = '';
                    if ($address = $the_order->get_formatted_billing_address()) {
                        $customer_tip .= __('Billing:', 'woocommerce') . ' ' . $address . '<br/><br/>';
                    }
                    if ($the_order->billing_phone) {
                        $customer_tip .= __('Tel:', 'woocommerce') . ' ' . $the_order->billing_phone;
                    }
                    echo '<div class="tips" data-tip="' . esc_attr($customer_tip) . '">';
                    if ($the_order->user_id) {
                        $user_info = get_userdata($the_order->user_id);
                    }
                    if (!empty($user_info)) {
                        $username = '******' . absint($user_info->ID) . '">';
                        if ($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>';
                    } else {
                        if ($the_order->billing_first_name || $the_order->billing_last_name) {
                            $username = trim($the_order->billing_first_name . ' ' . $the_order->billing_last_name);
                        } else {
                            $username = __('Guest', 'woocommerce');
                        }
                    }
                    printf(__('%s by %s', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '"><strong>' . esc_attr($the_order->get_order_number()) . '</strong></a>', $username);
                    if ($the_order->billing_email) {
                        echo '<small class="meta email"><a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
                    }
                    echo '</div>';
                    break;
                case 'order_actions':
                    ?>
<p>
					<?php 
                    do_action('woocommerce_admin_order_actions_start', $the_order);
                    $actions = array();
                    if (in_array($the_order->status, array('pending', 'on-hold'))) {
                        $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
                    }
                    if (in_array($the_order->status, array('pending', 'on-hold', 'processing'))) {
                        $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
                    }
                    $actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
                    $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
                    foreach ($actions as $action) {
                        printf('<a class="button tips %s" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
                    }
                    do_action('woocommerce_admin_order_actions_end', $the_order);
                    ?>
				</p><?php 
                    break;
            }
        }
Example #12
0
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 
 /**
  * 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);
 }
Example #14
0
        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 
            }
        }
    /**
     * 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');
        ?>
:</label>
						<table class="widefat">
							<thead>
								<tr>
									<th class="sort">&nbsp;</th>
									<th><?php 
        _e('Name', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the name of the download shown to the customer.', 'woocommerce');
        ?>
">[?]</span></th>
									<th colspan="2"><?php 
        _e('File URL', 'woocommerce');
        ?>
 <span class="tips" data-tip="<?php 
        _e('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce');
        ?>
">[?]</span></th>
									<th>&nbsp;</th>
								</tr>
							</thead>
							<tbody>
								<?php 
        $downloadable_files = get_post_meta($post->ID, '_downloadable_files', true);
        if ($downloadable_files) {
            foreach ($downloadable_files as $key => $file) {
                include 'views/html-product-download.php';
            }
        }
        ?>
							</tbody>
							<tfoot>
								<tr>
									<th colspan="5">
										<a href="#" class="button insert" data-row="<?php 
        $file = array('file' => '', 'name' => '');
        ob_start();
        include 'views/html-product-download.php';
        echo esc_attr(ob_get_clean());
        ?>
"><?php 
        _e('Add File', 'woocommerce');
        ?>
</a>
									</th>
								</tr>
							</tfoot>
						</table>
					</div>
					<?php 
        // Download Limit
        woocommerce_wp_text_input(array('id' => '_download_limit', 'label' => __('Download Limit', 'woocommerce'), 'placeholder' => __('Unlimited', 'woocommerce'), 'description' => __('Leave blank for unlimited re-downloads.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Expirey
        woocommerce_wp_text_input(array('id' => '_download_expiry', 'label' => __('Download Expiry', 'woocommerce'), 'placeholder' => __('Never', 'woocommerce'), 'description' => __('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0')));
        // Download Type
        woocommerce_wp_select(array('id' => '_download_type', 'label' => __('Download Type', 'woocommerce'), 'description' => sprintf(__('Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce'), 'http://schema.org/'), 'options' => array('' => __('Standard Product', 'woocommerce'), 'application' => __('Application/Software', 'woocommerce'), 'music' => __('Music', 'woocommerce'))));
        do_action('woocommerce_product_options_downloads');
        echo '</div>';
        if (wc_tax_enabled()) {
            echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
            // Tax
            woocommerce_wp_select(array('id' => '_tax_status', 'label' => __('Tax Status', 'woocommerce'), 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'shipping' => __('Shipping only', 'woocommerce'), 'none' => _x('None', 'Tax status', 'woocommerce'))));
            $tax_classes = WC_Tax::get_tax_classes();
            $classes_options = array();
            $classes_options[''] = __('Standard', 'woocommerce');
            if (!empty($tax_classes)) {
                foreach ($tax_classes as $class) {
                    $classes_options[sanitize_title($class)] = esc_html($class);
                }
            }
            woocommerce_wp_select(array('id' => '_tax_class', 'label' => __('Tax Class', 'woocommerce'), 'options' => $classes_options));
            do_action('woocommerce_product_options_tax');
            echo '</div>';
        }
        do_action('woocommerce_product_options_general_product_data');
        ?>
			</div>

			<div id="inventory_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        if ('yes' == get_option('woocommerce_manage_stock')) {
            // manage stock
            woocommerce_wp_checkbox(array('id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce'), 'description' => __('Enable stock management at product level', 'woocommerce')));
            do_action('woocommerce_product_options_stock');
            echo '<div class="stock_fields show_if_simple show_if_variable">';
            // Stock
            woocommerce_wp_text_input(array('id' => '_stock', 'label' => __('Stock Qty', 'woocommerce'), 'desc_tip' => true, 'description' => __('Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any'), 'data_type' => 'stock'));
            // Backorders?
            woocommerce_wp_select(array('id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array('no' => __('Do not allow', 'woocommerce'), 'notify' => __('Allow, but notify customer', 'woocommerce'), 'yes' => __('Allow', 'woocommerce')), 'desc_tip' => true, 'description' => __('If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce')));
            do_action('woocommerce_product_options_stock_fields');
            echo '</div>';
        }
        // Stock status
        woocommerce_wp_select(array('id' => '_stock_status', 'wrapper_class' => 'hide_if_variable', 'label' => __('Stock status', 'woocommerce'), 'options' => array('instock' => __('In stock', 'woocommerce'), 'outofstock' => __('Out of stock', 'woocommerce')), 'desc_tip' => true, 'description' => __('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce')));
        do_action('woocommerce_product_options_stock_status');
        echo '</div>';
        echo '<div class="options_group show_if_simple show_if_variable">';
        // Individual product
        woocommerce_wp_checkbox(array('id' => '_sold_individually', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce')));
        do_action('woocommerce_product_options_sold_individually');
        echo '</div>';
        do_action('woocommerce_product_options_inventory_product_data');
        ?>

			</div>

			<div id="shipping_product_data" class="panel woocommerce_options_panel">

				<?php 
        echo '<div class="options_group">';
        // Weight
        if (wc_product_weight_enabled()) {
            woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => wc_format_localized_decimal(0), 'desc_tip' => 'true', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'text', 'data_type' => 'decimal'));
        }
        // Size fields
        if (wc_product_dimensions_enabled()) {
            ?>
<p class="form-field dimensions_field">
							<label for="product_length"><?php 
            echo __('Dimensions', 'woocommerce') . ' (' . get_option('woocommerce_dimension_unit') . ')';
            ?>
</label>
							<span class="wrap">
								<input id="product_length" placeholder="<?php 
            _e('Length', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_length" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_length', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Width', 'woocommerce');
            ?>
" class="input-text wc_input_decimal" size="6" type="text" name="_width" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_width', true)));
            ?>
" />
								<input placeholder="<?php 
            _e('Height', 'woocommerce');
            ?>
" class="input-text wc_input_decimal last" size="6" type="text" name="_height" value="<?php 
            echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_height', true)));
            ?>
" />
							</span>
							<img class="help_tip" data-tip="<?php 
            esc_attr_e('LxWxH in decimal form', 'woocommerce');
            ?>
" src="<?php 
            echo esc_url(WC()->plugin_url());
            ?>
/assets/images/help.png" height="16" width="16" />
						</p><?php 
        }
        do_action('woocommerce_product_options_dimensions');
        echo '</div>';
        echo '<div class="options_group">';
        // Shipping Class
        $classes = get_the_terms($thepostid, 'product_shipping_class');
        if ($classes && !is_wp_error($classes)) {
            $current_shipping_class = current($classes)->term_id;
        } else {
            $current_shipping_class = '';
        }
        $args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('No shipping class', 'woocommerce'), 'name' => 'product_shipping_class', 'id' => 'product_shipping_class', 'selected' => $current_shipping_class, 'class' => 'select short');
        ?>
<p class="form-field dimensions_field"><label for="product_shipping_class"><?php 
        _e('Shipping class', 'woocommerce');
        ?>
</label> <?php 
        wp_dropdown_categories($args);
        ?>
 <img class="help_tip" data-tip="<?php 
        esc_attr_e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce');
        ?>
" src="<?php 
        echo esc_url(WC()->plugin_url());
        ?>
/assets/images/help.png" height="16" width="16" /></p><?php 
        do_action('woocommerce_product_options_shipping');
        echo '</div>';
        ?>

			</div>

			<div id="product_attributes" class="panel wc-metaboxes-wrapper">
				<div class="product_attributes wc-metaboxes">

					<?php 
        global $wc_product_attributes;
        // Array of defined attribute taxonomies
        $attribute_taxonomies = wc_get_attribute_taxonomies();
        // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set
        $attributes = maybe_unserialize(get_post_meta($thepostid, '_product_attributes', true));
        // Output All Set Attributes
        if (!empty($attributes)) {
            $attribute_keys = array_keys($attributes);
            $attribute_total = sizeof($attribute_keys);
            for ($i = 0; $i < $attribute_total; $i++) {
                $attribute = $attributes[$attribute_keys[$i]];
                $position = empty($attribute['position']) ? 0 : absint($attribute['position']);
                $taxonomy = '';
                $metabox_class = array();
                if ($attribute['is_taxonomy']) {
                    $taxonomy = $attribute['name'];
                    if (!taxonomy_exists($taxonomy)) {
                        continue;
                    }
                    $attribute_taxonomy = $wc_product_attributes[$taxonomy];
                    $metabox_class[] = 'taxonomy';
                    $metabox_class[] = $taxonomy;
                    $attribute_label = wc_attribute_label($taxonomy);
                } else {
                    $attribute_label = apply_filters('woocommerce_attribute_label', $attribute['name'], $attribute['name']);
                }
                include 'views/html-product-attribute.php';
            }
        }
        ?>
				</div>

				<p class="toolbar">
					<button type="button" class="button button-primary add_attribute"><?php 
        _e('Add', 'woocommerce');
        ?>
</button>
					<select name="attribute_taxonomy" class="attribute_taxonomy">
						<option value=""><?php 
        _e('Custom product attribute', 'woocommerce');
        ?>
</option>
						<?php 
        if ($attribute_taxonomies) {
            foreach ($attribute_taxonomies as $tax) {
                $attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name);
                $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
                echo '<option value="' . esc_attr($attribute_taxonomy_name) . '">' . esc_html($label) . '</option>';
            }
        }
        ?>
					</select>

					<button type="button" class="button save_attributes"><?php 
        _e('Save attributes', 'woocommerce');
        ?>
</button>
				</p>
				<?php 
        do_action('woocommerce_product_options_attributes');
        ?>
			</div>
			<div id="linked_product_data" class="panel woocommerce_options_panel">

				<div class="options_group">

					<p class="form-field">
						<label for="upsell_ids"><?php 
        _e('Up-Sells', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="upsell_ids" name="upsell_ids" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_upsell_ids', true)));
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name()));
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>

					<p class="form-field">
						<label for="crosssell_ids"><?php 
        _e('Cross-Sells', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="crosssell_ids" name="crosssell_ids" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_crosssell_ids', true)));
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name()));
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>
				</div>

				<div class="options_group grouping show_if_simple show_if_external">

					<p class="form-field">
						<label for="parent_id"><?php 
        _e('Grouping', 'woocommerce');
        ?>
</label>
						<input type="hidden" class="wc-product-search" style="width: 50%;" id="parent_id" name="parent_id" data-placeholder="<?php 
        _e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_grouped_products" data-allow_clear="true" data-multiple="false" data-exclude="<?php 
        echo intval($post->ID);
        ?>
" data-selected="<?php 
        $parent_id = absint($post->post_parent);
        if ($parent_id) {
            $parent = wc_get_product($parent_id);
            if (is_object($parent)) {
                $parent_title = wp_kses_post(html_entity_decode($parent->get_formatted_name()));
            }
            echo esc_attr($parent_title);
        }
        ?>
" value="<?php 
        echo $parent_id ? $parent_id : '';
        ?>
" /> <img class="help_tip" data-tip='<?php 
        _e('Set this option to make this product part of a grouped product.', 'woocommerce');
        ?>
' src="<?php 
        echo WC()->plugin_url();
        ?>
/assets/images/help.png" height="16" width="16" />
					</p>

					<?php 
        woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent)));
        do_action('woocommerce_product_options_grouping');
        ?>
				</div>

				<?php 
        do_action('woocommerce_product_options_related');
        ?>
			</div>

			<div id="advanced_product_data" class="panel woocommerce_options_panel">

				<div class="options_group hide_if_external">
					<?php 
        // Purchase note
        woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce')));
        ?>
				</div>

				<div class="options_group">
					<?php 
        // menu_order
        woocommerce_wp_text_input(array('id' => 'menu_order', 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Custom ordering position.', 'woocommerce'), 'value' => intval($post->menu_order), 'type' => 'number', 'custom_attributes' => array('step' => '1')));
        ?>
				</div>

				<div class="options_group reviews">
					<?php 
        woocommerce_wp_checkbox(array('id' => 'comment_status', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open', 'value' => esc_attr($post->comment_status)));
        do_action('woocommerce_product_options_reviews');
        ?>
				</div>

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

			</div>

			<?php 
        self::output_variations();
        do_action('woocommerce_product_data_panels');
        do_action('woocommerce_product_write_panels');
        // _deprecated
        ?>

			<div class="clear"></div>

		</div>
		<?php 
    }
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'));
?>
<div class="product_meta">

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

	<?php 
if (wc_product_sku_enabled() && $product->get_sku()) {
    ?>

		<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 
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 
    _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);
Example #18
0
function ts_template_single_sku()
{
    global $product;
    if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
        echo '<div class="sku-wrapper product_meta">' . esc_html__('Sku: ', 'gon') . '<span class="sku" itemprop="sku">' . (($sku = $product->get_sku()) ? $sku : esc_html__('N/A', 'gon')) . '</span></div>';
    }
}