/** * Load admin javascript */ static function admin_load_javascript() { $screen = get_current_screen(); // Only for order edit screen if ($screen->id == 'shop_order') { global $post; $order = new Bring_WC_Order_Adapter(new WC_Order($post->ID)); $make_items_editable = !$order->order->is_editable(); if (isset($_GET['booking_step'])) { $make_items_editable = false; } if ($order->is_booked()) { $make_items_editable = false; } wp_register_script('fraktguiden-common', plugins_url('assets/js/pickup-point-common.js', dirname(__FILE__)), array('jquery'), '##VERSION##', true); wp_register_script('fraktguiden-pickup-point-admin', plugins_url('assets/js/pickup-point-admin.js', dirname(__FILE__)), array('jquery'), '##VERSION##', true); wp_localize_script('fraktguiden-pickup-point-admin', '_fraktguiden_data', ['ajaxurl' => admin_url('admin-ajax.php'), 'services' => Fraktguiden_Helper::get_all_services(), 'i18n' => self::get_i18n(), 'make_items_editable' => $make_items_editable]); wp_enqueue_script('fraktguiden-common'); wp_enqueue_script('fraktguiden-pickup-point-admin'); } }
/** * Default settings. * * @return void */ public function init_form_fields() { global $woocommerce; $services = Fraktguiden_Helper::get_all_services(); // @todo $wc_log_dir = ''; if (defined('WC_LOG_DIR')) { $wc_log_dir = WC_LOG_DIR; } $this->form_fields = ['general_options_title' => ['type' => 'title', 'title' => __('Shipping Options', 'bring-fraktguiden')], 'enabled' => array('title' => __('Enable', 'bring-fraktguiden'), 'type' => 'checkbox', 'label' => __('Enable Bring Fraktguiden', 'bring-fraktguiden'), 'default' => 'no'), 'title' => array('title' => __('Title', 'bring-fraktguiden'), 'type' => 'text', 'desc_tip' => __('This controls the title which the user sees during checkout.', 'bring-fraktguiden'), 'default' => __('Bring Fraktguiden', 'bring-fraktguiden')), 'handling_fee' => array('title' => __('Delivery Fee', 'bring-fraktguiden'), 'type' => 'text', 'desc_tip' => __('What fee do you want to charge for Bring, disregarded if you choose free. Leave blank to disable.', 'bring-fraktguiden'), 'default' => ''), 'post_office' => array('title' => __('Post office', 'bring-fraktguiden'), 'type' => 'checkbox', 'label' => __('Shipping from post office', 'bring-fraktguiden'), 'desc_tip' => __('Flag that tells whether the parcel is delivered at a post office when it is shipped.', 'bring-fraktguiden'), 'default' => 'no'), 'from_zip' => array('title' => __('From zip', 'bring-fraktguiden'), 'type' => 'text', 'desc_tip' => __('This is the zip code of where you deliver from. For example, the post office.', 'bring-fraktguiden'), 'default' => ''), 'from_country' => array('title' => __('From country', 'bring-fraktguiden'), 'type' => 'select', 'desc_tip' => __('This is the country of origin where you deliver from (If omitted WooCommerce\'s default location will be used. See WooCommerce - Settings - General)', 'bring-fraktguiden'), 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => $woocommerce->countries->get_base_country(), 'options' => Fraktguiden_Helper::get_nordic_countries()), 'vat' => array('title' => __('Display price', 'bring-fraktguiden'), 'type' => 'select', 'desc_tip' => __('How to calculate delivery charges', 'bring-fraktguiden'), 'default' => 'include', 'options' => array('include' => __('VAT included', 'bring-fraktguiden'), 'exclude' => __('VAT excluded', 'bring-fraktguiden'))), 'evarsling' => array('title' => __('Recipient notification', 'bring-fraktguiden'), 'type' => 'checkbox', 'label' => __('Recipient notification over SMS or E-Mail', 'bring-fraktguiden'), 'desc_tip' => __('If not checked, Fraktguiden will add a fee for paper based recipient notification.<br/>If checked, the recipient will receive notification over SMS or E-mail when the parcel has arrived.<br/>Applies to Bedriftspakke, Klimanøytral Servicepakke and Bedriftspakke Ekspress-Over natten 09', 'bring-fraktguiden'), 'default' => 'no'), 'availability' => array('title' => __('Method availability', 'bring-fraktguiden'), 'type' => 'select', 'default' => 'all', 'class' => 'availability', 'options' => array('all' => __('All allowed countries', 'bring-fraktguiden'), 'specific' => __('Specific Countries', 'bring-fraktguiden'))), 'countries' => array('title' => __('Specific Countries', 'bring-fraktguiden'), 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', 'options' => $woocommerce->countries->countries), 'services' => array('title' => __('Services', 'bring-fraktguiden'), 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', 'options' => $services), 'service_name' => array('title' => __('Display Service As', 'bring-fraktguiden'), 'type' => 'select', 'desc_tip' => __('The service name displayed to the customer', 'bring-fraktguiden'), 'default' => 'DisplayName', 'options' => array('DisplayName' => __('Display Name', 'bring-fraktguiden'), 'ProductName' => __('Product Name', 'bring-fraktguiden'))), 'display_desc' => array('title' => __('Display Description', 'bring-fraktguiden'), 'type' => 'checkbox', 'label' => __('Add description after the service', 'bring-fraktguiden'), 'desc_tip' => __('Show service description after the name of the service', 'bring-fraktguiden'), 'default' => 'no'), 'max_products' => array('title' => __('Max products', 'bring-fraktguiden'), 'type' => 'text', 'desc_tip' => __('Maximum of products in the cart before offering a flat rate', 'bring-fraktguiden'), 'default' => self::DEFAULT_MAX_PRODUCTS), 'alt_flat_rate' => array('title' => __('Flat rate', 'bring-fraktguiden'), 'type' => 'text', 'desc_tip' => __('Offer a flat rate if the cart reaches max products or a product in the cart does not have the required dimensions', 'bring-fraktguiden'), 'default' => self::DEFAULT_ALT_FLAT_RATE), 'debug' => array('title' => __('Debug', 'bring-fraktguiden'), 'type' => 'checkbox', 'label' => __('Enable debug logs', 'bring-fraktguiden'), 'description' => __('These logs will be saved in', 'bring-fraktguiden') . ' <code>' . $wc_log_dir . '</code>', 'default' => 'no')]; }