public static function display_field_options($fieldoptions) { global $woocommerce, $post; foreach ($fieldoptions as $key => $fields) { if (isset($fields['type'])) { switch ($fields['type']) { case 'select': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_select($fields); break; case 'checkbox': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_checkbox($fields); break; case 'radio': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_radio($fields); break; case 'hidden': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_hidden_input($fields); break; case 'number': case 'text': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_text_input($fields); break; case 'textarea': if ($result = get_post_meta($post->ID, $fields['id'], true)) { $fields['value'] = $result; } woocommerce_wp_textarea_input($fields); break; } } } }
/** * Display the custom WCRC fields on every product edit page */ function woo_refercheck_add_custom_general_fields() { global $woocommerce, $post; // read the current referrers list $referrers = get_post_meta($post->ID, '_woo_refercheck_referrers', true); // convert to array $ref_array = json_decode($referrers); // build the value of the textarea $theval = ''; if (count($ref_array) > 0) { $i = 0; foreach ($ref_array as $item) { $theval .= $item; if ($i != count($ref_array) - 1) { $theval .= PHP_EOL; } $i++; } } // start the HTML output for the custom fields echo '<div class="options_group">'; // create and output the checkbox woocommerce_wp_checkbox(array('id' => '_woo_refercheck_checkbox', 'label' => __('Limit to referrer(s)', 'woo-refercheck'), 'description' => __('Select if the display of this product should be limited to the specified referrer(s).', 'woo-refercheck'))); // create and output the text field woocommerce_wp_textarea_input(array('id' => '_woo_refercheck_referrers', 'label' => __('Allowed referrer(s)', 'woo-refercheck'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Add the full HTTP addresseses of allowed referrer(s) for this product, one per line.', 'woo-refercheck'), 'value' => $theval)); woocommerce_wp_text_input(array('id' => '_woo_refercheck_target', 'label' => __('Redirect to', 'woo-refercheck'), 'placeholder' => 'http://', 'desc_tip' => 'true', 'description' => __('Enter the absolute URL to redirect to when this product is accessed form an unallowed referer.', 'woo-refercheck'))); // complete the HTML output echo '</div>'; }
/** * Creates the Referfriend Meta Box in the admin control panel when in the Giftcard Post Type. Allows you to create a giftcard manually. * @param [type] $post * @return [type] */ function rf_meta_box($post) { global $woocommerce; wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); ?> <style type="text/css"> #edit-slug-box, #minor-publishing-actions { display:none } .form-field input, .form-field textarea { width:100%;} input[type="checkbox"], input[type="radio"] { float: left; width:16px;} </style> <div class="panel woocommerce_options_panel"> <?php woocommerce_wp_select(array('id' => 'rf_coupon_type', 'label' => __('Coupon Type', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Type', 'mg_referfriend'), 'options' => wc_get_coupon_types())); woocommerce_wp_text_input(array('id' => 'rf_coupon_amount', 'label' => __('Coupon Amount', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Coupon Amount', 'mg_referfriend'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'))); woocommerce_wp_select(array('id' => 'rf_type', 'label' => __('Type', 'mg_referfriend'), 'placeholder' => '', 'options' => array('' => '', '1' => 'Refered by Email', '2' => 'Refered by share link'))); // Description woocommerce_wp_textarea_input(array('id' => 'rf_description', 'label' => __('Description', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Description', 'rpgiftcards'))); woocommerce_wp_text_input(array('id' => 'rf_product_id', 'label' => __('Product IDs', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Product IDs', 'mg_referfriend'), 'type' => 'number')); woocommerce_wp_text_input(array('id' => 'rf_usage', 'label' => __('Usage', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Usage', 'mg_referfriend'))); woocommerce_wp_text_input(array('id' => 'rf_limit', 'label' => __('Limit', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Limit', 'mg_referfriend'))); woocommerce_wp_text_input(array('id' => 'rf_expiry_date', 'label' => __('Expiry Date', 'mg_referfriend'), 'placeholder' => '', 'description' => __('Expiry Date', 'mg_referfriend'))); echo '</div>'; }
function woo_add_custom_general_fields() { global $woocommerce, $post; echo '<div id="thong_tin_hoa_chat" class="panel woocommerce_options_panel"><div class="options_group">'; woocommerce_wp_text_input(array('id' => '_ten_hoa_hoc_field', 'label' => __('Tển hoá học', 'woocommerce'), 'placeholder' => 'Calcium Hypochlorite', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); woocommerce_wp_textarea_input(array('id' => '_ten_goi_khac_field', 'label' => __('Các tên gọi khác', 'woocommerce'), 'placeholder' => 'Tên gọi 1, Tên gọi 2, Tên gọi 3', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); woocommerce_wp_text_input(array('id' => '_cong_thuc_hoa_hoc_field', 'label' => __('Công thức hoá học', 'woocommerce'), 'placeholder' => 'Ca(OCl)2', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); woocommerce_wp_text_input(array('id' => '_ham_luong_hoa_chat_field', 'label' => __('Hàm lượng hoá chất', 'woocommerce'), 'placeholder' => '%', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); woocommerce_wp_text_input(array('id' => '_xuat_xu_field', 'label' => __('Xuất xứ', 'woocommerce'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); woocommerce_wp_text_input(array('id' => '_dong_goi_field', 'label' => __('Đóng gói', 'woocommerce'), 'placeholder' => 'Kg/1thùng', 'desc_tip' => 'true', 'description' => __('Enter the custom value here.', 'woocommerce'))); echo '</div></div>'; }
/** * Renders coupon options. */ public static function woocommerce_coupon_options() { global $post, $woocommerce; // // Volume discounts based on cart items // echo '<div class="options_group">'; echo '<p>'; echo '<strong>'; echo __('Volume Discount', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</strong>'; echo '</p>'; $product_ids = !empty($post) && !empty($post->ID) ? get_post_meta($post->ID, '_vd_product_ids', false) : array(); echo '<p class="form-field _vd_product_ids_field">'; echo '<label for="_vd_product_ids">'; echo __('Products', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</label>'; printf('<select id="_vd_product_ids" class="ajax_chosen_select_products_and_variations _vd_product_ids multiselect" name="_vd_product_ids[]" multiple="multiple" title="%s" data-placeholder="%s">', __('Start typing to search for products.', WOO_VOLDISC_PLUGIN_DOMAIN), __('Search for a product …', WOO_VOLDISC_PLUGIN_DOMAIN)); foreach ($product_ids as $product_id) { $product = get_product($product_id); $product_name = woocommerce_get_formatted_product_name($product); printf('<option value="%s" %s>%s</option>', esc_attr($product_id), ' selected="selected" ', wp_kses_post($product_name)); } echo '</select>'; printf('<img class="help_tip" data-tip="%s" src="%s" height="16" width="16" />', __('For a customer to be allowed to apply this coupon, at least one of the chosen products must be in the cart and its quantity must be within the given minimum and maximum.', WOO_VOLDISC_PLUGIN_DOMAIN), esc_attr($woocommerce->plugin_url() . '/assets/images/help.png')); echo '</p>'; $term_ids = !empty($post) && !empty($post->ID) ? get_post_meta($post->ID, '_vd_term_ids', false) : array(); echo '<p class="form-field _vd_product_ids_field">'; echo '<label for="_vd_term_ids">'; echo __('Product Categories', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</label>'; printf('<select id="_vd_term_ids" class="chosen_select" name="_vd_term_ids[]" multiple="multiple" title="%s" data-placeholder="%s">', __('Start typing to search for categories.', WOO_VOLDISC_PLUGIN_DOMAIN), __('Search for a category …', WOO_VOLDISC_PLUGIN_DOMAIN)); $categories = get_terms('product_cat', 'orderby=name&hide_empty=0'); if ($categories) { foreach ($categories as $category) { printf('<option value="%s" %s>%s</option>', esc_attr($category->term_id), in_array($category->term_id, $term_ids) ? ' selected="selected" ' : '', esc_html($category->name)); } } echo '</select>'; printf('<img class="help_tip" data-tip="%s" src="%s" height="16" width="16" />', __('If one or more categories are chosen, the coupon is valid if at least one product in the selected categories is in the cart and its quantity is within the given minimum and maximum.', WOO_VOLDISC_PLUGIN_DOMAIN), esc_attr($woocommerce->plugin_url() . '/assets/images/help.png')); echo '</p>'; woocommerce_wp_text_input(array('id' => '_vd_min', 'label' => __('Minimum', WOO_VOLDISC_PLUGIN_DOMAIN), 'placeholder' => __('no restriction', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Input the minimum quantity that must be in the cart. The condition is met, if for any of the chosen products, or any product in the selected categories, the minimum quantity is in the cart.', WOO_VOLDISC_PLUGIN_DOMAIN), 'desc_tip' => true)); woocommerce_wp_text_input(array('id' => '_vd_max', 'label' => __('Maximum', WOO_VOLDISC_PLUGIN_DOMAIN), 'placeholder' => __('no restriction', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Input the maximum quantity allowed in the cart. The condition is met, if for any of the chosen products, or any product in the selected categories, the quantity in the cart does not exceed the maximum.', WOO_VOLDISC_PLUGIN_DOMAIN), 'desc_tip' => true)); woocommerce_wp_checkbox(array('id' => '_vd_auto', 'label' => __('Apply automatically', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Apply this coupon automatically when valid based on these conditions.', WOO_VOLDISC_PLUGIN_DOMAIN))); woocommerce_wp_checkbox(array('id' => '_vd_sum_by_term_id', 'label' => __('Sum categories', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Sum the number of units per category. If this is enabled, the quantity restrictions are based on the totals per category, instead of per individual product. This applies only to products in the selected categories, if any.', WOO_VOLDISC_PLUGIN_DOMAIN))); echo '<p class="description">'; echo __('The coupon <strong>will only be restricted</strong>, if at least one product or category and a minimum or a maximum (or both) are set.', WOO_VOLDISC_PLUGIN_DOMAIN); echo ' '; echo __('For product <strong>variations</strong>, if a variable product is chosen (i.e. the parent to its variations), the quantity in the cart used to check the minimum or maximum is the combined total of all variations in the cart.', WOO_VOLDISC_PLUGIN_DOMAIN); echo ' '; echo __('If a product variation is chosen (i.e. a product variation derived by attribute from its parent product), the quantity check is made for that variation only, independent of other variations in the cart.', WOO_VOLDISC_PLUGIN_DOMAIN); echo ' '; echo __('If both products and categories are indicated, one of the specified products or a product that belongs to one of the categories must meet the quantity restrictions.', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</p>'; echo '<p>'; echo __('<strong>Display Options</strong>', WOO_VOLDISC_PLUGIN_DOMAIN); echo ' - '; echo __('For the products indicated and products in the selected categories, the product displayed can be enhanced with information based on the coupon\'s description and volume discount.', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</p>'; echo '<p>'; echo __('Show the <em>coupon description</em> for products on these pages:', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</p>'; $description_display = get_post_meta($post->ID, '_vd_description_display', false); foreach (self::$display_indexes as $key => $label) { woocommerce_wp_checkbox(array('id' => '_vd_description_display_' . $key, 'label' => $label, 'value' => in_array($key, $description_display) ? 'yes' : '')); } echo '<p>'; echo __('Show the <em>volume discount info</em> for products on these pages:', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</p>'; $info_display = get_post_meta($post->ID, '_vd_info_display', false); foreach (self::$display_indexes as $key => $label) { woocommerce_wp_checkbox(array('id' => '_vd_info_display_' . $key, 'label' => $label, 'value' => in_array($key, $info_display) ? 'yes' : '')); } echo '<p>'; echo __('<strong>Auto-apply Display Options</strong>', WOO_VOLDISC_PLUGIN_DOMAIN); echo '</p>'; woocommerce_wp_textarea_input(array('id' => '_vd_auto_message_display', 'label' => __('Message', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('If not empty, display a message when the coupon is automatically applied.', WOO_VOLDISC_PLUGIN_DOMAIN))); woocommerce_wp_checkbox(array('id' => '_vd_auto_description_display', 'label' => __('Description', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Display the coupon description when the coupon is automatically applied.', WOO_VOLDISC_PLUGIN_DOMAIN))); woocommerce_wp_checkbox(array('id' => '_vd_auto_info_display', 'label' => __('Volume Discount Info', WOO_VOLDISC_PLUGIN_DOMAIN), 'description' => __('Display the <em>volume discount info</em> when the coupon is automatically applied.', WOO_VOLDISC_PLUGIN_DOMAIN))); echo '</div>'; // .options_group }
/** * Product data box * * Displays the product data box, tabbed, with several panels covering price, stock etc */ function woocommerce_product_data_box() { global $post, $wpdb, $thepostid, $woocommerce; wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); $thepostid = $post->ID; ?> <div class="panel-wrap product_data"> <ul class="product_data_tabs tabs" style="display:none;"> <li class="active general_options"><a href="#general_product_data"><?php _e('General', 'woocommerce'); ?> </a></li> <li class="tax_tab show_if_simple show_if_variable tax_options"><a href="#tax_product_data"><?php _e('Tax', 'woocommerce'); ?> </a></li> <li class="inventory_tab show_if_simple show_if_variable show_if_grouped inventory_options"><a href="#inventory_product_data"><?php _e('Inventory', 'woocommerce'); ?> </a></li> <li class="related_product_tab related_product_options"><a href="#related_product_data"><?php _e('Related Products', 'woocommerce'); ?> </a></li> <li class="attributes_tab attribute_options"><a href="#woocommerce_attributes"><?php _e('Attributes', 'woocommerce'); ?> </a></li> <li class="grouping_tab show_if_simple show_if_external grouping_options"><a href="#grouping_product_data"><?php _e('Grouping', 'woocommerce'); ?> </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 show_if_simple show_if_variable show_if_external">'; // SKU if (get_option('woocommerce_enable_sku', true) !== 'no') { woocommerce_wp_text_input(array('id' => '_sku', 'label' => '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr>')); } else { echo '<input type="hidden" name="_sku" value="' . 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', 'class' => 'wc_input_price short', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')')); // Special Price woocommerce_wp_text_input(array('id' => '_sale_price', 'class' => 'wc_input_price short', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>')); // Special Price date range $field = array('id' => '_sale_price_dates', 'label' => __('Sale Price Dates', 'woocommerce')); $sale_price_dates_from = get_post_meta($thepostid, '_sale_price_dates_from', true); $sale_price_dates_to = get_post_meta($thepostid, '_sale_price_dates_to', true); echo ' <p class="form-field sale_price_dates_fields"> <label for="' . $field['id'] . '_from">' . $field['label'] . '</label> <input type="text" class="short" name="' . $field['id'] . '_from" id="' . $field['id'] . '_from" value="'; if ($sale_price_dates_from) { echo date('Y-m-d', $sale_price_dates_from); } echo '" placeholder="' . _x('From…', 'placeholder', 'woocommerce') . '" maxlength="10" /> <input type="text" class="short" name="' . $field['id'] . '_to" id="' . $field['id'] . '_to" value="'; if ($sale_price_dates_to) { echo date('Y-m-d', $sale_price_dates_to); } echo '" placeholder="' . _x('To…', 'placeholder', 'woocommerce') . '" maxlength="10" /> <a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a> </p>'; do_action('woocommerce_product_options_pricing'); echo '</div>'; echo '<div class="options_group hide_if_virtual hide_if_grouped">'; // Weight if (get_option('woocommerce_enable_weight', true) !== 'no') { woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => '0.00')); } else { echo '<input type="hidden" name="_weight" value="' . get_post_meta($thepostid, '_weight', true) . '" />'; } // Size fields if (get_option('woocommerce_enable_dimensions', true) !== 'no') { ?> <p class="form-field dimensions_field"> <label for"product_length"><?php echo __('Dimensions', 'woocommerce') . ' (' . get_option('woocommerce_dimension_unit') . ')'; ?> </label> <input id="product_length" placeholder="<?php _e('Length', 'woocommerce'); ?> " class="input-text sized" size="6" type="text" name="_length" value="<?php echo get_post_meta($thepostid, '_length', true); ?> " /> <input placeholder="<?php _e('Width', 'woocommerce'); ?> " class="input-text sized" size="6" type="text" name="_width" value="<?php echo get_post_meta($thepostid, '_width', true); ?> " /> <input placeholder="<?php _e('Height', 'woocommerce'); ?> " class="input-text sized" size="6" type="text" name="_height" value="<?php echo get_post_meta($thepostid, '_height', true); ?> " /> </p><?php } else { echo '<input type="hidden" name="_length" value="' . get_post_meta($thepostid, '_length', true) . '" />'; echo '<input type="hidden" name="_width" value="' . get_post_meta($thepostid, '_width', true) . '" />'; echo '<input type="hidden" name="_height" value="' . get_post_meta($thepostid, '_height', true) . '" />'; } // 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); ?> <span class="description"><?php _e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce'); ?> </span></p><?php do_action('woocommerce_product_options_dimensions'); echo '</div>'; echo '<div class="options_group">'; // Visibility woocommerce_wp_select(array('id' => '_visibility', 'label' => __('Visibility', 'woocommerce'), 'options' => apply_filters('woocommerce_product_visibility_options', array('visible' => __('Catalog & search', 'woocommerce'), 'catalog' => __('Catalog', 'woocommerce'), 'search' => __('Search', 'woocommerce'), 'hidden' => __('Hidden', 'woocommerce'))), 'description' => __('Define the loops this product should be visible in. It will still be accessible directly.', 'woocommerce'))); // Featured woocommerce_wp_checkbox(array('id' => '_featured', 'label' => __('Featured', 'woocommerce'), 'description' => __('Enable this option to feature this product', 'woocommerce'))); echo '</div>'; echo '<div class="options_group hide_if_external">'; // Purchase note woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce'))); echo '</div>'; echo '<div class="options_group show_if_downloadable">'; // File URL $file_path = get_post_meta($post->ID, '_file_path', true); $field = array('id' => '_file_path', 'label' => __('File path', 'woocommerce')); echo '<p class="form-field"><label for="' . $field['id'] . '">' . $field['label'] . ':</label> <input type="text" class="short file_path" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $file_path . '" placeholder="' . __('File path/URL', 'woocommerce') . '" /> <input type="button" class="upload_file_button button" value="' . __('Upload a file', 'woocommerce') . '" /> </p>'; // 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'))); // 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'))); do_action('woocommerce_product_options_downloads'); echo '</div>'; do_action('woocommerce_product_options_general_product_data'); ?> </div> <div id="tax_product_data" class="panel woocommerce_options_panel"> <?php // Tax woocommerce_wp_select(array('id' => '_tax_status', 'label' => __('Tax Status', 'woocommerce'), 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'shipping' => __('Shipping only', 'woocommerce'), 'none' => __('None', '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)] = $class; } } woocommerce_wp_select(array('id' => '_tax_class', 'label' => __('Tax Class', 'woocommerce'), 'options' => $classes_options)); do_action('woocommerce_product_options_tax'); ?> </div> <div id="inventory_product_data" class="panel woocommerce_options_panel"> <?php 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'))); 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'))); 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>'; } ?> </div> <div id="woocommerce_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="woocommerce_attributes wc-metaboxes"> <?php $attribute_taxonomies = $woocommerce->get_attribute_taxonomies(); // Array of defined attribute taxonomies $attributes = maybe_unserialize(get_post_meta($thepostid, '_product_attributes', true)); // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set $i = -1; // Taxonomies if ($attribute_taxonomies) { foreach ($attribute_taxonomies as $tax) { $i++; // Get name of taxonomy we're now outputting (pa_xxx) $attribute_taxonomy_name = $woocommerce->attribute_taxonomy_name($tax->attribute_name); // Ensure it exists if (!taxonomy_exists($attribute_taxonomy_name)) { continue; } // Get product data values for current taxonomy - this contains ordering and visibility data if (isset($attributes[$attribute_taxonomy_name])) { $attribute = $attributes[$attribute_taxonomy_name]; } $position = isset($attribute['position']) ? $attribute['position'] : 0; // 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 $tax->attribute_label ? $tax->attribute_label : $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($term->slug, $attribute_taxonomy_name, $thepostid) ? 1 : 0; echo '<option value="' . $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 implode('|', $values); } ?> " placeholder="<?php _e('Pipe separate terms', 'woocommerce'); ?> " /> <?php } ?> </td> </tr> <tr> <td> <label><input type="checkbox" class="checkbox" <?php if (isset($attribute['is_visible'])) { 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 if (isset($attribute['is_variation'])) { 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 } } // Custom Attributes if ($attributes && sizeof($attributes) > 0) { foreach ($attributes as $attribute) { if ($attribute['is_taxonomy']) { continue; } $i++; $position = isset($attribute['position']) ? $attribute['position'] : 0; ?> <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 esc_attr($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 = $woocommerce->attribute_taxonomy_name($tax->attribute_name); $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name; echo '<option value="' . $attribute_taxonomy_name . '">' . $label . '</option>'; } } ?> </select> </p> <div class="clear"></div> </div> <div id="related_product_data" class="panel woocommerce_options_panel"> <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…', 'woocommerce'); ?> "> <?php $product_ids = get_post_meta($post->ID, '_upsell_ids', true); if ($product_ids) { foreach ($product_ids as $product_id) { $title = get_the_title($product_id); $sku = get_post_meta($product_id, '_sku', true); if (!$title) { continue; } if (isset($sku) && $sku) { $sku = ' (SKU: ' . $sku . ')'; } echo '<option value="' . $product_id . '" selected="selected">' . $title . $sku . '</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 $woocommerce->plugin_url(); ?> /assets/images/help.png" /></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…', 'woocommerce'); ?> "> <?php $product_ids = get_post_meta($post->ID, '_crosssell_ids', true); if ($product_ids) { foreach ($product_ids as $product_id) { $title = get_the_title($product_id); $sku = get_post_meta($product_id, '_sku', true); if (!$title) { continue; } if (isset($sku) && $sku) { $sku = ' (SKU: ' . $sku . ')'; } echo '<option value="' . $product_id . '" selected="selected">' . $title . $sku . '</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 $woocommerce->plugin_url(); ?> /assets/images/help.png" /></p> <?php do_action('woocommerce_product_options_related'); ?> </div> <div id="grouping_product_data" class="panel woocommerce_options_panel"> <?php echo '<div class="options_group grouping">'; // List Grouped products $post_parents = array(); $post_parents[''] = __('Choose a grouped product…', 'woocommerce'); $posts_in = array_unique((array) get_objects_in_term(get_term_by('slug', 'grouped', 'product_type')->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); $loop = 0; 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' => $post->post_parent, 'options' => $post_parents)); // Ordering - removed due to adding page-attributes panel (same field) //woocommerce_wp_text_input( array( 'id' => 'menu_order', 'label' => _x('Sort Order', 'ordering', 'woocommerce'), 'value' => $post->menu_order ) ); do_action('woocommerce_product_options_grouping'); echo '</div>'; ?> </div> <?php do_action('woocommerce_product_write_panels'); ?> </div> <?php }
/** * woocommerce_variation_options_tax action. * * @since 2.5.0 * * @param int $loop * @param array $variation_data * @param WP_Post $variation */ do_action('woocommerce_variation_options_tax', $loop, $variation_data, $variation); } ?> </div> <div> <?php woocommerce_wp_textarea_input(array('id' => "variable_description{$loop}", 'name' => "variable_description[{$loop}]", 'value' => $variation_object->get_description('edit'), 'label' => __('Description', 'woocommerce'), 'desc_tip' => true, 'description' => __('Enter an optional description for this variation.', 'woocommerce'), 'wrapper_class' => 'form-row form-row-full')); ?> </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'); ?> <?php
/** * Display the order status data meta box * * @since 1.0.0 */ public function order_status_data_meta_box() { global $post; $status = new WC_Order_Status_Manager_Order_Status($post->ID); wp_nonce_field('wc_order_status_manager_save_data', 'wc_order_status_manager_meta_nonce'); ?> <div id="order_status_options" class="panel woocommerce_options_panel"> <div class="options_group"> <?php // Status Name woocommerce_wp_text_input(array('id' => 'post_title', 'label' => __('Name', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => $post->post_title)); // Disable slug editing for core statuses $custom_attributes = array(); if ($status->is_core_status()) { $custom_attributes['disabled'] = 'disabled'; } // Slug woocommerce_wp_text_input(array('id' => 'post_name', 'label' => __('Slug', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => $post->post_name, 'custom_attributes' => $custom_attributes, 'desc_tip' => true, 'description' => __('Optional. If left blank, the slug will be automatically generated from the name. Maximum: 17 characters.', WC_Order_Status_Manager::TEXT_DOMAIN))); // Description woocommerce_wp_textarea_input(array('id' => 'post_excerpt', 'label' => __('Description', WC_Order_Status_Manager::TEXT_DOMAIN), 'desc_tip' => true, 'description' => __('Optional status description. If set, this will be shown to customers while viewing an order.', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => htmlspecialchars_decode($post->post_excerpt, ENT_QUOTES))); ?> </div><!-- // .options_group --> <div class="options_group"> <?php // Color woocommerce_wp_text_input(array('id' => '_color', 'label' => __('Color', WC_Order_Status_Manager::TEXT_DOMAIN), 'type' => 'text', 'class' => 'colorpick', 'default' => '#000000', 'desc_tip' => true, 'description' => __('Color displayed behind the order status image or name', WC_Order_Status_Manager::TEXT_DOMAIN))); // Status Icon $icon = $status->get_icon(); $icon_attachment_src = ''; if (is_numeric($icon)) { $icon_attachment_src = wp_get_attachment_image_src($icon, 'wc_order_status_icon'); } ?> <p class="form-field _icon_field"> <label for="_icon"><?php _e('Icon', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </label> <input type="text" id="_icon" name="_icon" class="short" value="<?php echo esc_attr($status->get_icon()); ?> " data-icon-image="<?php echo esc_attr($icon_attachment_src ? $icon_attachment_src[0] : ''); ?> "> <a href="#_icon" class="button upload-icon upload-icon-image" data-uploader-button-text="<?php _e('Set as status icon', WC_Order_Status_Manager::TEXT_DOMAIN); ?> "><?php _e("Select File", WC_Order_Status_Manager::TEXT_DOMAIN); ?> </a> <img class="help_tip" data-tip="<?php _e("Optional status icon. If not supplied, then Name will be displayed to represent the status", WC_Order_Status_Manager::TEXT_DOMAIN); ?> " src="<?php echo esc_url(WC()->plugin_url()); ?> /assets/images/help.png" height="16" width="16" /> </p> <?php // Status Action Icon $action_icon = $status->get_action_icon(); $action_icon_attachment_src = ''; if (is_numeric($action_icon)) { $action_icon_attachment_src = wp_get_attachment_image_src($action_icon, 'wc_order_status_icon'); } ?> <p class="form-field _action_icon_field"> <label for="_action_icon"><?php _e('Action Icon', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </label> <input type="text" id="_action_icon" name="_action_icon" class="short" value="<?php echo esc_attr($status->get_action_icon()); ?> " data-icon-image="<?php echo esc_attr($action_icon_attachment_src ? $action_icon_attachment_src[0] : ''); ?> "> <a href="#_action_icon" class="button upload-icon upload-icon-image" data-uploader-button-text="<?php _e('Set as status icon', WC_Order_Status_Manager::TEXT_DOMAIN); ?> "><?php _e("Select File", WC_Order_Status_Manager::TEXT_DOMAIN); ?> </a> <img class="help_tip" data-tip="<?php _e("Optional action icon displayed in the action buttons for the next statuses.", WC_Order_Status_Manager::TEXT_DOMAIN); ?> " src="<?php echo esc_url(WC()->plugin_url()); ?> /assets/images/help.png" height="16" width="16" /> </p> </div><!-- // .options_group --> <div class="options_group"> <?php // Next statuses $next_status_options = array(); $selected = $status->get_next_statuses(); $selected = $selected ? $selected : array(); foreach (wc_get_order_statuses() as $slug => $name) { if ($status->get_slug(true) !== $slug) { $next_status_options[str_replace('wc-', '', $slug)] = $name; } } ?> <p class="form-field _next_statuses_field"> <label for="_next_statuses"><?php _e('Next Statuses', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </label> <select id="_next_statuses" name="_next_statuses[]" class="select short" multiple> <?php foreach ($next_status_options as $slug => $name) { ?> <option value="<?php echo esc_attr($slug); ?> " <?php selected(in_array($slug, $selected), 1); ?> ><?php echo esc_html($name); ?> </option> <?php } ?> </select> <img class="help_tip" data-tip="<?php _e('Zero or more statuses that would be considered next during normal order status flow. Action buttons will be available to move an order with this custom status to these next statuses.', WC_Order_Status_Manager::TEXT_DOMAIN); ?> " src="<?php echo esc_url(WC()->plugin_url()); ?> /assets/images/help.png" height="16" width="16" /> </p> <?php // Bulk action woocommerce_wp_checkbox(array('id' => '_bulk_action', 'label' => __('Bulk action', WC_Order_Status_Manager::TEXT_DOMAIN), 'description' => __('Check this to add this order status to the Orders list table Bulk Actions list.', WC_Order_Status_Manager::TEXT_DOMAIN))); // Include in reports woocommerce_wp_checkbox(array('id' => '_include_in_reports', 'label' => __('Include in reports', WC_Order_Status_Manager::TEXT_DOMAIN), 'description' => __('Check this to include orders with this order status in the order reports.', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => 'auto-draft' === $post->post_status ? 'yes' : get_post_meta($post->ID, '_include_in_reports', true))); ?> </div><!-- // .options_group --> </div><!-- // .woocommerce_options_panel --> <?php }
/** * Create new fields for variations * */ function variable_fields($loop, $variation_data) { ?> <tr> <td> <?php // Textarea woocommerce_wp_textarea_input(array('id' => '_textarea[' . $loop . ']', 'name' => 'shipping notes', 'label' => __('Shipping Notes', 'woocommerce'), 'placeholder' => '', 'description' => __('Enter the custom value here.', 'woocommerce'), 'value' => $variation_data['_textarea'][0])); // Textarea woocommerce_wp_textarea_input(array('id' => '_description[' . $loop . ']', 'name' => 'Description', 'label' => __('Model Description', 'woocommerce'), 'placeholder' => '', 'description' => __('Enter the description here.', 'woocommerce'), 'value' => $variation_data['_description'][0])); ?> </td> </tr> <?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="' . esc_attr__('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()); 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"> <ul class="product_data_tabs wc-tabs" style="display:none;"> <?php $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', '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="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 esc_attr_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 esc_attr_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 esc_attr_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="toolbar toolbar-top"> <span class="expand-close"> <a href="#" class="expand_all"><?php _e('Разшири', 'woocommerce'); ?> </a> / <a href="#" class="close_all"><?php _e('Затвори', 'woocommerce'); ?> </a> </span> <select name="attribute_taxonomy" class="attribute_taxonomy"> <option value=""><?php _e('Атрибут', 'woocommerce'); ?> </option> <?php global $wc_product_attributes; // Array of defined attribute taxonomies $attribute_taxonomies = wc_get_attribute_taxonomies(); 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 add_attribute"><?php _e('Add', 'woocommerce'); ?> </button> </div> <div class="product_attributes wc-metaboxes"> <?php // 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> <div class="toolbar"> <span class="expand-close"> <a href="#" class="expand_all"><?php _e('Expand', 'woocommerce'); ?> </a> / <a href="#" class="close_all"><?php _e('Close', 'woocommerce'); ?> </a> </span> <button type="button" class="button save_attributes button-primary"><?php _e('Save Attributes', 'woocommerce'); ?> </button> </div> <?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 esc_attr_e('Search for a product…', '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(), ENT_QUOTES, get_bloginfo('charset'))); } } 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 esc_attr_e('Search for a product…', '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(), ENT_QUOTES, get_bloginfo('charset'))); } } echo esc_attr(json_encode($json_ids)); ?> " value="<?php echo implode(',', array_keys($json_ids)); ?> " /> <img class="help_tip" data-tip='<?php esc_attr_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 esc_attr_e('Search for a product…', '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(), ENT_QUOTES, get_bloginfo('charset'))); } 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 }
public static function wbm_product_meta() { woocommerce_wp_textarea_input(array('id' => '_wbm_details_link', 'label' => __('Details Page Link', 'wbm'), 'placeholder' => '', 'description' => __('Enter details page link with http://', 'wbm'))); }
/** * Display the order status email data meta box * * @since 1.0.0 */ public function order_status_email_data_meta_box() { global $post; wp_nonce_field('wc_order_status_manager_save_data', 'wc_order_status_manager_meta_nonce'); ?> <div id="order_status_email_options" class="panel woocommerce_options_panel"> <div class="options_group"> <?php // Status Email Name woocommerce_wp_text_input(array('id' => 'post_title', 'label' => __('Name', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => $post->post_title)); // Status Email Type woocommerce_wp_select(array('id' => '_email_type', 'label' => __('Type', WC_Order_Status_Manager::TEXT_DOMAIN), 'options' => $this->email_types, 'desc_tip' => true, 'description' => __("A customer email is dispatched to the order's customer, and admin email is sent to the store admin (you can define individual recipient's).", WC_Order_Status_Manager::TEXT_DOMAIN))); // Status Email Description woocommerce_wp_textarea_input(array('id' => 'post_excerpt', 'label' => __('Description', WC_Order_Status_Manager::TEXT_DOMAIN), 'desc_tip' => true, 'description' => __('Optional email description. This is for informational purposes only.', WC_Order_Status_Manager::TEXT_DOMAIN), 'value' => htmlspecialchars_decode($post->post_excerpt, ENT_QUOTES))); // Status Email Dispatch conditions // TODO: Should we prefix 'any' with an underscore, or somehow reserve it? $status_options = array('any' => __('Any', WC_Order_Status_Manager::TEXT_DOMAIN)); foreach (wc_get_order_statuses() as $slug => $name) { $status_options[str_replace('wc-', '', $slug)] = $name; } $conditions = get_post_meta($post->ID, '_email_dispatch_condition'); // Parse existing condition parts if (!empty($conditions)) { foreach ($conditions as $key => $condition) { $parts = explode('_to_', $condition); $conditions[$key] = array('from' => $parts[0], 'to' => $parts[1]); } } ?> <fieldset class="form-field dispatch_field"> <label for="_email_dispatch_condition"><?php _e('When to dispatch', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </label> <table class="dispatch_conditions"> <thead <?php if (empty($conditions)) { ?> style="display:none;"<?php } ?> > <tr> <th><?php _e('From Status', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </th> <th colspan="2"><?php _e('To Status', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </th> </tr> </thead> <tbody <?php if (empty($conditions)) { ?> style="display:none;"<?php } ?> > <?php if (!empty($conditions)) { foreach ($conditions as $key => $condition) { ?> <tr class="condition"> <td> <select name="_email_dispatch_condition[<?php echo $key; ?> ][from]"> <?php foreach ($status_options as $slug => $name) { ?> <option value="<?php echo esc_attr($slug); ?> " <?php selected($slug, $condition['from']); ?> ><?php echo esc_html($name); ?> </option> <?php } ?> </select> </td> <td> <select name="_email_dispatch_condition[<?php echo $key; ?> ][to]"> <?php foreach ($status_options as $slug => $name) { ?> <option value="<?php echo esc_attr($slug); ?> " <?php selected($slug, $condition['to']); ?> ><?php echo esc_html($name); ?> </option> <?php } ?> </select> </td> <td> <button type="button" class="button remove-condition"><?php _e('Remove', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </button> </td> </tr> <?php } } ?> </tbody> <tfoot> <td colspan="3"> <button type="button" class="button add-condition"><?php _e('Add Condition', WC_Order_Status_Manager::TEXT_DOMAIN); ?> </button> </td> </tfoot> </table> </fieldset> </div><!-- // .options_group --> </div><!-- // .woocommerce_options_panel --> <?php }
function meta_box_advanced() { global $woocommerce, $post; woocommerce_wp_textarea_input(array('id' => 'wpl_amazon_product_description', 'label' => __('Custom Product Description', 'wpla'), 'placeholder' => 'Leave this empty to use the default description.', 'value' => get_post_meta($post->ID, '_amazon_product_description', true))); woocommerce_wp_text_input(array('id' => 'wpl_amazon_asin', 'label' => __('ASIN', 'wpla'), 'placeholder' => 'ASIN', 'description' => 'Do not change this unless you know what you are doing.', 'value' => get_post_meta($post->ID, '_wpla_asin', true))); // $tb_url = 'admin-ajax.php?action=wpla_show_product_matches&id='.$post->ID.'&width=640&height=420'; // echo '<a href="'.$tb_url.'" class="thickbox" title="Match product on Amazon"><img src="'.WPLA_URL.'/img/search3.png" alt="match" /></a>'; }
/** * 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"> — <?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…', '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…', '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"> </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> </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…', '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…', '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…', '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 }
function meta_box_advanced() { global $post; ?> <style type="text/css"> #wplister-ebay-advanced label { float: left; width: 33%; line-height: 2em; } #wplister-ebay-advanced input, #wplister-ebay-advanced select.select { width: 62%; } #wplister-ebay-advanced input.checkbox { width:auto; } #wplister-ebay-advanced input.input_specs, #wplister-ebay-advanced input.select_specs { width:100%; } #wplister-ebay-advanced .description { clear: both; margin-left: 33%; } #wplister-ebay-advanced .wpl_ebay_hide_from_unlisted_field .description, #wplister-ebay-advanced .wpl_ebay_bestoffer_enabled_field .description { margin-left: 0.3em; height: 1.4em; display: inline-block; vertical-align: bottom; } </style> <?php do_action('wple_before_advanced_ebay_options'); woocommerce_wp_text_input(array('id' => 'wpl_ebay_buynow_price', 'label' => __('Buy Now Price', 'wplister'), 'placeholder' => __('Buy Now Price', 'wplister'), 'description' => __('The optional Buy Now Price is only used for auction style listings. It has no effect on fixed price listings.', 'wplister'), 'desc_tip' => true, 'class' => 'wc_input_price', 'value' => get_post_meta($post->ID, '_ebay_buynow_price', true))); woocommerce_wp_text_input(array('id' => 'wpl_ebay_reserve_price', 'label' => __('Reserve Price', 'wplister'), 'placeholder' => __('Reserve Price', 'wplister'), 'description' => __('The lowest price at which you are willing to sell the item. Not all categories support a reserve price.<br>Note: This only applies to auction style listings.', 'wplister'), 'desc_tip' => true, 'class' => 'wc_input_price', 'value' => get_post_meta($post->ID, '_ebay_reserve_price', true))); woocommerce_wp_text_input(array('id' => 'wpl_ebay_gallery_image_url', 'label' => __('Gallery Image URL', 'wplister'), 'placeholder' => __('Enter an URL if you want to use a custom gallery image on eBay.', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_gallery_image_url', true))); woocommerce_wp_checkbox(array('id' => 'wpl_ebay_global_shipping', 'label' => __('Global Shipping', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_global_shipping', true))); woocommerce_wp_checkbox(array('id' => 'wpl_ebay_hide_from_unlisted', 'label' => __('Hide from eBay', 'wplister'), 'description' => __('Hide this product from the list of products currently not listed on eBay.', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_hide_from_unlisted', true))); woocommerce_wp_checkbox(array('id' => 'wpl_ebay_bestoffer_enabled', 'label' => __('Best Offer', 'wplister'), 'description' => __('Enable Best Offer to allow a buyer to make a lower-priced binding offer.', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_bestoffer_enabled', true))); woocommerce_wp_text_input(array('id' => 'wpl_ebay_bo_autoaccept_price', 'label' => __('Auto accept price', 'wplister'), 'placeholder' => __('The price at which Best Offers are automatically accepted.', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_bo_autoaccept_price', true))); woocommerce_wp_text_input(array('id' => 'wpl_ebay_bo_minimum_price', 'label' => __('Minimum price', 'wplister'), 'placeholder' => __('Specifies the minimum acceptable Best Offer price.', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_bo_minimum_price', true))); // get listing object $listing = $this->get_current_ebay_item(); $wpl_account_id = $listing && $listing->account_id ? $listing->account_id : get_option('wplister_default_account_id'); $wpl_site_id = $listing ? $listing->site_id : get_option('wplister_ebay_site_id'); // get available seller profiles $wpl_seller_profiles_enabled = get_option('wplister_ebay_seller_profiles_enabled'); $wpl_seller_shipping_profiles = get_option('wplister_ebay_seller_shipping_profiles'); $wpl_seller_payment_profiles = get_option('wplister_ebay_seller_payment_profiles'); $wpl_seller_return_profiles = get_option('wplister_ebay_seller_return_profiles'); if (isset(WPLE()->accounts[$wpl_account_id])) { $account = WPLE()->accounts[$wpl_account_id]; $wpl_seller_profiles_enabled = $account->seller_profiles; $wpl_seller_shipping_profiles = maybe_unserialize($account->shipping_profiles); $wpl_seller_payment_profiles = maybe_unserialize($account->payment_profiles); $wpl_seller_return_profiles = maybe_unserialize($account->return_profiles); } // $wpl_seller_profiles_enabled = get_option('wplister_ebay_seller_profiles_enabled'); if ($wpl_seller_profiles_enabled) { // $wpl_seller_shipping_profiles = get_option('wplister_ebay_seller_shipping_profiles'); // $wpl_seller_payment_profiles = get_option('wplister_ebay_seller_payment_profiles'); // $wpl_seller_return_profiles = get_option('wplister_ebay_seller_return_profiles'); // echo "<pre>";print_r($wpl_seller_payment_profiles);echo"</pre>";#die(); if (is_array($wpl_seller_payment_profiles)) { $seller_payment_profiles = array('' => __('-- use profile setting --', 'wplister')); foreach ($wpl_seller_payment_profiles as $seller_profile) { $seller_payment_profiles[$seller_profile->ProfileID] = $seller_profile->ProfileName . ' - ' . $seller_profile->ShortSummary; } woocommerce_wp_select(array('id' => 'wpl_ebay_seller_payment_profile_id', 'label' => __('Payment policy', 'wplister'), 'options' => $seller_payment_profiles, 'value' => get_post_meta($post->ID, '_ebay_seller_payment_profile_id', true))); } if (is_array($wpl_seller_return_profiles)) { $seller_return_profiles = array('' => __('-- use profile setting --', 'wplister')); foreach ($wpl_seller_return_profiles as $seller_profile) { $seller_return_profiles[$seller_profile->ProfileID] = $seller_profile->ProfileName . ' - ' . $seller_profile->ShortSummary; } woocommerce_wp_select(array('id' => 'wpl_ebay_seller_return_profile_id', 'label' => __('Return policy', 'wplister'), 'options' => $seller_return_profiles, 'value' => get_post_meta($post->ID, '_ebay_seller_return_profile_id', true))); } } woocommerce_wp_textarea_input(array('id' => 'wpl_ebay_payment_instructions', 'label' => __('Payment Instructions', 'wplister'), 'value' => get_post_meta($post->ID, '_ebay_payment_instructions', true))); // $this->showCategoryOptions(); // $this->showItemSpecifics(); // $this->showCompatibilityTable(); // WPL_WooFrontEndIntegration::showCompatibilityList(); if (get_option('wplister_external_products_inventory') == 1) { $this->enabledInventoryOnExternalProducts(); } // woocommerce_wp_checkbox( array( 'id' => 'wpl_update_ebay_on_save', 'wrapper_class' => 'update_ebay', 'label' => __('Update on save?', 'wplister') ) ); do_action('wple_after_advanced_ebay_options'); }
/** * Add entry content to Product Settings. */ public function action_product_write_panels() { global $thepostid, $post; if (!$thepostid) { $thepostid = $post->ID; } ?> <script type="text/javascript"> jQuery( document ).ready( function () { var e = jQuery( '#bulkdiscount_product_data' ); <?php for ($i = 1; $i <= 6; $i++) { ?> e.find( '.block<?php echo $i; ?> ' ).hide(); e.find( '.options_group<?php echo max($i, 2); ?> ' ).hide(); e.find( '#add_discount_line<?php echo max($i, 2); ?> ' ).hide(); e.find( '#add_discount_line<?php echo $i; ?> ' ).click( function () { if ( <?php echo $i; ?> == 1 || ( e.find( '#_bulkdiscount_quantity_<?php echo max($i - 1, 1); ?> ' ).val() != '' && <?php if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { ?> e.find( '#_bulkdiscount_discount_flat_<?php echo max($i - 1, 1); ?> ' ).val() != '' <?php } else { ?> e.find( '#_bulkdiscount_discount_<?php echo max($i - 1, 1); ?> ' ).val() != '' <?php } ?> ) ) { e.find( '.block<?php echo $i; ?> ' ).show( 400 ); e.find( '.options_group<?php echo min($i + 1, 6); ?> ' ).show( 400 ); e.find( '#add_discount_line<?php echo min($i + 1, 5); ?> ' ).show( 400 ); e.find( '#add_discount_line<?php echo $i; ?> ' ).hide( 400 ); e.find( '#delete_discount_line<?php echo min($i + 1, 6); ?> ' ).show( 400 ); e.find( '#delete_discount_line<?php echo $i; ?> ' ).hide( 400 ); } else { alert( '<?php _e('Please fill in the current line before adding new line.', 'wc_bulk_discount'); ?> ' ); } } ); e.find( '#delete_discount_line<?php echo max($i, 1); ?> ' ).hide(); e.find( '#delete_discount_line<?php echo $i; ?> ' ).click( function () { e.find( '.block<?php echo max($i - 1, 1); ?> ' ).hide( 400 ); e.find( '.options_group<?php echo min($i, 6); ?> ' ).hide( 400 ); e.find( '#add_discount_line<?php echo min($i, 5); ?> ' ).hide( 400 ); e.find( '#add_discount_line<?php echo max($i - 1, 1); ?> ' ).show( 400 ); e.find( '#delete_discount_line<?php echo min($i, 6); ?> ' ).hide( 400 ); e.find( '#delete_discount_line<?php echo max($i - 1, 2); ?> ' ).show( 400 ); e.find( '#_bulkdiscount_quantity_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { ?> e.find( '#_bulkdiscount_discount_flat_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php } else { ?> e.find( '#_bulkdiscount_discount_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php } ?> } ); <?php } for ($i = 1, $j = 2; $i <= 5; $i++, $j++) { $cnt = 1; if (get_post_meta($thepostid, "_bulkdiscount_quantity_{$i}", true) || get_post_meta($thepostid, "_bulkdiscount_quantity_{$j}", true)) { ?> e.find( '.block<?php echo $i; ?> ' ).show(); e.find( '.options_group<?php echo $i; ?> ' ).show(); e.find( '#add_discount_line<?php echo $i; ?> ' ).hide(); e.find( '#delete_discount_line<?php echo $i; ?> ' ).hide(); e.find( '.options_group<?php echo min($i + 1, 6); ?> ' ).show(); e.find( '#add_discount_line<?php echo min($i + 1, 6); ?> ' ).show(); e.find( '#delete_discount_line<?php echo min($i + 1, 6); ?> ' ).show(); <?php $cnt++; } } if ($cnt >= 6) { ?> e.find( '#add_discount_line6' ).show(); <?php } ?> } ); </script> <div id="bulkdiscount_product_data" class="panel woocommerce_options_panel"> <div class="options_group"> <?php woocommerce_wp_checkbox(array('id' => '_bulkdiscount_enabled', 'value' => get_post_meta($thepostid, '_bulkdiscount_enabled', true) ? get_post_meta($thepostid, '_bulkdiscount_enabled', true) : 'yes', 'label' => __('Bulk Discount enabled', 'wc_bulk_discount'))); woocommerce_wp_textarea_input(array('id' => "_bulkdiscount_text_info", 'label' => __('Bulk discount special offer text in product description', 'wc_bulk_discount'), 'description' => __('Optionally enter bulk discount information that will be visible on the product page.', 'wc_bulk_discount'), 'desc_tip' => 'yes', 'class' => 'fullWidth')); ?> </div> <?php for ($i = 1; $i <= 5; $i++) { ?> <div class="options_group<?php echo $i; ?> "> <a id="add_discount_line<?php echo $i; ?> " class="button-secondary" href="#block<?php echo $i; ?> "><?php _e('Add discount line', 'wc_bulk_discount'); ?> </a> <a id="delete_discount_line<?php echo $i; ?> " class="button-secondary" href="#block<?php echo $i; ?> "><?php _e('Remove last discount line', 'wc_bulk_discount'); ?> </a> <div class="block<?php echo $i; ?> <?php echo $i % 2 == 0 ? 'even' : 'odd'; ?> "> <?php woocommerce_wp_text_input(array('id' => "_bulkdiscount_quantity_{$i}", 'label' => __('Quantity (min.)', 'wc_bulk_discount'), 'type' => 'number', 'description' => __('Enter the minimal quantity for which the discount applies.', 'wc_bulk_discount'), 'custom_attributes' => array('step' => '1', 'min' => '1'))); if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { woocommerce_wp_text_input(array('id' => "_bulkdiscount_discount_flat_{$i}", 'type' => 'number', 'label' => sprintf(__('Discount (%s)', 'wc_bulk_discount'), get_woocommerce_currency_symbol()), 'description' => sprintf(__('Enter the flat discount in %s.', 'wc_bulk_discount'), get_woocommerce_currency_symbol()), 'custom_attributes' => array('step' => 'any', 'min' => '0'))); } else { woocommerce_wp_text_input(array('id' => "_bulkdiscount_discount_{$i}", 'type' => 'number', 'label' => __('Discount (%)', 'wc_bulk_discount'), 'description' => __('Enter the discount in percents (Allowed values: 0 to 100).', 'wc_bulk_discount'), 'custom_attributes' => array('step' => 'any', 'min' => '0', 'max' => '100'))); } ?> </div> </div> <?php } ?> <div class="options_group6"> <a id="delete_discount_line6" class="button-secondary" href="#block6"><?php _e('Remove last discount line', 'wc_bulk_discount'); ?> </a> </div> <br/> </div> <?php }
<div id="advanced_product_data" class="panel woocommerce_options_panel hidden"> <div class="options_group hide_if_external"> <?php woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'value' => $product_object->get_purchase_note('edit'), '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 woocommerce_wp_text_input(array('id' => 'menu_order', 'value' => $product_object->get_menu_order('edit'), 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => true, 'description' => __('Custom ordering position.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1'))); ?> </div> <div class="options_group reviews"> <?php woocommerce_wp_checkbox(array('id' => '_reviews_allowed', 'value' => $product_object->get_reviews_allowed('edit') ? 'open' : 'closed', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open')); do_action('woocommerce_product_options_reviews'); ?> </div> <?php do_action('woocommerce_product_options_advanced'); ?> </div>
/** * Creates the Giftcard Meta Box in the admin control panel when in the Giftcard Post Type. Allows you to create a giftcard manually. * @param [type] $post * @return [type] */ public function rpgc_meta_box($post) { global $woocommerce; wp_nonce_field('woocommerce_save_data', 'woocommerce_giftcard_nonce'); $giftValue = get_post_meta($post->ID, '_wpr_giftcard', true); ?> <style type="text/css"> #edit-slug-box, #minor-publishing-actions { display:none } .form-field input, .form-field textarea { width:100%;} input[type="checkbox"], input[type="radio"] { float: left; width:16px;} </style> <div id="giftcard_options" class="panel woocommerce_options_panel"> <?php do_action('rpgc_woocommerce_options_before_sender'); // Description woocommerce_wp_textarea_input(array('id' => 'rpgc_description', 'label' => __('Gift Card description', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Optionally enter a description for this gift card for your reference.', 'rpgiftcards'), 'value' => isset($giftValue['description']) ? $giftValue['description'] : '')); do_action('rpgc_woocommerce_options_after_description'); echo '<h2>' . __('Who are you sending this to?', 'rpgiftcards') . '</h2>'; // To woocommerce_wp_text_input(array('id' => 'rpgc_to', 'label' => __('To', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Who is getting this gift card.', 'rpgiftcards'), 'value' => isset($giftValue['to']) ? $giftValue['to'] : '')); // To Email woocommerce_wp_text_input(array('id' => 'rpgc_email_to', 'type' => 'email', 'label' => __('Email To', 'rpgiftcards'), 'placeholder' => '', 'description' => __('What email should we send this gift card to.', 'rpgiftcards'), 'value' => isset($giftValue['toEmail']) ? $giftValue['toEmail'] : '')); // From woocommerce_wp_text_input(array('id' => 'rpgc_from', 'label' => __('From', 'rpgiftcards'), 'placeholder' => '', 'description' => __('Who is sending this gift card.', 'rpgiftcards'), 'value' => isset($giftValue['from']) ? $giftValue['from'] : '')); // From Email woocommerce_wp_text_input(array('id' => 'rpgc_email_from', 'type' => 'email', 'label' => __('Email From', 'rpgiftcards'), 'placeholder' => '', 'description' => __('What email account is sending this gift card.', 'rpgiftcards'), 'value' => isset($giftValue['fromEmail']) ? $giftValue['fromEmail'] : '')); do_action('rpgc_woocommerce_options_after_sender'); echo '</div><div class="panel woocommerce_options_panel">'; echo '<h2>' . __('Personalize it', 'rpgiftcards') . '</h2>'; do_action('rpgc_woocommerce_options_before_personalize'); // Amount woocommerce_wp_text_input(array('id' => 'rpgc_amount', 'label' => __('Gift Card Amount', 'rpgiftcards'), 'placeholder' => '0.00', 'description' => __('Value of the Gift Card.', 'rpgiftcards'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'), 'value' => isset($giftValue['amount']) ? $giftValue['amount'] : '')); if (isset($_GET['action'])) { if ($_GET['action'] == 'edit') { // Remaining Balance woocommerce_wp_text_input(array('id' => 'rpgc_balance', 'label' => __('Gift Card Balance', 'rpgiftcards'), 'placeholder' => '0.00', 'description' => __('Remaining Balance of the Gift Card.', 'rpgiftcards'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'), 'value' => isset($giftValue['balance']) ? $giftValue['balance'] : '')); } } // Notes woocommerce_wp_textarea_input(array('id' => 'rpgc_note', 'label' => __('Gift Card Note', 'rpgiftcards'), 'description' => __('Enter a message to your customer.', 'rpgiftcards'), 'class' => 'short', 'value' => isset($giftValue['note']) ? $giftValue['note'] : '')); // Expiry date woocommerce_wp_text_input(array('id' => 'rpgc_expiry_date', 'label' => __('Expiry date', 'rpgiftcards'), 'placeholder' => _x('Never expire', 'placeholder', 'rpgiftcards'), 'description' => __('The date this Gift Card will expire, <code>YYYY-MM-DD</code>.', 'rpgiftcards'), 'class' => 'date-picker short', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])"), 'value' => isset($giftValue['expiry_date']) ? $giftValue['expiry_date'] : '')); do_action('rpgc_woocommerce_options_after_personalize'); echo '</div>'; }
<div class="wt-faqcontent"> <div class="options_group wt-publicfield"> <?php woocommerce_wp_checkbox(array('id' => $public_perfix . 'tab_enabled', 'label' => __('Enable Custom Tab?', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enable this option to display the custom tab on the frontend.', EXTRA_WOO_TABS_TEXTDOMAN), 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_enabled'], 'cbvalue' => 'yes')); ?> <?php woocommerce_wp_text_input(array('id' => $public_perfix . 'tab_title', 'label' => __('Custom Tab Title', EXTRA_WOO_TABS_TEXTDOMAN), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter your custom tab title.', EXTRA_WOO_TABS_TEXTDOMAN), 'value' => @$custom_tab_options['public_fields'][$public_perfix . 'tab_title'])); ?> <?php // Textarea woocommerce_wp_textarea_input(array('id' => $public_perfix . 'tab_description', 'label' => __('Text Content', EXTRA_WOO_TABS_TEXTDOMAN), 'placeholder' => __('Enter Content', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => '', 'value' => @$custom_tab_options['public_fields'][$public_perfix . 'tab_description'])); ?> <?php woocommerce_wp_checkbox(array('id' => $public_perfix . 'tab_sticky_enabled', 'label' => __('Enable Sticky Button?', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enable/Disable Sticky Button.', EXTRA_WOO_TABS_TEXTDOMAN))); ?> <?php // Select woocommerce_wp_select(array('id' => $public_perfix . 'tab_sticky_width', 'label' => __('Content Width', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enter Sticky Content Width.', EXTRA_WOO_TABS_TEXTDOMAN), 'desc_tip' => 'true', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_width'], 'options' => array('pw-content-1' => '2:3', 'pw-content-2' => '1:2', 'pw-content-3' => '1:3', 'pw-content-4' => '1:4', 'pw-content-full' => __('Full', EXTRA_WOO_TABS_TEXTDOMAN)))); $dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true'); dependency($public_perfix . 'tab_sticky_width', $dependency); ?> <?php // Number Field
/** * WooCommerce custom product tab data * * Adds the panel to the Product Data postbox in the product interface * * @package WooCommerce - PDF Vouchers * @since 1.0.0 */ public function woo_vou_product_write_panel() { $prefix = WOO_VOU_META_PREFIX; global $current_user, $woo_vou_vendor_role; $voucher_options = array('' => __('Please Select', 'woovoucher')); $voucher_data = $this->model->woo_vou_get_vouchers(); foreach ($voucher_data as $voucher) { if (isset($voucher['ID']) && !empty($voucher['ID'])) { // Check voucher id is not empty $voucher_options[$voucher['ID']] = $voucher['post_title']; } } $vendors_options = array('' => __('Please Select', 'woovoucher')); $vendors_data = get_users(); if (!empty($vendors_data)) { // Check vendor users are not empty foreach ($vendors_data as $vendors) { if (user_can($vendors->ID, 'woo_vendor_options')) { $vendors_options[$vendors->ID] = $vendors->display_name . ' (#' . $vendors->ID . ' – ' . sanitize_email($vendors->user_email) . ')'; } } } $based_on_purchase_opt = array('7' => '7 Days', '15' => '15 Days', '30' => '1 Month (30 Days)', '90' => '3 Months (90 Days)', '180' => '6 Months (180 Days)', '365' => '1 Year (365 Days)', 'cust' => 'Custom'); $using_type_opt = array('' => __('Default', 'woovoucher'), '0' => __('One time only', 'woovoucher'), '1' => __('Unlimited', 'woovoucher')); // Voucher Code Error $vou_codes_error_class = ' woo-vou-display-none '; $codes_error_msg = '<br/><span id="woo_vou_codes_error" class="woo-vou-codes-error ' . $vou_codes_error_class . '">' . __('Please enter atleast 1 voucher code.', 'woovoucher') . '</span>'; $days_error_msg = '<span id="woo_vou_days_error" class="woo-vou-days-error ' . $vou_codes_error_class . '">' . __(' Please enter valid days.', 'woovoucher') . '</span>'; $user_roles = isset($current_user->roles) ? $current_user->roles : array(); $user_role = array_shift($user_roles); $vendor_flag = false; if (!empty($user_role) && in_array($user_role, $woo_vou_vendor_role)) { // Check vendor user role $vendor_flag = true; } $vou_hide_vendor_options = get_option('vou_hide_vendor_options'); // display the custom tab panel echo '<div id="woo_vou_voucher" class="panel wc-metaboxes-wrapper woocommerce_options_panel">'; //Enable Voucher Code $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable', 'label' => __('Enable Voucher Codes:', 'woovoucher'), 'description' => __('To enable the Voucher for this Product check the "Enable Voucher Codes" check box.', 'woovoucher'))); //Recipient Name Detail $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_name', 'label' => __('Enable Recipient Name:', 'woovoucher'), 'description' => __('To enable the Recipient Name on product page', 'woovoucher'))); echo '<div class="recipient-detail-wrap">'; $this->woo_vou_add_text(array('id' => $prefix . 'recipient_name_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg)); $this->woo_vou_add_text(array('id' => $prefix . 'recipient_name_max_length', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Max Length:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg)); $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_name_is_required', 'label' => __('Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher'))); echo '</div>'; //Recipient Email Detail $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_email', 'label' => __('Enable Recipient Email:', 'woovoucher'), 'description' => __('To enable the Recipient Email on product page', 'woovoucher'))); echo '<div class="recipient-detail-wrap">'; $this->woo_vou_add_text(array('id' => $prefix . 'recipient_email_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg)); $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_email_is_required', 'label' => __('Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher'))); echo '</div>'; //Recipient Message Detail $this->woo_vou_add_checkbox(array('id' => $prefix . 'enable_recipient_message', 'label' => __('Enable Recipient Message:', 'woovoucher'), 'description' => __('To enable the Recipient Message on product page', 'woovoucher'))); echo '<div class="recipient-detail-wrap">'; $this->woo_vou_add_text(array('id' => $prefix . 'recipient_message_label', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Label:', 'woovoucher'), 'description' => __('', 'woovoucher'))); $this->woo_vou_add_text(array('id' => $prefix . 'recipient_message_max_length', 'class' => 'woo_vou_recipient_text', 'wrap_class' => 'woo_vou_recipient_details', 'label' => __('Max Length:', 'woovoucher'), 'description' => __('', 'woovoucher'))); $this->woo_vou_add_cust_checkbox(array('id' => $prefix . 'recipient_message_is_required', 'label' => __(' Required:', 'woovoucher'), 'description' => __('Make this field required in order to add a voucher product to the cart', 'woovoucher'))); echo '</div>'; // if user is vendor and hide options set if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') { } else { //PDF Template woocommerce_wp_select(array('id' => $prefix . 'pdf_template', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $voucher_options, 'label' => __('PDF Template:', 'woovoucher'), 'description' => __('Select a PDF template. This setting modifies the global PDF template setting and overrides vendor\'s PDF template value. Leave it empty to use the global/vendor settings.', 'woovoucher'))); } if ($vendor_flag == true) { // Check vendor user role woocommerce_wp_hidden_input(array('id' => $prefix . 'vendor_user', 'value' => $current_user->ID)); } else { //Vendor User woocommerce_wp_select(array('id' => $prefix . 'vendor_user', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $vendors_options, 'label' => __('Vendor User:'******'woovoucher'), 'description' => __('Please select the vendor user.', 'woovoucher'))); } if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') { } else { //voucher's type to use it woocommerce_wp_select(array('id' => $prefix . 'using_type', 'style' => 'min-width:200px;', 'class' => 'wc-enhanced-select', 'options' => $using_type_opt, 'label' => __('Usability:', 'woovoucher'), 'description' => sprintf(__('Choose how you wanted to use vouchers codes. %sif you set usability "%sone time only%s" then it will automatically set product quantity equal to number of voucher codes entered and it will automatically decrease quanity by 1 when it get purchased. if you set usability "%sunlimited%s" then plugin will automatically generate unique voucher codes when product purchased. %sThis setting modifies the global usability setting and overrides vendor\'s usability value. Leave it empty to use the global/vendor settings.', 'woovoucher'), '<br />', '<b>', '</b>', '<b>', '</b>', '<br />'))); } //voucher's code comma seprated woocommerce_wp_textarea_input(array('id' => $prefix . 'codes', 'label' => __('Voucher Codes:', 'woovoucher'), 'description' => __('If you have a list of Voucher Codes you can copy and paste them in to this option. Make sure, that they are comma separated.', 'woovoucher') . $codes_error_msg)); //import to csv field $this->woo_vou_add_importcsv(array('id' => $prefix . 'import_csv', 'btntext' => __('Generate / Import Codes', 'woovoucher'), 'label' => __('Generate / Import Codes:', 'woovoucher'), 'description' => __('Here you can import a csv file with voucher vodes or you can enter the prefix, pattern and extension will automatically create the voucher codes.', 'woovoucher'))); //purchased voucher codes field $this->woo_vou_add_purchasedvoucodes(array('id' => $prefix . 'purchased_codes', 'btntext' => __('Purchased Voucher Codes', 'woovoucher'), 'label' => __('Purchased Voucher Code:', 'woovoucher'), 'description' => __('Click on the button to see a list of all purchased voucher vodes.', 'woovoucher'))); //used voucher codes field $this->woo_vou_add_usedvoucodes(array('id' => $prefix . 'used_codes', 'btntext' => __('Used Voucher Codes', 'woovoucher'), 'label' => __('Used Voucher Code:', 'woovoucher'), 'description' => __('Click on the button to see a list of all used voucher vodes.', 'woovoucher'))); //voucher expiration date type $expdate_types = apply_filters('woo_vou_exp_date_types', array('specific_date' => __('Specific Time', 'woovoucher'), 'based_on_purchase' => __('Based on purchase', 'woovoucher'))); $this->woo_vou_add_radio(array('id' => $prefix . 'exp_type', 'options' => $expdate_types, 'default' => array('specific_date'), 'label' => __('Expiration Date Type:', 'woovoucher'), 'description' => __('Please select Expiration Date Type either specific time or set date based on purchased voucher date like After 7 days, 30 days, 1 year etc.', 'woovoucher'))); // $this->woo_vou_add_select(array('id' => $prefix . 'days_diff', 'style' => 'min-width:200px;', 'class' => '_woo_vou_days_diff wc-enhanced-select', 'options' => $based_on_purchase_opt, 'label' => __('Expiration Days:', 'woovoucher'), 'description' => __('', 'woovoucher'), 'sign' => __(' After purchase', 'woovoucher'))); //voucher expiration date custom days $this->woo_vou_add_custom_text(array('id' => $prefix . 'custom_days', 'class' => 'custom-days-text', 'label' => __('Custom Days:', 'woovoucher'), 'description' => __('', 'woovoucher') . $days_error_msg, 'sign' => __(' Days after purchase', 'woovoucher'))); //voucher start date time $this->woo_vou_add_datetime(array('id' => $prefix . 'start_date', 'label' => __('Start Date:', 'woovoucher'), 'std' => array(''), 'description' => __('If you want to make the Voucher Code(s) valid for a specific time only, you can enter an start date here.', 'woovoucher'), 'format' => 'dd-mm-yy')); //voucher expiration date time $this->woo_vou_add_datetime(array('id' => $prefix . 'exp_date', 'label' => __('Expiration Date:', 'woovoucher'), 'std' => array(''), 'description' => __('If you want to make the Voucher Code(s) valid for a specific time only, you can enter an expiration date here. If the Voucher Code never expires, then leave that option blank.', 'woovoucher'), 'format' => 'dd-mm-yy')); if ($vendor_flag == true && $vou_hide_vendor_options == 'yes') { } else { //add the vendor's logo $this->woo_vou_add_image(array('id' => $prefix . 'logo', 'label' => __('Vendor\'s Logo:', 'woovoucher'), 'description' => __('Allows you to upload a logo of the vendor for which this Voucher is valid. The logo will also be displayed on the PDF document. Leave it empty to use the vendor logo from the vendor settings.', 'woovoucher'))); //vendor's address woocommerce_wp_textarea_input(array('id' => $prefix . 'address_phone', 'label' => __('Vendor\'s Address:', 'woovoucher'), 'description' => __('Here you can enter the complete Vendor\'s address. This will be displayed on the PDF document sent to the customers so that they know where to redeem this Voucher. Limited HTML is allowed. Leave it empty to use address from the vendor settings.', 'woovoucher'))); //vendor's website woocommerce_wp_text_input(array('id' => $prefix . 'website', 'class' => 'woo_vou_siteurl_text', 'label' => __('Website URL:', 'woovoucher'), 'description' => __('Enter the Vendor\'s website URL here. This will be displayed on the PDF document sent to the customer. Leave it empty to use website URL from the vendor settings.', 'woovoucher'))); //using instructions of voucher woocommerce_wp_textarea_input(array('id' => $prefix . 'how_to_use', 'label' => __('Redeem Instructions:', 'woovoucher'), 'description' => __('Within this option you can enter instructions on how this Voucher can be redeemed. This instruction will then be displayed on the PDF document sent to the customer after successful purchase. Limited HTML is allowed. Leave it empty to use Redeem Instructions from the vendor settings.', 'woovoucher'))); //location fields $voucherlocations = array('0' => array('id' => $prefix . 'locations', 'class' => 'woo_vou_location', 'label' => __('Location:', 'woovoucher'), 'description' => __('Enter the address of the location where the Voucher Code can be redeemed. This will be displayed on the PDF document sent to the customer. Limited HTML is allowed.', 'woovoucher')), '1' => array('id' => $prefix . 'map_link', 'class' => 'woo_vou_location', 'label' => __('Location Map Link:', 'woovoucher'), 'description' => __('Enter a link to a Google Map for the location here. This will be displayed on the PDF document sent to the customer.', 'woovoucher'))); //locations for voucher block is available $this->woo_vou_add_repeater_block(array('id' => $prefix . 'avail_locations', 'label' => __('Locations:', 'woovoucher'), 'description' => __('If the Vendor of the Voucher has more than one location where the Voucher can be redeemed, then you can add all the locations within this option. Leave it empty to use locations from the vendor settings.', 'woovoucher'), 'fields' => $voucherlocations)); } echo '</div>'; }
/** * Product writepanel for Subscriptions. * * @return void */ public static function product_write_panel() { global $post; $subscription_schemes = get_post_meta($post->ID, '_wcsatt_schemes', true); ?> <div id="wcsatt_data" class="panel woocommerce_options_panel wc-metaboxes-wrapper"> <div class="options_group"><?php // Subscription Status. woocommerce_wp_checkbox(array('id' => '_wcsatt_force_subscription', 'label' => __('Force subscription', WCS_ATT::TEXT_DOMAIN), 'desc_tip' => true, 'description' => __('Check this option to prevent one-time purchases of this product. In effect when at least one Subscription Option has been added below.', WCS_ATT::TEXT_DOMAIN))); // Default Status. woocommerce_wp_select(array('id' => '_wcsatt_default_status', 'wrapper_class' => 'wcsatt_default_status', 'label' => __('Default to', WCS_ATT::TEXT_DOMAIN), 'description' => '', 'options' => array('one-time' => __('One-time purchase', WCS_ATT::TEXT_DOMAIN), 'subscription' => __('Subscription', WCS_ATT::TEXT_DOMAIN)))); // Subscription Prompt. woocommerce_wp_textarea_input(array('id' => '_wcsatt_subscription_prompt', 'label' => __('Subscription prompt', WCS_ATT::TEXT_DOMAIN), 'description' => __('Custom html/text to display before the available Subscription Options. In effect when at least one Subscription Option has been added below.', WCS_ATT::TEXT_DOMAIN), 'desc_tip' => true)); ?> </div> <p class="form-field"> <label> <?php echo __('Subscription Options', WCS_ATT::TEXT_DOMAIN); echo WCS_ATT_Core_Compatibility::wc_help_tip(__('Add one or more subscription options for this product.', WCS_ATT::TEXT_DOMAIN)); ?> </label></p> <div class="subscription_schemes wc-metaboxes ui-sortable" data-count=""><?php if ($subscription_schemes) { $i = 0; foreach ($subscription_schemes as $subscription_scheme) { do_action('wcsatt_subscription_scheme', $i, $subscription_scheme, $post->ID); $i++; } } ?> </div> <p class="toolbar"> <button type="button" class="button button-primary add_subscription_scheme"><?php _e('Add Option', WCS_ATT::TEXT_DOMAIN); ?> </button> </p> </div><?php }
/** * Freshdesk tab panel. * * @since 1.0.0 * * @return string Tab panel content. */ public function product_panel() { global $post; // Forum category data. $forum = get_post_meta($post->ID, '_forum_category', true); $forum_enable = isset($forum['enable']) ? $forum['enable'] : ''; $forum_title = isset($forum['title']) ? $forum['title'] : $post->post_title; $forum_description = isset($forum['description']) ? $forum['description'] : ''; $forum_id = get_post_meta($post->ID, '_forum_category_id', true); // Solutions category data. $solutions = get_post_meta($post->ID, '_solutions_category', true); $solutions_enable = isset($solutions['enable']) ? $solutions['enable'] : ''; $solutions_title = isset($solutions['title']) ? $solutions['title'] : $post->post_title; $solutions_description = isset($solutions['description']) ? $solutions['description'] : ''; $solutions_id = get_post_meta($post->ID, '_solutions_category_id', true); wp_nonce_field(basename(__FILE__), 'woocommerce_freshdesk_nonce'); echo '<div id="freshdesk_product_data" class="panel woocommerce_options_panel">'; if ('sprout' != $this->plan) { echo '<div class="options_group">'; echo '<h4>' . __('Forum Category', 'woocommerce-freshdesk') . '</h4>'; if ('yes' != $forum_enable) { woocommerce_wp_select(array('id' => '_forum_category', 'label' => __('Add/get Category', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'desc_tip' => 'true', 'description' => __('Create or synchronize a Freshdesk Forum Category.', 'woocommerce-freshdesk'), 'options' => array('' => __('Select an option…', 'woocommerce-freshdesk'), 'create' => __('Create', 'woocommerce-freshdesk'), 'sync' => __('Synchronize', 'woocommerce-freshdesk')))); woocommerce_wp_text_input(array('id' => '_forum_category_id', 'label' => __('Category ID', 'woocommerce-freshdesk'), 'value' => esc_attr($forum_id), 'desc_tip' => 'true', 'description' => __('Enter the Forum Category ID to synchronize.', 'woocommerce-freshdesk'))); } else { echo '<p class="category-id">' . __('Forum Category ID:', 'woocommerce-freshdesk') . ' <code>' . esc_attr($forum_id) . '</code></p>'; woocommerce_wp_hidden_input(array('id' => '_forum_category_enable', 'value' => sanitize_text_field($forum_enable))); woocommerce_wp_checkbox(array('id' => '_forum_category_delete', 'label' => __('Remove Relationship?', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'description' => __('This option remove the synchronization with this Forum Category and your Freshdesk.', 'woocommerce-freshdesk'))); } woocommerce_wp_text_input(array('id' => '_forum_category_title', 'label' => __('Category Title', 'woocommerce-freshdesk'), 'value' => sanitize_text_field($forum_title), 'desc_tip' => 'true', 'description' => __('Enter with the Forum Category title.', 'woocommerce-freshdesk'))); woocommerce_wp_textarea_input(array('id' => '_forum_category_description', 'label' => __('Category Description', 'woocommerce-freshdesk'), 'value' => esc_attr($forum_description), 'desc_tip' => 'true', 'description' => __('Enter with the Forum Category description.', 'woocommerce-freshdesk'))); echo '</div>'; } echo '<div class="options_group">'; echo '<h4>' . __('Solution Category', 'woocommerce-freshdesk') . '</h4>'; if ('yes' != $solutions_enable) { woocommerce_wp_select(array('id' => '_solutions_category', 'label' => __('Add/get Category', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'desc_tip' => 'true', 'description' => __('Create or synchronize a Freshdesk Solutions Category.', 'woocommerce-freshdesk'), 'options' => array('' => __('Select an option…', 'woocommerce-freshdesk'), 'create' => __('Create', 'woocommerce-freshdesk'), 'sync' => __('Synchronize', 'woocommerce-freshdesk')))); woocommerce_wp_text_input(array('id' => '_solutions_category_id', 'label' => __('Category ID', 'woocommerce-freshdesk'), 'value' => esc_attr($solutions_id), 'desc_tip' => 'true', 'description' => __('Enter the Solutions Category ID to synchronize.', 'woocommerce-freshdesk'))); } else { echo '<p class="category-id">' . __('Solution Category ID:', 'woocommerce-freshdesk') . ' <code>' . esc_attr($solutions_id) . '</code></p>'; woocommerce_wp_hidden_input(array('id' => '_solutions_category_enable', 'value' => sanitize_text_field($solutions_enable))); woocommerce_wp_checkbox(array('id' => '_solutions_category_delete', 'label' => __('Remove Relationship?', 'woocommerce-freshdesk'), 'cbvalue' => 'yes', 'value' => '', 'description' => __('This option remove the synchronization with this Solutions Category and your Freshdesk.', 'woocommerce-freshdesk'))); } woocommerce_wp_text_input(array('id' => '_solutions_category_title', 'label' => __('Category Title', 'woocommerce-freshdesk'), 'value' => sanitize_text_field($solutions_title), 'desc_tip' => 'true', 'description' => __('Enter with the Solutions Category title.', 'woocommerce-freshdesk'))); woocommerce_wp_textarea_input(array('id' => '_solutions_category_description', 'label' => __('Category Description', 'woocommerce-freshdesk'), 'value' => esc_attr($solutions_description), 'desc_tip' => 'true', 'description' => __('Enter with the Solutions Category description.', 'woocommerce-freshdesk'))); echo '</div>'; echo '</div>'; }
/** * Displays the fields for the new tab panel. * * @since 0.0.1 * @access public * @uses woocommerce_wp_checkbox() * @uses woocommerce_wp_text_input() * @uses woocommerce_wp_select() * @uses ss_wc_wp_select() */ function ss_wc_write_digital_details_tab_panel() { echo '<div id="digital_details_product_data" class="panel woocommerce_options_panel">'; do_action('ss_wc_digital_details_options_top'); echo '<div class="options_group">'; // What licence woocommerce_wp_text_input(array('id' => '_licence', 'label' => __('Licence', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Enter the licence that is associated with this file.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 300px;')); // File Size woocommerce_wp_text_input(array('id' => '_file_size', 'label' => __('File Size', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Enter the size of the file. e.g. 1 KB, 1 MB or 1 GB', 'ss-wc-digital-details'), 'placeholder' => __('1.5 MB', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 150px;')); echo '</div>'; echo '<div class="options_group">'; // Is Web Font? woocommerce_wp_checkbox(array('id' => '_is_web_font', 'label' => __('Web Font?', 'ss-wc-digital-details'), 'description' => __('Enable if this file is a Web Font.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; echo '<div class="options_group">'; // Is Tileable? woocommerce_wp_checkbox(array('id' => '_is_tileable', 'label' => __('Tileable?', 'ss-wc-digital-details'), 'description' => __('Enable if this file is Tileable.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Layered? woocommerce_wp_checkbox(array('id' => '_is_layered', 'label' => __('Layered?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has Layers.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Vector? woocommerce_wp_checkbox(array('id' => '_is_vector', 'label' => __('Vector Formatted?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a Vector format.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; echo '<div class="options_group">'; // Is Fluid Layout? woocommerce_wp_checkbox(array('id' => '_is_fluid_layout', 'label' => __('Fluid Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a fluid layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Fixed Layout? woocommerce_wp_checkbox(array('id' => '_is_fixed_layout', 'label' => __('Fixed Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a fixed layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Responsive Layout? woocommerce_wp_checkbox(array('id' => '_is_responsive_layout', 'label' => __('Responsive Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a responsive layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Columns woocommerce_wp_text_input(array('id' => '_columns', 'label' => __('Columns', 'ss-wc-digital-details'), 'placeholder' => '12', 'desc_tip' => true, 'description' => __('Enter the amount of columns this theme has.', 'ss-wc-digital-details'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '1'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 60px;')); // Minimum Browser Requirement // @filter ss_wc_digital_details_min_browser_options ss_wc_wp_select(array('id' => '_minimum_browser_requirement', 'label' => __('Minimum Browser', 'ss-wc-digital-details'), 'type' => 'multiselect', 'options' => apply_filters('ss_wc_digital_details_min_browser_options', array('' => '', 'ie9' => __('IE 9+', 'ss-wc-digital-details'), 'firefox_14' => __('Firefox 14+', 'ss-wc-digital-details'), 'chrome_19' => __('Chrome 19+', 'ss-wc-digital-details'), 'safari_5' => __('Safari 5.1+', 'ss-wc-digital-details'), 'opera_12' => __('Opera 12+', 'ss-wc-digital-details'))), 'default' => '', 'wrapper_class' => 'hide_if_variable', 'placeholder' => __('Select the browsers this theme works in.', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'min-width: 350px;')); echo '</div>'; echo '<div class="options_group">'; // Dimensions woocommerce_wp_textarea_input(array('id' => '_dimensions', 'label' => __('Dimensions', 'ss-wc-digital-details'), 'placeholder' => sprintf(__('Enter the dimensions of the digital item by "%s" seperating the values.', 'ss-wc-digital-details'), WC_DELIMITER), 'desc_tip' => true, 'description' => __('e.g. 8.5 x 11 in', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Orientation ss_wc_wp_select(array('id' => '_orientation', 'label' => __('Orientation', 'ss-wc-digital-details'), 'options' => array('' => '', 'landscape' => __('Landscape', 'ss-wc-digital-details'), 'portrait' => __('Portrait', 'ss-wc-digital-details'), 'square' => __('Square', 'ss-wc-digital-details')), 'default' => '', 'wrapper_class' => 'show_if_photo', 'placeholder' => __('Select the orientation of this photo.', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'width: 300px;')); // DPI Size woocommerce_wp_text_input(array('id' => '_dpi_size', 'label' => __('DPI Size', 'ss-wc-digital-details'), 'placeholder' => '72', 'desc_tip' => true, 'description' => __('Enter the DPI size of the file.', 'ss-wc-digital-details'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '72'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 60px;')); echo '</div>'; echo '<div class="options_group">'; // Requirements // @filter ss_wc_digital_details_requirement_options ss_wc_wp_select(array('id' => '_requirements', 'label' => __('Requirements', 'ss-wc-digital-details'), 'type' => 'multiselect', 'options' => apply_filters('ss_wc_digital_details_requirement_options', array('' => '', 'adobe_cs1+' => 'Adobe CS1+', 'adobe_cs2+' => 'Adobe CS2+', 'adobe_cs3+' => 'Adobe CS3+', 'adobe_cs4+' => 'Adobe CS4+', 'adobe_cs5+' => 'Adobe CS5+', 'adobe_photoshop' => 'Adobe Photoshop', 'adobe_indesign' => 'Adobe InDesign', 'adobe_illustrator' => 'Adobe Illustrator', 'adobe_after_effcts' => 'Adobe After Effects')), 'default' => '', 'wrapper_class' => 'hide_if_variable', 'placeholder' => __('Select the requirements this file needs to edit', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'min-width: 350px;')); // Live Preview woocommerce_wp_text_input(array('id' => '_live_preview', 'label' => __('Live Preview', 'ss-wc-digital-details'), 'placeholder' => 'http://', 'desc_tip' => true, 'description' => __('Enter the URL address for the live preview of this item.', 'ss-wc-digital-details'), 'data_type' => 'url', 'wrapper_class' => 'hide_if_variable', 'style' => 'min-width: 350px;')); echo '</div>'; echo '<div class="options_group">'; // Message to Customers woocommerce_wp_textarea_input(array('id' => '_message_to_customers', 'label' => __('Message to Customers', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Leave a message for your customers. This will be displayed under the featured image.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; // Close group do_action('ss_wc_digital_details_options_bottom'); echo '</div>'; // Close product tab panel }
/** * Display the product data meta box. * * Displays the product data box, tabbed, with several panels covering price, stock etc. * * @access public * @return void */ function woocommerce_product_data_box() { global $post, $wpdb, $thepostid, $woocommerce; 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 = 'simple'; } $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate 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')), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce')))); foreach ($product_type_options as $key => $option) { $selected_value = get_post_meta($post->ID, '_' . $key, true); $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"> — <?php echo $type_box; ?> </span> <div class="wc-tabs-back"></div> <ul class="product_data_tabs wc-tabs" style="display:none;"> <li class="active general_options hide_if_grouped"><a href="#general_product_data"><?php _e('General', 'woocommerce'); ?> </a></li> <li class="inventory_tab show_if_simple show_if_variable show_if_grouped inventory_options"><a href="#inventory_product_data"><?php _e('Inventory', 'woocommerce'); ?> </a></li> <li class="shipping_tab hide_if_virtual shipping_options hide_if_grouped hide_if_external"><a href="#shipping_product_data"><?php _e('Shipping', 'woocommerce'); ?> </a></li> <li class="linked_product_tab linked_product_options"><a href="#linked_product_data"><?php _e('Linked Products', 'woocommerce'); ?> </a></li> <li class="attributes_tab attribute_options"><a href="#woocommerce_attributes"><?php _e('Attributes', 'woocommerce'); ?> </a></li> <li class="advanced_tab advanced_options"><a href="#advanced_product_data"><?php _e('Advanced', 'woocommerce'); ?> </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 (get_option('woocommerce_enable_sku', true) !== 'no') { 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', 'class' => 'wc_input_price short', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'))); // Special Price woocommerce_wp_text_input(array('id' => '_sale_price', 'class' => 'wc_input_price short', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>', 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'))); // 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="' . $sale_price_dates_from . '" placeholder="' . _x('From…', '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="' . $sale_price_dates_to . '" placeholder="' . _x('To…', '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">'; // File URL $file_paths = get_post_meta($post->ID, '_file_paths', true); if (is_array($file_paths)) { $file_paths = implode("\n", $file_paths); } echo '<p class="form-field"><label for="_file_paths">' . __('File paths (one per line)', 'woocommerce') . ':</label> <textarea style="float:left;height:5em;" id="_file_paths" class="short file_paths" cols="20" rows="3" placeholder="' . __('File paths/URLs, one per line', 'woocommerce') . '" name="_file_paths" wrap="off">' . esc_textarea($file_paths) . '</textarea> <input type="button" class="upload_file_button button" data-choose="' . __('Choose a file', 'woocommerce') . '" data-update="' . __('Insert file URL', 'woocommerce') . '" value="' . __('Choose a file', 'woocommerce') . '" /> </p>'; // 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'))); 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' => __('None', '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', '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>'; } 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>'; ?> </div> <div id="shipping_product_data" class="panel woocommerce_options_panel"> <?php echo '<div class="options_group">'; // Weight if (get_option('woocommerce_enable_weight', true) !== 'no') { woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => '0.00', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0'))); } else { echo '<input type="hidden" name="_weight" value="' . esc_attr(get_post_meta($thepostid, '_weight', true)) . '" />'; } // Size fields if (get_option('woocommerce_enable_dimensions', true) !== 'no') { ?> <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" size="6" type="number" name="_length" value="<?php echo esc_attr(get_post_meta($thepostid, '_length', true)); ?> " step="any" min="0" /> <input placeholder="<?php _e('Width', 'woocommerce'); ?> " class="input-text" size="6" type="number" name="_width" value="<?php echo esc_attr(get_post_meta($thepostid, '_width', true)); ?> " step="any" min="0" /> <input placeholder="<?php _e('Height', 'woocommerce'); ?> " class="input-text last" size="6" type="number" name="_height" value="<?php echo esc_attr(get_post_meta($thepostid, '_height', true)); ?> " step="any" min="0" /> </span> <span class="description"><?php _e('LxWxH in decimal form', 'woocommerce'); ?> </span> </p><?php } else { echo '<input type="hidden" name="_length" value="' . esc_attr(get_post_meta($thepostid, '_length', true)) . '" />'; echo '<input type="hidden" name="_width" value="' . esc_attr(get_post_meta($thepostid, '_width', true)) . '" />'; echo '<input type="hidden" name="_height" value="' . esc_attr(get_post_meta($thepostid, '_height', true)) . '" />'; } 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); ?> <span class="description"><?php _e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce'); ?> </span></p><?php do_action('woocommerce_product_options_shipping'); echo '</div>'; ?> </div> <div id="woocommerce_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="woocommerce_attributes wc-metaboxes"> <?php // Array of defined attribute taxonomies $attribute_taxonomies = $woocommerce->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 = $woocommerce->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 implode(' | ', $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 = $woocommerce->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…', '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); $product_name = woocommerce_get_formatted_product_name($product); echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product_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 $woocommerce->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…', '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); $product_name = woocommerce_get_formatted_product_name($product); if ($product) { echo '<option value="' . esc_attr($product_id) . '" selected="selected">' . esc_html($product_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 $woocommerce->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…', 'woocommerce'); $posts_in = array_unique((array) get_objects_in_term(get_term_by('slug', 'grouped', 'product_type')->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'), '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'), '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 do_action('woocommerce_product_write_panels'); ?> <div class="clear"></div> </div> <?php }
/** * Write panel for Product Bundles **/ function woo_bundles_product_write_panel() { global $woocommerce, $post, $wpdb; ?> <div id="bundled_product_data" class="panel woocommerce_options_panel"> <div class="options_group"> <p><label for="bundled_ids"><?php _e('Bundled Products', 'woo-bundles'); ?> </label> </p> <div class="wc-bundled_products"> <div class="bundled_products_info"> <?php _e('Note', 'woo-bundles'); echo '<img class="help_tip" data-tip="' . __('Select the products that you want to include in your bundle, kit, or assembly. Any simple or variable product can be added - physical, or downloadable.<br/><strong>Important</strong>: v2.0 has introduced the ability to bundle <strong>multiple instances of the same variable product</strong> and configure each instance separately - for details, check out the online documentation.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />'; ?> </div> <div class="bundled_products_selector"> <select id="bundled_ids" name="bundled_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php _e('Search for a product…', 'woo-bundles'); ?> "> <?php $item_ids = get_post_meta($post->ID, '_bundled_ids', true); $bundled_variable_num = 0; if ($item_ids) { foreach ($item_ids as $item_id) { // remove suffix $sep = explode('_', $item_id); $product_id = $sep[0]; if ($terms = wp_get_object_terms($product_id, 'product_type')) { $product_type = current($terms)->slug; } if ($product_type == 'variable') { $bundled_variable_num++; } $title = get_the_title($product_id) . ($product_id != $item_id ? ' #' . $sep[1] : ''); $sku = get_post_meta($product_id, '_sku', true); if (!$title) { continue; } if (isset($sku) && $sku) { $sku = ' (SKU: ' . $sku . ')'; } echo '<option value="' . $product_id . '" selected="selected">' . $title . $sku . '</option>'; } } ?> </select> </div> </div> <?php if ($item_ids) { ?> <p><label for="bundled_ids_notice"><?php _e('Bundle Configuration', 'woo-bundles'); ?> </label></p> <?php $allowed_variations = get_post_meta($post->ID, '_allowed_variations', true); $default_attributes = (array) maybe_unserialize(get_post_meta($post->ID, '_bundle_defaults', true)); foreach ($item_ids as $item_id) { // remove suffix $sep = explode('_', $item_id); $product_id = $sep[0]; $title = get_the_title($product_id) . ($product_id != $item_id ? ' #' . $sep[1] : ''); $sku = get_post_meta($product_id, '_sku', true); if (isset($sku) && $sku) { $sku = ' (SKU: ' . $sku . ')'; } if (!$title) { continue; } ?> <div class="wc-bundled-item"> <div class="item-description"> <?php echo $title . ' – #' . $product_id; ?> <br/><?php echo $sku; ?> </div> <div class="item-data"> <?php if ($this->is_wc_v2()) { $bundled_product = get_product($product_id); } else { $bundled_product = new WC_Product($product_id); } if ($bundled_product->is_type('variable')) { ?> <div class="filtering"> <?php woocommerce_wp_checkbox(array('id' => 'filter_variations_' . $item_id, 'wrapper_class' => 'filter_variations', 'label' => __('Filter Variations', 'woo-bundles'), 'description' => '<img class="help_tip" data-tip="' . __('Check to enable only a subset of the available variations.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />')); ?> </div> <div class="bundle_variation_filters indented"> <select multiple="multiple" name="allowed_variations[<?php echo $item_id; ?> ][]" style="width: 450px; display: none; " data-placeholder="Choose variations…" title="Variations" class="chosen_select" > <?php $args = array('post_type' => 'product_variation', 'post_status' => array('private', 'publish'), 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'asc', 'post_parent' => $product_id, 'fields' => 'ids'); $variations = get_posts($args); foreach ($variations as $variation) { $product_custom_fields = get_post_custom($variation); ksort($product_custom_fields); $description = ''; foreach ($product_custom_fields as $name => $value) { if (!strstr($name, 'attribute_')) { continue; } $attribute_name = substr($name, strlen('attribute_')); $description_name = ucwords($woocommerce->attribute_label($attribute_name)); if (!$value[0]) { $description_value = __('Any', 'woocommerce') . ' ' . $description_name; } else { $term = get_term_by('slug', $value[0], $attribute_name); $description_value = $term == false ? '' : $term->name; } if (!$description_value) { $description_value = $value[0]; } $description .= $description_name . ': ' . apply_filters('woocommerce_variation_option_name', $description_value) . ', '; } if (is_array($allowed_variations[$item_id]) && in_array($variation, $allowed_variations[$item_id])) { $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option value="' . $variation . '" ' . $selected . '>#' . $variation . ' - ' . rtrim($description, ', ') . '</option>'; } ?> </select> <?php woocommerce_wp_checkbox(array('id' => 'hide_filtered_variations_' . $item_id, 'wrapper_class' => 'hide_filtered_variations', 'label' => __('Hide Filtered-Out Options', 'woo-bundles'), 'description' => '<img class="help_tip" data-tip="' . __('Check to remove any filtered-out variation options from this item\'s drop-downs. If you leave the box unchecked, the options corresponding to filtered-out variations will be disabled but still visible.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />')); ?> </div> <div class="defaults"> <?php woocommerce_wp_checkbox(array('id' => 'override_defaults_' . $item_id, 'wrapper_class' => 'override_defaults', 'label' => __('Override Default Selections', 'woo-bundles'), 'description' => '<img class="help_tip" data-tip="' . __('In effect for this bundle only. The available options are in sync with the filtering settings above. Always save any changes made above before configuring this section.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />')); ?> </div> <div class="bundle_selection_defaults indented"> <?php // get normal variation attributes $attributes = $bundled_product->get_variation_attributes(); // filtered variation attributes $filtered_attributes = array(); // get filter-active setting $filtered = get_post_meta($post->ID, 'filter_variations_' . $item_id, true) == 'yes' ? true : false; // if filter is active, show only the attributes of the selected variations if ($filtered) { foreach ($allowed_variations[$item_id] as $allowed_variation_id) { // get variation meta of allowed variations $product_custom_fields = get_post_custom($allowed_variation_id); foreach ($product_custom_fields as $name => $value) { if (!strstr($name, 'attribute_')) { continue; } $attribute_name = substr($name, strlen('attribute_')); if (!isset($filtered_attributes[$attribute_name])) { $filtered_attributes[$attribute_name][] = $value[0]; } elseif (!in_array($value[0], $filtered_attributes[$attribute_name])) { $filtered_attributes[$attribute_name][] = $value[0]; } } } } foreach ($attributes as $name => $values) { sort($values); // Get current value for variation (if set) $variation_selected_value = isset($default_attributes[$item_id][sanitize_title($name)]) ? $default_attributes[$item_id][sanitize_title($name)] : ''; // Name will be something like attribute_pa_color echo '<select name="default_attributes[' . $item_id . '][' . sanitize_title($name) . ']"><option value="">' . __('No default', 'woocommerce') . ' ' . $woocommerce->attribute_label($name) . '…</option>'; foreach ($values as $value) { // if filters exist, only show the entries available in the filtered_attributes array if ($filtered && isset($filtered_attributes[sanitize_title($name)])) { if (!in_array($value, $filtered_attributes[sanitize_title($name)]) && !in_array('', $filtered_attributes[sanitize_title($name)])) { continue; } } $term = get_term_by('slug', $value, $name); $value_name = $term == false ? '' : $term->name; if (!$value_name) { $value_name = ucwords($value); } echo '<option ' . selected($variation_selected_value, $value, false) . ' value="' . $value . '">' . apply_filters('woocommerce_variation_option_name', $value_name) . '</option>'; } echo '</select>'; } ?> </div> <?php } $item_quantity = get_post_meta($post->ID, 'bundle_quantity_' . $item_id, true); if (!isset($item_quantity) || $item_quantity < 1 || get_post_meta($product_id, '_downloadable', true) == 'yes' && get_post_meta($product_id, '_virtual', true) == 'yes' && get_option('woocommerce_limit_downloadable_product_qty') == 'yes') { $item_quantity = 1; } ?> <div class="quantity"> <?php woocommerce_wp_text_input(array('id' => 'bundle_quantity_' . $item_id, 'class' => 'bundle_quantity', 'label' => __('Quantity', 'woocommerce'))); ?> </div> <div class="item_visibility"> <label for="item_visibility"><?php _e('Front-End Visibility', 'woo-bundles'); ?> </label> <select name="visibility_<?php echo $item_id; ?> "> <?php $visible = get_post_meta($post->ID, 'visibility_' . $item_id, true) == 'hidden' ? false : true; echo '<option ' . selected($visible, true, false) . ' value="visible">' . __('Visible', 'woo-bundles') . '</option>'; echo '<option ' . selected($visible, false, false) . ' value="hidden">' . __('Hidden', 'woo-bundles') . '</option>'; echo '<img class="help_tip" data-tip="' . __('Check this option to hide the thumbnail of this bundled product.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />'; ?> </select> </div> <div class="images"> <?php woocommerce_wp_checkbox(array('id' => 'hide_thumbnail_' . $item_id, 'wrapper_class' => 'hide_thumbnail', 'label' => __('Hide Product Thumbnail', 'woo-bundles'), 'description' => '')); ?> </div> <div class="override_title"> <?php woocommerce_wp_checkbox(array('id' => 'override_title_' . $item_id, 'wrapper_class' => 'override_title', 'label' => __('Override Title', 'woo-bundles'), 'description' => '<img class="help_tip" data-tip="' . __('Check this option to override the default product title.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />')); ?> <?php $item_title = get_post_meta($post->ID, 'product_title_' . $item_id, true); ?> <div class="custom_title indented"> <?php woocommerce_wp_text_input(array('id' => 'product_title_' . $item_id, 'class' => 'product_title', 'label' => __('Product Title', 'woo-bundles'))); ?> </div> </div> <div class="override_description"> <?php woocommerce_wp_checkbox(array('id' => 'override_description_' . $item_id, 'wrapper_class' => 'override_description', 'label' => __('Override Short Description', 'woo-bundles'), 'description' => '<img class="help_tip" data-tip="' . __('Check this option to override the default short product description.', 'woo-bundles') . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />')); ?> <?php $item_description = get_post_meta($post->ID, 'product_description_' . $item_id, true); ?> <div class="custom_description indented"> <?php woocommerce_wp_textarea_input(array('id' => 'product_description_' . $item_id, 'class' => 'product_description', 'label' => __('Product Short Description', 'woo-bundles'))); ?> </div> </div> </div> </div> <?php } } else { ?> <p><label for="bundled_ids_notice"><?php _e('Bundle Configuration', 'woo-bundles'); ?> </label></p> <p><em><?php _e('To configure additional options, first select some products and then save your changes.', 'woo-bundles'); ?> </em></p> <?php } ?> </div> <!-- options group --> </div> <?php }
function uni_cpo_add_custom_settings_tab_content() { global $post; $currency_symbol = get_woocommerce_currency_symbol(); ?> <div id="uni_cpo_settings_data" class="panel woocommerce_options_panel"> <div class="options_group"> <?php woocommerce_wp_checkbox(array('id' => '_uni_cpo_enable_custom_options_calc', 'label' => __('Enable price calculation based on custom options?', 'uni-cpo'), 'description' => '')); ?> </div> <div class="options_group"> <?php woocommerce_wp_checkbox(array('id' => '_uni_cpo_enable_qty_discounts_calc', 'label' => __('Enable discounts in the cart based on quantity?', 'uni-cpo'), 'description' => '')); ?> </div> <div class="options_group uni_custom_tab_options"> <?php woocommerce_wp_text_input(array('id' => '_uni_cpo_min_price', 'label' => sprintf(__('Min. price (%s)', 'uni-cpo'), $currency_symbol), 'desc_tip' => 'false')); ?> <div class="form-field"> <label for=""><?php _e('Available options tags (clickable)', 'uni-cpo'); ?> </label> <?php $aCpoOptions = maybe_unserialize(get_post_meta($post->ID, '_uni_cpo_product_attributes', true)); if ($aCpoOptions) { ?> <ul id="cpo-options-elements-list"> <li class="uni_cpo_price tips" data-tip="<?php _e('Price of the product', 'uni-cpo'); ?> "><span>{uni_cpo_price}</span></li> <?php foreach ($aCpoOptions as $aOption) { if ($aOption['cpo_type'] == 'input' || $aOption['cpo_type'] == 'input_number' || $aOption['cpo_type'] == 'checkbox_multiple') { if ($aOption['value']) { foreach ($aOption['value'] as $sInputName) { echo '<li class="tips" data-tip="' . wc_attribute_label($sInputName) . '"><span>{uni_cpo_' . $sInputName . '}</span></li>'; } } } else { echo '<li class="tips" data-tip="' . wc_attribute_label($aOption['name']) . '"><span>{uni_cpo_' . $aOption['name'] . '}</span></li>'; } ?> <?php } ?> </ul> <div style="clear:both;"></div> <span class="description"> <?php _e('Typical math operators: *, +, -, /. You can also use "(" and ")" in the formula.', 'uni-cpo'); ?> </span> <?php } else { _e('None of CPO options have been added yet. Maybe you need to reload the page?', 'uni-cpo'); } ?> </div> <?php woocommerce_wp_textarea_input(array('id' => '_uni_cpo_formula', 'label' => __('Formula', 'uni-cpo'), 'placeholder' => '', 'desc_tip' => false, 'description' => __('The name of each field is a slug for this attribute prefixed with "uni_cpo_" and the brackets ("{}") from the both sides of the variable. For example: "{uni_cpo_width}" or "{uni_cpo_pa_thickness}". The formula example: "{uni_cpo_width}*{uni_cpo_height}+{uni_cpo_pa_glazing-thickness}". These special formatted names will be changed to the values of the price of the attribute during the price calculation. Also you should use "{uni_cpo_price}" if you want to add a price of the product.', 'uni-cpo'))); ?> </div> <div class="options_group"> <?php woocommerce_wp_text_input(array('id' => '_uni_cpo_min_qty', 'label' => __('Min. quantity value', 'uni-cpo'), 'description' => '', 'placeholder' => '1', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '1'))); ?> <?php woocommerce_wp_text_input(array('id' => '_uni_cpo_max_qty', 'label' => __('Max. quantity value', 'uni-cpo'), 'description' => '', 'placeholder' => '', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => ''))); ?> <?php woocommerce_wp_text_input(array('id' => '_uni_cpo_start_qty', 'label' => __('Starting quantity value', 'uni-cpo'), 'description' => '', 'placeholder' => '1', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '1'))); ?> <?php woocommerce_wp_text_input(array('id' => '_uni_cpo_step_qty', 'label' => __('Increment step value', 'uni-cpo'), 'description' => '', 'placeholder' => '1', 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '1'))); ?> </div> <div class="options_group"> <?php woocommerce_wp_checkbox(array('id' => '_uni_cpo_conditions_enable', 'label' => __('Enable conditions?', 'uni-cpo'), 'description' => '')); ?> </div> <div class="options_group"> <?php $aConditions = get_post_meta($post->ID, '_uni_cpo_conditions_data', true); ?> <?php if (!empty($aConditions)) { foreach ($aConditions as $sKey => $aValue) { ?> <p id="conditions_field<?php echo $sKey; ?> " class="form-field uni-cloned-conditions"> <label for="uni-condition-left-var<?php echo $sKey; ?> " class="label-uni-condition-var"><?php echo __('Rule', 'uni-cpo'); ?> </label> <span class="wrap" style="display:inline-block;background-color:#f1f1f1;width:100%;padding:2px;"> <select id="uni_condition_left_var<?php echo $sKey; ?> " name="uni_condition_left_var<?php echo $sKey; ?> " class="select-uni-condition-left-var select short"> <option value="uni_quantity"<?php selected('uni_quantity', $aValue['left_var']); ?> ><?php _e('Quantity', 'uni-cpo'); ?> </option> <?php if ($aCpoOptions) { foreach ($aCpoOptions as $aOption) { if ($aOption['cpo_type'] == 'input' || $aOption['cpo_type'] == 'input_number') { if ($aOption['value']) { foreach ($aOption['value'] as $sInputName) { echo '<option value="uni_cpo_' . $sInputName . '"' . selected('uni_cpo_' . $sInputName, $aValue['left_var'], false) . '>{uni_cpo_' . $sInputName . '}</option>'; } } } else { if ($aOption['cpo_type'] == ('select' || 'checkbox' || 'radio' || 'color' || 'color_ext')) { echo '<option value="uni_cpo_' . $aOption['name'] . '"' . selected('uni_cpo_' . $aOption['name'], $aValue['left_var'], false) . '>{uni_cpo_' . $aOption['name'] . '}</option>'; } } } } ?> </select><br><br> <select id="uni_condition_left_operator<?php echo $sKey; ?> " name="uni_condition_left_operator<?php echo $sKey; ?> " class="select-uni-condition-left-operator select short"> <option value="less"<?php selected('less', $aValue['left_operator']); ?> ><?php _e('less then', 'uni-cpo'); ?> </option> <option value="less_equal"<?php selected('less_equal', $aValue['left_operator']); ?> ><?php _e('equal or less then', 'uni-cpo'); ?> </option> <option value="equal"<?php selected('equal', $aValue['left_operator']); ?> ><?php _e('equal', 'uni-cpo'); ?> </option> <option value="greater_equal"<?php selected('greater_equal', $aValue['left_operator']); ?> ><?php _e('equal or greater then', 'uni-cpo'); ?> </option> <option value="greater"<?php selected('greater', $aValue['left_operator']); ?> ><?php _e('greater then', 'uni-cpo'); ?> </option> <option value="is"<?php selected('is', $aValue['left_operator']); ?> ><?php _e('is', 'uni-cpo'); ?> </option> <option value="isnot"<?php selected('isnot', $aValue['left_operator']); ?> ><?php _e('is not', 'uni-cpo'); ?> </option> </select><br><br> <input placeholder="<?php _e('Value', 'uni-cpo'); ?> " id="uni_condition_left_value<?php echo $sKey; ?> " class="input-uni-condition-left-value input-uni-condition-value input-text wc_input_decimal last" size="6" type="text" name="uni_condition_left_value<?php echo $sKey; ?> " value="<?php echo $aValue['left_value']; ?> " /> </span> <span class="wrap" style="display:inline-block;background-color:#CFE7B6;width:100%;padding:2px;margin-top:7px;"> <select id="uni_condition_conj_operator<?php echo $sKey; ?> " name="uni_condition_conj_operator<?php echo $sKey; ?> " class="select-uni-condition-conj-operator select short"> <option value=""<?php selected('', $aValue['conj_operator']); ?> >- <?php _e('Disable the second part', 'uni-cpo'); ?> -</option> <option value="and"<?php selected('and', $aValue['conj_operator']); ?> ><?php _e('AND', 'uni-cpo'); ?> </option> <option value="or"<?php selected('or', $aValue['conj_operator']); ?> ><?php _e('OR', 'uni-cpo'); ?> </option> </select> </span> <?php if (empty($aValue['conj_operator'])) { ?> <span class="wrap" style="display:inline-block;background-color:#FFDDD1;width:100%;padding:2px;"> <?php } else { ?> <span class="wrap" style="display:inline-block;background-color:#f1f1f1;width:100%;padding:2px;"> <?php } ?> <select id="uni_condition_right_var<?php echo $sKey; ?> " name="uni_condition_right_var<?php echo $sKey; ?> " class="select-uni-condition-right-var select short"> <option value="uni_quantity"<?php selected('uni_quantity', $aValue['right_var']); ?> ><?php _e('Quantity', 'uni-cpo'); ?> </option> <?php if ($aCpoOptions) { foreach ($aCpoOptions as $aOption) { if ($aOption['cpo_type'] == 'input' || $aOption['cpo_type'] == 'input_number') { if ($aOption['value']) { foreach ($aOption['value'] as $sInputName) { echo '<option value="uni_cpo_' . $sInputName . '"' . selected('uni_cpo_' . $sInputName, $aValue['right_var'], false) . '>{uni_cpo_' . $sInputName . '}</option>'; } } } else { if ($aOption['cpo_type'] == ('select' || 'checkbox' || 'radio' || 'color' || 'color_ext')) { echo '<option value="uni_cpo_' . $aOption['name'] . '"' . selected('uni_cpo_' . $aOption['name'], $aValue['right_var'], false) . '>{uni_cpo_' . $aOption['name'] . '}</option>'; } } } } ?> </select><br><br> <select id="uni_condition_right_operator<?php echo $sKey; ?> " name="uni_condition_right_operator<?php echo $sKey; ?> " class="select-uni-condition-right-operator select short"> <option value="less"<?php selected('less', $aValue['right_operator']); ?> ><?php _e('less then', 'uni-cpo'); ?> </option> <option value="less_equal"<?php selected('less_equal', $aValue['right_operator']); ?> ><?php _e('equal or less then', 'uni-cpo'); ?> </option> <option value="equal"<?php selected('equal', $aValue['right_operator']); ?> ><?php _e('equal', 'uni-cpo'); ?> </option> <option value="greater_equal"<?php selected('greater_equal', $aValue['right_operator']); ?> ><?php _e('equal or greater then', 'uni-cpo'); ?> </option> <option value="greater"<?php selected('greater', $aValue['right_operator']); ?> ><?php _e('greater then', 'uni-cpo'); ?> </option> <option value="is"<?php selected('is', $aValue['right_operator']); ?> ><?php _e('is', 'uni-cpo'); ?> </option> <option value="isnot"<?php selected('isnot', $aValue['right_operator']); ?> ><?php _e('is not', 'uni-cpo'); ?> </option> </select><br><br> <input placeholder="<?php _e('Value', 'uni-cpo'); ?> " id="uni_condition_right_value<?php echo $sKey; ?> " class="input-uni-condition-right-value input-uni-condition-value input-text wc_input_decimal last" size="6" type="text" name="uni_condition_right_value<?php echo $sKey; ?> " value="<?php echo $aValue['right_value']; ?> " /> </span> <br><br> <span><?php _e('Formula', 'uni-cpo'); ?> </span> <textarea name="uni_condition_formula<?php echo $sKey; ?> " id="uni_condition_formula<?php echo $sKey; ?> " class="textarea-uni-condition-formula" cols="30" rows="5"><?php echo $aValue['formula']; ?> </textarea> </p> <?php } } else { ?> <p id="conditions_field1" class="form-field uni-cloned-conditions"> <label for="uni-condition-left-var1" class="label-uni-condition-var"><?php echo __('Rule', 'uni-cpo'); ?> </label> <span class="wrap" style="display:inline-block;background-color:#f1f1f1;width:100%;padding:2px;"> <select id="uni_condition_left_var1" name="uni_condition_left_var1" class="select-uni-condition-left-var select short"> <option value="uni_quantity"><?php _e('Quantity', 'uni-cpo'); ?> </option> <?php if ($aCpoOptions) { foreach ($aCpoOptions as $aOption) { if ($aOption['cpo_type'] == 'input' || $aOption['cpo_type'] == 'input_number') { if ($aOption['value']) { foreach ($aOption['value'] as $sInputName) { echo '<option value="uni_cpo_' . $sInputName . '"' . selected('uni_cpo_' . $sInputName, $aValue['left_var'], false) . '>{uni_cpo_' . $sInputName . '}</option>'; } } } else { if ($aOption['cpo_type'] == ('select' || 'checkbox' || 'radio' || 'color' || 'color_ext')) { echo '<option value="uni_cpo_' . $aOption['name'] . '"' . selected('uni_cpo_' . $aOption['name'], $aValue['left_var'], false) . '>{uni_cpo_' . $aOption['name'] . '}</option>'; } } } } ?> </select><br><br> <select id="uni_condition_left_operator1" name="uni_condition_left_operator1" class="select-uni-condition-left-operator select short"> <option value="less"><?php _e('less then', 'uni-cpo'); ?> </option> <option value="less_equal"><?php _e('equal or less then', 'uni-cpo'); ?> </option> <option value="equal"><?php _e('equal', 'uni-cpo'); ?> </option> <option value="greater_equal"><?php _e('equal or greater then', 'uni-cpo'); ?> </option> <option value="greater"><?php _e('greater then', 'uni-cpo'); ?> </option> <option value="is"><?php _e('is', 'uni-cpo'); ?> </option> <option value="isnot"><?php _e('is not', 'uni-cpo'); ?> </option> </select><br><br> <input placeholder="<?php _e('Value', 'uni-cpo'); ?> " id="uni_condition_left_value1" class="input-uni-condition-left-value input-uni-condition-value input-text wc_input_decimal last" size="6" type="text" name="uni_condition_left_value1" value="" /> </span> <span class="wrap" style="display:inline-block;background-color:#CFE7B6;width:100%;padding:2px;margin-top:7px;"> <select id="uni_condition_conj_operator1" name="uni_condition_conj_operator1" class="select-uni-condition-conj-operator select short"> <option value="">- <?php _e('Disable the second part', 'uni-cpo'); ?> -</option> <option value="and"><?php _e('AND', 'uni-cpo'); ?> </option> <option value="or"><?php _e('OR', 'uni-cpo'); ?> </option> </select> </span> <span class="wrap" style="display:inline-block;background-color:#f1f1f1;width:100%;padding:2px;"> <select id="uni_condition_right_var1" name="uni_condition_right_var1" class="select-uni-condition-right-var select short"> <option value="uni_quantity"><?php _e('Quantity', 'uni-cpo'); ?> </option> <?php if ($aCpoOptions) { foreach ($aCpoOptions as $aOption) { if ($aOption['cpo_type'] == 'input' || $aOption['cpo_type'] == 'input_number') { if ($aOption['value']) { foreach ($aOption['value'] as $sInputName) { echo '<option value="uni_cpo_' . $sInputName . '"' . selected('uni_cpo_' . $sInputName, $aValue['right_var'], false) . '>{uni_cpo_' . $sInputName . '}</option>'; } } } else { if ($aOption['cpo_type'] == ('select' || 'checkbox' || 'radio' || 'color' || 'color_ext')) { echo '<option value="uni_cpo_' . $aOption['name'] . '"' . selected('uni_cpo_' . $aOption['name'], $aValue['right_var'], false) . '>{uni_cpo_' . $aOption['name'] . '}</option>'; } } } } ?> </select><br><br> <select id="uni_condition_right_operator1" name="uni_condition_right_operator1" class="select-uni-condition-right-operator select short"> <option value="less"><?php _e('less then', 'uni-cpo'); ?> </option> <option value="less_equal"><?php _e('equal or less then', 'uni-cpo'); ?> </option> <option value="equal"><?php _e('equal', 'uni-cpo'); ?> </option> <option value="greater_equal"><?php _e('equal or greater then', 'uni-cpo'); ?> </option> <option value="greater"><?php _e('greater then', 'uni-cpo'); ?> </option> <option value="is"><?php _e('is', 'uni-cpo'); ?> </option> <option value="isnot"><?php _e('is not', 'uni-cpo'); ?> </option> </select><br><br> <input placeholder="<?php _e('Value', 'uni-cpo'); ?> " id="uni_condition_right_value1" class="input-uni-condition-right-value input-uni-condition-value input-text wc_input_decimal last" size="6" type="text" name="uni_condition_right_value1" value="" /> </span> <br><br> <span><?php _e('Formula', 'uni-cpo'); ?> </span> <textarea name="uni_condition_formula1" id="uni_condition_formula1" class="textarea-uni-condition-formula" cols="30" rows="5"></textarea> </p> <?php } ?> <div id="addDelButtons"> <span id="uni-clone-condition" class="uni-clone-add dashicons dashicons-yes"><b><?php _e('Add new', 'uni-cpo'); ?> </b></span> <span id="uni-delete-condition" class="uni-clone-delete dashicons dashicons-no"><b><?php _e('Delete', 'uni-cpo'); ?> </b></span> </div> </div> </div> <?php }
</div> <div class="options_group"> <?php if (!empty(ML()->ml_official_stores)) { woocommerce_wp_select(array('id' => 'ml_official_store_id', 'label' => __('Official Store', $textdomain), 'description' => __('Determines which official store the product will be posted', $textdomain), 'desc_tip' => true, 'options' => ML()->ml_official_stores, 'value' => isset($_POST['ml_official_store_id']) ? $_POST['ml_official_store_id'] : $ml_product->official_store_id, 'custom_attributes' => $ml_product->is_published() ? array('disabled' => 'disabled') : array())); } //Modifiable with conditions woocommerce_wp_select(array('id' => 'ml_listing_type_id', 'label' => __('Listing Type', $textdomain), 'description' => __('Determines how your product will be listed on MercadoLivre', $textdomain), 'desc_tip' => true, 'options' => wp_list_pluck(ML()->ml_communication->get_listing_types(), 'name', 'id'), 'value' => isset($_POST['ml_listing_type_id']) ? $_POST['ml_listing_type_id'] : $ml_product->listing_type_id)); ?> </div> <div class="options_group"> <?php // Modifiable woocommerce_wp_text_input(array('id' => 'ml_video_id', 'label' => __('Video ID or URL', $textdomain), 'description' => __('Use the URL or the ID of the video on youtube', $textdomain), 'desc_tip' => true, 'value' => isset($_POST['ml_video_id']) ? $_POST['ml_video_id'] : $ml_product->video_id)); //depending on sold_quantity == 0 to modify woocommerce_wp_textarea_input(array('id' => 'ml_warranty', 'label' => __('Warranty', $textdomain), 'description' => __('Describe the product warranty for buyers on MercadoLivre', $textdomain), 'desc_tip' => true, 'value' => isset($_POST['ml_warranty']) ? $_POST['ml_warranty'] : $ml_product->warranty, 'custom_attributes' => $ml_product->can_update_special_fields() ? array() : array('disabled' => 'disabled'))); ?> </div> <div class="options_group shipment_fields"> <?php woocommerce_wp_select(array('id' => 'ml_shipping_mode', 'label' => __('Shipping', $textdomain), 'description' => __('Determine how your product will be delivered for buyers on MercadoLivre', $textdomain), 'desc_tip' => true, 'options' => ML()->ml_communication->get_shipping_modes(empty($ml_product->category_id) ? null : $ml_product->category_id), 'value' => isset($_POST['ml_shipping_mode']) ? $_POST['ml_shipping_mode'] : $ml_product->shipping_mode, 'custom_attributes' => $ml_product->can_update_special_fields() ? array() : array('disabled' => 'disabled'))); if (!empty($ml_product->shipping_mode) && $ml_product->shipping_mode != 'not_specified') { $category_id = $ml_product->category_id; include_once "html-{$ml_product->shipping_mode}-shipment.php"; } ?> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $('#ml_shipping_mode').change(function() { // Remove previous shipping mode content
function woogle_custom_general_fields() { global $post; echo '<div class="options_group woogle-options-group">'; // Enable Google Shopping woocommerce_wp_checkbox(array('id' => '_woogle_enabled', 'label' => __('Enable Google Shopping', 'woogle'), 'desc_tip' => true, 'description' => __('Select to upload this product to your Google Merchant Center', 'woogle'))); echo __('<h3>Product Description</h3>', 'woogle'); // Title woocommerce_wp_text_input(array('id' => '_woogle_title', 'label' => __('Woogle Title', 'woogle'), 'placeholder' => '(Limit 150 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the title for this product.<br />(Limit 150 characters)', 'woogle'))); // Description woocommerce_wp_textarea_input(array('id' => '_woogle_description', 'label' => __('Woogle Description', 'woogle'), 'placeholder' => '(Limit 5000 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the description for this product.<br />(Limit 5000 characters)', 'woogle'))); echo __('<h3>Product Identification</h3>', 'woogle'); // Condition woocommerce_wp_select(array('id' => '_woogle_condition', 'label' => __('Condition', 'woogle'), 'options' => array('new' => __('New', 'woogle'), 'used' => __('Used', 'woogle'), 'refurbished' => __('Refurbished', 'woogle')), 'desc_tip' => true, 'description' => __('Condition of the item', 'woogle'))); // Category woocommerce_wp_text_input(array('id' => '_woogle_category', 'label' => __('Product Category', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Product Category from Google Shopping Content Category Taxonomy.', 'woogle'))); // Brand woocommerce_wp_text_input(array('id' => '_woogle_brand', 'label' => __('Brand', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The brand of the product.', 'woogle'))); // GTIN woocommerce_wp_text_input(array('id' => '_woogle_gtin', 'label' => __('GTIN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Global Trade Item Number', 'woogle'))); // MPN woocommerce_wp_text_input(array('id' => '_woogle_mpn', 'label' => __('MPN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Manufacturer Part Number', 'woogle'))); echo __('<h3>Physical Properties</h3>', 'woogle'); // Color woocommerce_wp_text_input(array('id' => '_woogle_color', 'label' => __('Color', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The color of the product. If you are trying to indicate multiple colors for a ' . 'single item (not product variants), specify a primary color, optionally followed ' . 'by at most two secondary colors, separated by a \'/\'. Here replace RedPinkBlue ' . 'with Red/Pink/Blue', 'woogle'))); // Material woocommerce_wp_text_input(array('id' => '_woogle_material', 'label' => __('Material', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The material of the product.', 'woogle'))); // Pattern woocommerce_wp_text_input(array('id' => '_woogle_pattern', 'label' => __('Pattern', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The pattern of the product.', 'woogle'))); // Size woocommerce_wp_text_input(array('id' => '_woogle_size', 'label' => __('Size', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The size of the product.', 'woogle'))); echo __('<h3>Target Consumer</h3>', 'woogle'); // Age Group woocommerce_wp_select(array('id' => '_woogle_age_group', 'label' => __('Age Group', 'woogle'), 'options' => array('' => __('—SELECT—', 'woogle'), 'adult' => __('Adult', 'woogle'), 'infant' => __('Infant', 'woogle'), 'kids' => __('Kids', 'woogle'), 'newborn' => __('Newborn', 'woogle'), 'toddler' => __('Toddler', 'woogle')), 'desc_tip' => true, 'description' => __('The target age group of the product.', 'woogle'))); // Gender woocommerce_wp_select(array('id' => '_woogle_gender', 'label' => __('Gender', 'woogle'), 'options' => array('' => __('—SELECT—', 'woogle'), 'female' => __('Female', 'woogle'), 'male' => __('Male', 'woogle'), 'unisex' => __('Unisex', 'woogle')), 'desc_tip' => true, 'description' => __('The target gender of the product.', 'woogle'))); // Adult woocommerce_wp_checkbox(array('id' => '_woogle_adult', 'label' => __('Adult (18+)', 'woogle'), 'desc_tip' => true, 'description' => __('This item is targeted towards adults.', 'woogle'))); echo '</div>'; }