本文整理汇总了PHP中woocommerce_wp_select函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_wp_select函数的具体用法?PHP woocommerce_wp_select怎么用?PHP woocommerce_wp_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_wp_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
public static function output()
{
global $post, $thepostid;
$thepostid = $post->ID;
$_product = wc_get_product($thepostid);
$terms = array();
$delivery_time = $_product->gzd_product->delivery_time;
woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Unit Base', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Unit price per amount (e.g. 100)', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
if (version_compare(WC()->version, '2.3', '<')) {
return;
}
?>
<p class="form-field">
<label for="delivery_time"><?php
_e('Delivery Time', 'woocommerce-germanized');
?>
</label>
<input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php
_e('Search for a delivery time…', 'woocommerce-germanized');
?>
" data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php
echo $delivery_time ? $delivery_time->name : '';
?>
" value="<?php
echo $delivery_time ? $delivery_time->term_id : '';
?>
" />
</p>
<?php
}
示例2: woo_add_custom_general_fields
/**
* Add custom fields to Product General Tab.
*
* @subpackage Product
*/
function woo_add_custom_general_fields()
{
global $woocommerce, $post;
echo '<div class="options_group">';
echo '<h2>Book Details</h2>';
woocommerce_wp_text_input(array('id' => '_amazon_link', 'label' => __('Amazon Link', 'woocommerce'), 'placeholder' => 'Amazon link', 'desc_tip' => true, 'description' => __('Enter Amazon link here.', 'woocommerce')));
woocommerce_wp_text_input(array('id' => '_isbn', 'label' => __('ISBN', 'woocommerce'), 'placeholder' => 'ISBN', 'desc_tip' => true, 'description' => __('Enter ISBN here.', 'woocommerce')));
woocommerce_wp_text_input(array('id' => '_number_of_pages', 'label' => __('No of Pages', 'woocommerce'), 'placeholder' => 'No of pages', 'desc_tip' => true, 'description' => __('Enter number of pages here.', 'woocommerce')));
woocommerce_wp_select(array('id' => '_book_format', 'label' => __('Book Format', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Book Format.', 'woocommerce'), 'options' => array('paperback' => __('Paperback', 'woocommerce'), 'hardcover' => __('Hardcover', 'woocommerce'), 'ebook' => __('eBook', 'woocommerce'))));
woocommerce_wp_select(array('id' => '_print_type', 'label' => __('Print Type', 'woocommerce'), 'desc_tip' => true, 'description' => __('Select Print Type.', 'woocommerce'), 'options' => array('colour' => __('Colour', 'woocommerce'), 'black' => __('Black & White', 'woocommerce'))));
echo '</div>';
}
示例3: display
function display()
{
global $post;
global $DOPBSP;
$dopbsp_woocommerce_options = array('calendar' => get_post_meta($post->ID, 'dopbsp_woocommerce_calendar', true), 'language' => get_post_meta($post->ID, 'dopbsp_woocommerce_language', true) == '' ? DOPBSP_CONFIG_TRANSLATION_DEFAULT_LANGUAGE : get_post_meta($post->ID, 'dopbsp_woocommerce_language', true), 'position' => get_post_meta($post->ID, 'dopbsp_woocommerce_position', true) == '' ? 'summary' : get_post_meta($post->ID, 'dopbsp_woocommerce_position', true));
?>
<div id="dopbsp_tab_data" class="panel woocommerce_options_panel">
<div class="options_group">
<p class="form-field">
<?php
woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_calendar', 'options' => $this->getCalendars(), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_CALENDAR'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_CALENDAR_HELP')));
woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_language', 'options' => $this->getLanguages(), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_LANGUAGE'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_LANGUAGE_HELP'), 'value' => $dopbsp_woocommerce_options['language']));
woocommerce_wp_select(array('id' => 'dopbsp_woocommerce_position', 'options' => array('summary' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_SUMMARY'), 'tabs' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_TABS'), 'summary-tabs' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_SUMMARY_AND_TABS')), 'label' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION'), 'description' => $DOPBSP->text('WOOCOMMERCE_TAB_POSITION_HELP'), 'value' => $dopbsp_woocommerce_options['position']));
?>
</p>
</div>
</div>
<?php
}
示例4: showTab
function showTab()
{
global $post;
$custom_tab_options = array('title' => get_post_meta($post->ID, 'custom_tab_title', true), 'content' => get_post_meta($post->ID, 'custom_tab_content', true));
?>
<div id="dopbsp_tab_data" class="panel woocommerce_options_panel">
<div class="options_group">
<p class="form-field">
<?php
woocommerce_wp_select(array('id' => 'custom_tab_enabled', 'options' => $this->getCalendars(), 'label' => __('Enable Custom Tab?', 'woothemes'), 'description' => __('Enable this option to enable the custom tab on the frontend.', 'woothemes')));
?>
</p>
</div>
<div class="options_group">
</div>
</div>
<?php
}
示例5: rf_meta_box
/**
* 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>';
}
示例6: output
public static function output()
{
global $post, $thepostid;
$thepostid = $post->ID;
$_product = wc_get_product($thepostid);
$terms = array();
woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_product', 'label' => __('Product Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Number of units included per default product price. Example: 1000 ml.', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Base Price Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Base price units. Example base price: 0,99 € / 100 ml. Insert 100 as base price unit amount.', 'woocommerce-germanized')));
woocommerce_wp_checkbox(array('id' => '_unit_price_auto', 'label' => __('Calculation', 'woocommerce-germanized'), 'description' => '<span class="wc-gzd-premium-desc">' . __('Calculate base prices automatically.', 'woocommerce-germanized') . '</span> <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="wc-gzd-pro">pro</a>'));
woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
}
示例7: meta_box
function meta_box()
{
global $woocommerce, $post;
$order = new WC_Order($post->ID);
$order_discount = $order->get_total_discount();
$order_tax = $order->get_total_tax();
$order_subtotal = $order->get_subtotal_to_display();
$order_total = $order->get_formatted_order_total();
get_payment_gateway_fields('paypal');
woocommerce_wp_select(array('id' => 'payment_type', 'label' => '', 'value' => 'default', 'options' => ins_get_payment_methods(), 'class' => 'chosen-select'));
woocommerce_wp_select(array('id' => 'add_coupon', 'label' => '', 'value' => 'default', 'options' => ins_get_coupons(), 'class' => 'chosen-select'));
woocommerce_wp_text_input(array('id' => 'sub_total', 'label' => __('Order Subtotal', 'instore'), 'placeholder' => 0.0, 'value' => $order_subtotal));
woocommerce_wp_text_input(array('id' => 'order_tax', 'label' => __('Order Tax', 'instore'), 'placeholder' => 0.0, 'value' => $order_tax));
woocommerce_wp_text_input(array('id' => 'applied_discount', 'label' => __('Applied Discount', 'instore'), 'placeholder' => 0.0, 'value' => $order_discount));
}
示例8: data_display
/**
* Display product settings
*
* @access public
* @since 2.2
*/
public function data_display()
{
?>
<div id="rcp_access_control" class="panel woocommerce_options_panel">
<div class="options_group">
<p><?php
_e('Restrict purchasing of this product to:', 'rcp');
?>
</p>
<?php
woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_purchase', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1));
$levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_purchase', true);
foreach (rcp_get_subscription_levels('all') as $level) {
woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_purchase[]', 'id' => '_rcp_woo_subscription_level_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id));
}
woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_purchase', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels()));
?>
</div>
<div class="options_group">
<p><?php
_e('Restrict viewing of this product to:', 'rcp');
?>
</p>
<?php
woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_view', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1));
$levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_view', true);
foreach (rcp_get_subscription_levels('all') as $level) {
woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_view[]', 'id' => '_rcp_woo_subscription_level_to_view_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id));
}
woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_view', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels()));
?>
</div>
</div>
<?php
}
示例9: soya_display_sv_panel
function soya_display_sv_panel()
{
?>
<div id="soya_variable_product" class="panel woocommerce_options_panel ">
<div class=" options_group show_if_soya_variable">
<?php
// build query to get all features
$args = array('post_type' => 'soya_feature', 'orderby' => 'title', 'order' => 'ASC');
$query = new WP_Query($args);
if ($query->have_posts()) {
$options = [];
foreach ($query->posts as $post) {
$options[$post->ID] = $post->post_title;
}
}
woocommerce_wp_select(array('id' => '_soya_features', 'label' => __('Select Features to Use', 'soya-customiza-product'), 'options' => $options));
woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => '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>' ) );
?>
</div>
</div>
<?php
}
示例10: woo_vou_product_write_panel
/**
* 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')));
//.........这里部分代码省略.........
示例11: variable_subscription_pricing_fields
/**
* Output the subscription specific pricing fields on the "Edit Product" admin page.
*
* @since 1.3
*/
public static function variable_subscription_pricing_fields($loop, $variation_data, $variation)
{
global $woocommerce, $thepostid;
// Set month as the default billing period
if (!($subscription_period = get_post_meta($variation->ID, '_subscription_period', true))) {
$subscription_period = 'month';
}
// When called via Ajax
if (!function_exists('woocommerce_wp_text_input')) {
require_once $woocommerce->plugin_path() . '/admin/post-types/writepanels/writepanels-init.php';
}
if (!isset($thepostid)) {
$thepostid = $variation->post_parent;
}
?>
<tr class="variable_subscription_pricing show_if_variable-subscription">
<td colspan="2">
<label><?php
printf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
?>
</label>
<?php
// Subscription Price
woocommerce_wp_text_input(array('id' => 'variable_subscription_price[' . $loop . ']', 'class' => 'wc_input_subscription_price', 'wrapper_class' => '_subscription_price_field', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_price', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
// Subscription Period Interval
woocommerce_wp_select(array('id' => 'variable_subscription_period_interval[' . $loop . ']', 'class' => 'wc_input_subscription_period_interval', 'wrapper_class' => '_subscription_period_interval_field', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings(), 'value' => get_post_meta($variation->ID, '_subscription_period_interval', true)));
// Billing Period
woocommerce_wp_select(array('id' => 'variable_subscription_period[' . $loop . ']', 'class' => 'wc_input_subscription_period', 'wrapper_class' => '_subscription_period_field', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
// Subscription Length
woocommerce_wp_select(array('id' => 'variable_subscription_length[' . $loop . ']', 'class' => 'wc_input_subscription_length', 'wrapper_class' => '_subscription_length_field', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'value' => get_post_meta($variation->ID, '_subscription_length', true)));
?>
</td>
<td class="sign-up-fee-cell show_if_variable-subscription">
<label><?php
printf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
?>
</label>
<?php
// Sign-up Fee
woocommerce_wp_text_input(array('id' => 'variable_subscription_sign_up_fee[' . $loop . ']', 'class' => 'wc_input_subscription_intial_price', 'wrapper_class' => '_subscription_sign_up_fee_field', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_sign_up_fee', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
?>
</td>
</tr>
<tr class="variable_subscription_trial show_if_variable-subscription">
<td colspan="1" class="show_if_variable-subscription">
<label><?php
_e('Free Trial', WC_Subscriptions::$text_domain);
?>
</label>
<?php
// Trial Length
woocommerce_wp_text_input(array('id' => 'variable_subscription_trial_length[' . $loop . ']', 'class' => 'wc_input_subscription_trial_length', 'wrapper_class' => '_subscription_trial_length_field', 'label' => __('Free Trial', WC_Subscriptions::$text_domain), 'placeholder' => __('e.g. 3', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_trial_length', true)));
// Trial Period
woocommerce_wp_select(array('id' => 'variable_subscription_trial_period[' . $loop . ']', 'class' => 'wc_input_subscription_trial_period', 'wrapper_class' => '_subscription_trial_period_field', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_available_time_periods(), 'description' => sprintf(__('An optional period of time to wait before charging the first recurring payment. Any sign up fee will still be charged at the outset of the subscription. %s', WC_Subscriptions::$text_domain), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($variation->ID)));
do_action('woocommerce_variable_subscription_pricing');
?>
</td>
</tr>
<?php
}
示例12: get_canvas_clip_dimensions_fields
function get_canvas_clip_dimensions_fields()
{
$id = get_the_ID();
$wpc_metas = get_post_meta($id, 'wpc-metas', true);
$bounding_box_array = WPD_Admin::get_proper_value($wpc_metas, 'bounding_box', array());
$clip_w = WPD_Admin::get_proper_value($bounding_box_array, "width", "");
$clip_h = WPD_Admin::get_proper_value($bounding_box_array, "height", "");
$clip_x = WPD_Admin::get_proper_value($bounding_box_array, "x", "");
$clip_y = WPD_Admin::get_proper_value($bounding_box_array, "y", "");
$clip_radius = WPD_Admin::get_proper_value($bounding_box_array, "radius", "");
$clip_radius_rect = WPD_Admin::get_proper_value($bounding_box_array, "r_radius", 0);
$clip_type = WPD_Admin::get_proper_value($bounding_box_array, "type", "");
$clip_border = WPD_Admin::get_proper_value($bounding_box_array, "border_color", "");
echo "<div class='mg-top-10 mg-left-10'><strong>" . __('BOUNDING BOX PARAMETERS', 'wpd') . ": </strong></div>";
echo "<div class='mg-top-10 mg-left-10'>" . __('If the coordinates (X,Y) are not set, they will automatically be determined from the product center.', 'wpd') . "</strong></div>";
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][x]', 'value' => $clip_x, 'label' => __('X', 'wpd') . ' (px)', 'description' => __('Bounding box coordinate X on the product', 'wpd'), 'desc_tip' => 'true'));
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][y]', 'value' => $clip_y, 'label' => __('Y', 'wpd') . ' (px)', 'description' => __('Bounding box coordinate Y on the product', 'wpd'), 'desc_tip' => 'true'));
echo "<div class='mg-top-10 mg-left-10'>" . __('The dimensions are required to apply a bounding box on the product.', 'wpd') . " </strong></div>";
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][width]', 'value' => $clip_w, 'label' => __('Width', 'wpd') . ' (px)', 'description' => __('Bounding box width on the product', 'wpd'), 'desc_tip' => 'true'));
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][height]', 'value' => $clip_h, 'label' => __('Height', 'wpd') . ' (px)', 'description' => __('Bounding box height on the product', 'wpd'), 'desc_tip' => 'true'));
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][r_radius]', 'value' => $clip_radius_rect, 'label' => __('Radius (rect)', 'wpd') . ' (px)', 'description' => __('Bounding box radius on the product (used for rectangle)', 'wpd'), 'desc_tip' => 'true'));
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][radius]', 'value' => $clip_radius, 'label' => __('Radius (circle)', 'wpd') . ' (px)', 'description' => __('Bounding box radius on the product (used for circle)', 'wpd'), 'desc_tip' => 'true'));
woocommerce_wp_select(array('id' => 'wpc-metas[bounding_box][type]', 'value' => $clip_type, 'label' => __('Type', 'wpd') . ' (px)', 'description' => __('Bounding box type', 'wpd'), 'desc_tip' => 'true', 'options' => array("rect" => "Rectangle", "arc" => "Circle")));
woocommerce_wp_text_input(array('id' => 'wpc-metas[bounding_box][border_color]', 'value' => $clip_border, 'label' => __('Border color', 'wpd'), 'description' => __('Bounding box border color', 'wpd'), 'desc_tip' => 'true'));
}
示例13: if
<?php endif; ?>
<?php if (is_array($subscription->shipping_address) && !empty($subscription->shipping_address)): ?>
<p class="subscriptio_admin_address_paragaph">
<strong><?php _e('Shipping Address:', 'subscriptio'); ?>
<?php if (!$subscription->is_inactive()): ?>
<a id="subscriptio_admin_edit_address" href="#"><?php _e('[edit]', 'subscriptio'); ?></a>
<?php endif; ?>
</strong>
<span class="subscriptio_admin_address"><?php echo wp_kses(Subscriptio::get_formatted_shipping_address($subscription->shipping_address), array('br' => array())); ?></span>
</p>
<?php if (!$subscription->is_inactive()): ?>
<div class="subscriptio_admin_address_fields">
<?php foreach (Subscriptio_Subscription::get_admin_shipping_fields() as $key => $field): ?>
<?php if ($field['type'] == 'select'): ?>
<?php woocommerce_wp_select(array('id' => $key, 'value' => $subscription->shipping_address[$key], 'label' => $field['title'], 'options' => $field['values'])); ?>
<?php else: ?>
<?php woocommerce_wp_text_input(array('id' => $key, 'value' => $subscription->shipping_address[$key], 'label' => $field['title'])); ?>
<?php endif; ?>
<?php endforeach; ?>
<div class="subscriptio_admin_address_save">
<button type="submit" class="button subscriptio_save_address" name="subscriptio_subscription_button" value="address" title="<?php _e('Save Address', 'subscriptio'); ?>"><?php _e('Save Address', 'subscriptio'); ?></button>
<button class="button" id="subscriptio_cancel_address_edit" title="<?php _e('Cancel', 'subscriptio'); ?>"><?php _e('Cancel', 'subscriptio'); ?></button>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="subscription_data_content">
<h4><?php _e('Scheduled Events', 'subscriptio'); ?></h4>
示例14: pmprowoo_tab_options
function pmprowoo_tab_options()
{
global $membership_levels, $pmprowoo_product_levels;
$membership_level_options[0] = 'None';
foreach ($membership_levels as $option) {
$key = $option->id;
$membership_level_options[$key] = $option->name;
}
?>
<div id="pmprowoo_tab_data" class="panel woocommerce_options_panel">
<div class="options_group">
<p class="form-field"> <?php
// Membership Product
woocommerce_wp_select(array('id' => '_membership_product_level', 'label' => __('Membership Product', 'pmprowoo'), 'options' => $membership_level_options));
?>
</p>
</div>
<div class="options-group">
<p class="form-field">
<?php
// For each membership level, create respective price field
foreach ($membership_levels as $level) {
woocommerce_wp_text_input(array('id' => '_level_' . $level->id . '_price', 'label' => __($level->name . " Price", 'pmprowoo'), 'placeholder' => '', 'type' => 'text', 'desc_tip' => 'true', 'data_type' => 'price'));
}
?>
</p>
</div>
</div>
<?php
}
示例15: output
/**
* Output the metabox.
*
* @param WP_Post $post
*/
public static function output($post)
{
wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
$coupon = new WC_Coupon($post->ID);
?>
<style type="text/css">
#edit-slug-box, #minor-publishing-actions { display:none }
</style>
<div id="coupon_options" class="panel-wrap coupon_data">
<div class="wc-tabs-back"></div>
<ul class="coupon_data_tabs wc-tabs" style="display:none;">
<?php
$coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
foreach ($coupon_data_tabs as $key => $tab) {
?>
<li class="<?php
echo $key;
?>
_options <?php
echo $key;
?>
_tab <?php
echo implode(' ', (array) $tab['class']);
?>
">
<a href="#<?php
echo $tab['target'];
?>
"><?php
echo esc_html($tab['label']);
?>
</a>
</li><?php
}
?>
</ul>
<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php
// Type
woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
// Amount
woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
// Free Shipping
woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce'), 'https://docs.woocommerce.com/document/free-shipping/')));
// Expiry date
$expiry_date = $coupon->get_date_expires() ? date('Y-m-d', $coupon->get_date_expires()) : '';
woocommerce_wp_text_input(array('id' => 'expiry_date', 'value' => esc_attr($expiry_date), 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => esc_attr__('YYYY-MM-DD', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
do_action('woocommerce_coupon_options');
?>
</div>
<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php
echo '<div class="options_group">';
// minimum spend
woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
// maximum spend
woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
// Individual use
woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
// Exclude Sale Products
woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
echo '</div><div class="options_group">';
// Product ids
?>
<p class="form-field"><label><?php
_e('Products', 'woocommerce');
?>
</label>
<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="product_ids" data-placeholder="<?php
esc_attr_e('Search for a product…', 'woocommerce');
?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php
$product_ids = $coupon->get_product_ids();
$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($product->get_formatted_name());
}
}
echo esc_attr(json_encode($json_ids));
?>
" value="<?php
echo implode(',', array_keys($json_ids));
?>
" /> <?php
echo wc_help_tip(__('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce'));
?>
</p>
<?php
// Exclude Product ids
?>
<p class="form-field"><label><?php
_e('Exclude products', 'woocommerce');
?>
//.........这里部分代码省略.........