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; } } } }
/** * Add price input to product simple metabox */ function product_options_countries_prices() { foreach (WCPBC()->get_regions() as $key => $value) { $_regular_price = get_post_meta(get_the_ID(), '_' . $key . '_regular_price', true); $_sale_price = get_post_meta(get_the_ID(), '_' . $key . '_sale_price', true); $_price_method = empty($_regular_price) ? 'exchange_rate' : 'manual'; $_display = $_price_method == 'exchange_rate' ? 'none' : 'block'; ?> <div class="options_group show_if_simple show_if_external"> <?php woocommerce_wp_radio(array('id' => '_' . $key . '_price_method', 'value' => $_price_method, 'class' => 'wcpbc_price_method', 'label' => __('Price for', 'wc-price-based-country') . ' ' . $value['name'] . ' (' . get_woocommerce_currency_symbol($value['currency']) . ')', 'options' => array('exchange_rate' => __('Calculate price by applying exchange rate.', 'wc-price-based-country'), 'manual' => __('Set price manually.', 'wc-price-based-country')))); ?> <div style="display:<?php echo $_display; ?> "> <p class="form-field"> <label><?php echo __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol($value['currency']) . ')'; ?> </label> <input type="text" id="<?php echo '_' . $key . '_regular_price'; ?> " name="<?php echo '_' . $key . '_regular_price'; ?> " value="<?php echo wc_format_localized_price($_regular_price); ?> " class="short wc_input_price" placeholder="" /> </p> <p class="form-field"> <label><?php echo __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol($value['currency']) . ')'; ?> </label> <input type="text" id="<?php echo '_' . $key . '_sale_price'; ?> " name="<?php echo '_' . $key . '_sale_price'; ?> " value="<?php echo wc_format_localized_price($_sale_price); ?> " class="short wc_input_price wcpbc_sale_price" /> </p> </div> </div> <?php } }
<?php } else { ?> <?php _e('Shipment was not quoted with FlagShip Shipping.', FLAGSHIP_SHIPPING_TEXT_DOMAIN); ?> <hr/> <?php if (isset($requote_rates)) { ?> <p><?php _e('Latest rates', FLAGSHIP_SHIPPING_TEXT_DOMAIN); ?> :</p> <?php woocommerce_wp_radio(array('name' => 'flagship_shipping_service', 'options' => $requote_rates)); ?> <hr/> <button type="submit" class="button button-primary flagship-shipping-action" data-shipment-action="shipment-create"><?php _e('Create shipment', FLAGSHIP_SHIPPING_TEXT_DOMAIN); ?> </button> <button type="submit" class="button flagship-shipping-action" data-shipment-action="shipment-requote"><?php _e('Requote', FLAGSHIP_SHIPPING_TEXT_DOMAIN); ?> </button> <?php } else { ?> <button type="submit" class="button button-primary flagship-shipping-action" data-shipment-action="shipment-requote"><?php _e('Get a quote', FLAGSHIP_SHIPPING_TEXT_DOMAIN);
public static function custom_tab_options_price_per_word_character_settings_display() { global $post, $pagenow; /** * price_per_word_character options */ $_price_per_word_character = get_post_meta($post->ID, '_price_per_word_character', true); $field_value_price_per_word_character = $_price_per_word_character ? $_price_per_word_character : 'word'; /** * Enable Price breaks */ $post_meta_price_breaks_enabled = get_post_meta($post->ID, '_is_enable_price_breaks', true); $field_value_price_breaks_enabled = 'yes'; $field_callback_price_breaks_enabled = $post_meta_price_breaks_enabled ? $post_meta_price_breaks_enabled : 'no'; if (isset($post_meta_price_breaks_enabled) && $post_meta_price_breaks_enabled == 'yes') { $_price_breaks_serialize = get_post_meta($post->ID, '_price_breaks_array', true); $_price_breaks_array = maybe_unserialize($_price_breaks_serialize); } ?> <div id="custom_tab_data_woocommerce_price_word_character_tab" class="panel woocommerce_options_panel" style="display: none;"> <div class="options_group"> <?php woocommerce_wp_radio(array('options' => array("word" => "Price per Word", "character" => "Price per Character"), 'name' => '_price_per_word_character', 'value' => $field_value_price_per_word_character, 'id' => '_price_per_word_character', 'label' => __('Set Price Per Word OR Price Per Character', 'woocommerce-price-per-word'), 'desc_tip' => 'true', 'description' => __('Choose whether to set pricing based on the number of words in a document or the number of characters', 'woocommerce-price-per-word'))); ?> </div> <div class="options_group word_count_cap"> <div class="options_group word_count_cap_status"> <?php woocommerce_wp_checkbox(array('id' => '_word_count_cap_status', 'label' => __('Enable ' . $field_value_price_per_word_character . ' count cap?', 'woocommerce-price-per-word'), 'cbvalue' => 'open', 'value' => esc_attr($post->_word_count_cap_status), 'desc_tip' => 'true', 'description' => __('Enable this option and then set a ' . $field_value_price_per_word_character . ' limit to deny orders that do not meet your limit.', 'woocommerce-price-per-word'))); woocommerce_wp_text_input(array('id' => '_word_count_cap_word_limit', 'label' => __(ucfirst($field_value_price_per_word_character) . ' limit', 'woocommerce-price-per-word'), 'desc_tip' => true, 'description' => __('Enter the maximum word limit to accept uploaded file words.', 'woocommerce-price-per-word'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '1'))); ?> </div> </div> <div class="options_group price-breaks-section"> <?php woocommerce_wp_checkbox(array('name' => '_is_enable_price_breaks', 'value' => $field_value_price_breaks_enabled, 'cbvalue' => $field_callback_price_breaks_enabled, 'id' => '_is_enable_price_breaks', 'label' => __('Enable price breaks?', 'woocommerce-price-per-word'), 'desc_tip' => 'true', 'description' => __('Enable to set multiple prices for multiple levels.', 'woocommerce-price-per-word'))); ?> <div id="price-breaks-container"> <?php $show_price_breaks = $field_callback_price_breaks_enabled == "yes" ? "display:block" : "display:none"; ?> <table id="price-breaks-list" style="<?php echo $show_price_breaks; ?> "> <thead> <tr> <th class="min-title-head"><?php _e('Min ' . ucwords($field_value_price_per_word_character) . 's', 'woocommerce-price-per-word'); ?> </th> <th class="max-title-head"><?php _e('Max ' . ucwords($field_value_price_per_word_character) . 's', 'woocommerce-price-per-word'); ?> </th> <th class="price-title-head"><?php _e('Price (' . get_woocommerce_currency_symbol() . ')', 'woocommerce-price-per-word'); ?> </th> <th></th> </tr> </thead> <tbody> <?php $first_min = isset($_price_breaks_array) && isset($_price_breaks_array[0]["min"]) ? $_price_breaks_array[0]["min"] : ""; $first_max = isset($_price_breaks_array) && isset($_price_breaks_array[0]["max"]) ? $_price_breaks_array[0]["max"] : ""; $first_price = isset($_price_breaks_array) && isset($_price_breaks_array[0]["price"]) ? $_price_breaks_array[0]["price"] : ""; ?> <tr class="prototype"> <td width="25%"><input type="text" name="price-breaks-min[]" value="<?php echo !empty($first_min) ? $first_min : 0; ?> " class="" readonly/></td> <td width="25%"><input type="text" name="price-breaks-max[]" value="<?php echo !empty($first_max) ? $first_max : '>'; ?> " /></td> <td width="25%"><input type="text" name="price-breaks-price[]" value="<?php echo $first_price; ?> "/></td> <td width="25%"> <a href="javascript:void(0);" class="remove">Remove</a> </td> </tr> <?php if (isset($_price_breaks_array) && !empty($_price_breaks_array)) { for ($row = 1; $row < count($_price_breaks_array); $row++) { ?> <tr class=""> <td width="25%"><input type="text" name="price-breaks-min[]" value="<?php echo $_price_breaks_array[$row]["min"]; ?> " class="" readonly/></td> <td width="25%"><input type="text" name="price-breaks-max[]" value="<?php echo $_price_breaks_array[$row]["max"]; ?> " /> </td> <td width="25%"><input type="text" name="price-breaks-price[]" value="<?php echo $_price_breaks_array[$row]["price"]; ?> "/> </td> <td width="25%"> <a href="javascript:void(0);" class="remove">Remove</a> </td> </tr> <?php } } ?> </tbody> <tfoot> <tr> <td><a href="javascript:void(0);" class="add">Add row</a></td> <td colspan="3"><span style="color: #FF0000; font-weight:bold;">NOTE: Use a > symbol in the Max Words column to indicate that any amount larger than Min Words will be accepted.</span> </td> </tr> </tfoot> </table> </div> </div> </div> <?php }
/** * Контент блока нашли девле */ function cr_woocommerce_pick_up_in_store_options() { global $post; $pick_text = get_post_meta($post->ID, '_pick_text', true); $pick_summ = get_post_meta($post->ID, '_pick_summ', true); $pick_link = get_post_meta($post->ID, '_pick_link', true); $block_store_border = get_post_meta($post->ID, '_block_store_border', true); $block_shipping_kog = get_post_meta($post->ID, '_block_shipping_kog', true); ?> <div id="cr_pick_up_in_store_tab" class="panel woocommerce_options_panel"> <div class="club-opening-hours"> <fieldset class="form-field"> <div class="wrap"> <?php woocommerce_wp_radio(array('id' => '_shop_zab_4', 'label' => __('Когда', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => $block_shipping_kog, 'options' => array('no' => __('недоступно', 'woocommerce'), 'one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <p> <label>Ссылка с блока: </label> <input type="text" class="short" name="_pick_text" id="_pick_text" value="<?php echo $pick_link; ?> "/> </p> <p> <label>Сумма премии: </label> <input type="text" class="short" name="_pick_summt" id="_pick_summ" value="<?php echo $pick_summ; ?> "/> </p> <p> <label>Текст блока: </label> <textarea class="short" row="2" cols="20" name="_button_text" id="_favorites_text"><?php echo $pick_text; ?> </textarea> </p> <p> <label for="_block_store_border">Не включать разделитель: </label> <input type="checkbox" name="_block_store_border" id="_block_store_border" value="1" <?php checked($block_store_border); ?> /> </p> </div> </fieldset> </div> </div> <!-- <script>--> <!-- (function( $ ) {--> <!-- // Add Color Picker to all inputs that have 'color-field' class--> <!-- $(function() {--> <!-- $('.color-field').wpColorPicker();--> <!-- });--> <!-- })( jQuery );--> <!-- </script>--> <?php }
/** * Контент блока магазины */ function cr_shops_tab_options() { global $post; $prise = get_post_meta($post->ID, '_bonus_price', true); $title = get_post_meta($post->ID, '_bonus_title', true); $text = get_post_meta($post->ID, '_bonus_text', true); $color = get_post_meta($post->ID, '_bonus_color', true); $block_bonus_border = get_post_meta($post->ID, '_block_bonus_border', true); ?> <div id="cr_shops" class="panel woocommerce_options_panel"> <style> #cr_shops .woocommerce_options_panel legend{ margin: 0; } </style> <div class="club-opening-hours"> <fieldset class="form-field"> <div class="wrap"> <h3>г. Минск </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_1', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_1', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_1', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_1', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <h3>г.Могилев </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_2', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_2', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_2', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_2', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <h3>г.Витебск </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_3', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_3', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_3', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_3', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <h3>г. Гродно </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_4', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_4', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_4', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_4', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <h3>г. Брест </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_5', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_5', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_5', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_5', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> <h3>г. Гомель </h3> <?php woocommerce_wp_radio(array('id' => '_shop_nal_6', 'label' => __('Наличие', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_nal_6', true), 'options' => array('one' => __('Мало', 'woocommerce'), 'two' => __('Средне', 'woocommerce'), 'three' => __('Много', 'woocommerce')))); ?> <?php woocommerce_wp_radio(array('id' => '_shop_zab_6', 'label' => __('Забрать', 'woocommerce'), 'description' => __('Выберите значение.', 'woocommerce'), 'value' => get_post_meta($post->ID, '_shop_zab_6', true), 'options' => array('one' => __('Сегодня', 'woocommerce'), 'two' => __('Завтра', 'woocommerce'), 'three' => __('В течении недели', 'woocommerce')))); ?> </div> </fieldset> </div> </div> <?php }