public function init_form_fields() { $woocommerce = WC(); $shippingCountries = method_exists($woocommerce->countries, 'get_shipping_countries') ? $woocommerce->countries->get_shipping_countries() : $woocommerce->countries->{'countries'}; $this->form_fields = array(array('type' => 'title', 'title' => __('Rule Settings', 'woowbs')), 'enabled' => array('title' => __('Enable/Disable', 'woowbs'), 'type' => 'checkbox', 'label' => __('Enable this rule', 'woowbs'), 'default' => 'yes'), 'name' => array('title' => __('Label', 'woowbs'), 'description' => __('This is an internal rule label, just for you. Customers don\'t see this.', 'woowbs'), 'type' => 'text', 'default' => sprintf($this->profile_id != 'main' ? __('rule #%s') : '%s', $this->profile_id)), 'title' => array('title' => __('Title', 'woowbs'), 'type' => 'text', 'description' => __('This controls the title which the customer sees during checkout.', 'woowbs'), 'default' => __('Weight Based Shipping', 'woowbs')), 'tax_status' => array('title' => __('Tax Status', 'woowbs'), 'type' => 'select', 'default' => 'taxable', 'class' => 'availability wc-enhanced-select', 'options' => array('taxable' => __('Taxable', 'woowbs'), 'none' => __('None', 'woowbs'))), array('type' => 'title', 'title' => __('Conditions', 'woowbs'), 'description' => __('Define when the delivery option should be shown to the customer. All the following conditions must be met to activate the rule.', 'woowbs')), 'availability' => array('title' => __('Destination', 'woowbs'), 'type' => 'select', 'default' => 'all', 'class' => 'availability wc-enhanced-select', 'options' => array('all' => __('All allowed countries', 'woowbs'), 'specific' => __('Specific countries', 'woowbs'), 'excluding' => __('All countries except specified', 'woowbs'))), 'countries' => array('title' => __('Specific Countries', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'multiselect', 'wbs_row_class' => 'wbs-destination', 'class' => 'chosen_select', 'default' => '', 'options' => $shippingCountries, 'custom_attributes' => array('data-placeholder' => __('Select some countries', 'woowbs')), 'html' => '<a class="select_all button" href="#">' . __('Select all', 'woowbs') . '</a> ' . '<a class="select_none button" href="#">' . __('Select none', 'woowbs') . '</a>' . $this->settingsHelper->premiumPromotionHtml('States/counties targeting')), 'weight' => array('title' => __('Order Weight', 'woowbs'), 'type' => 'wbs_range'), 'subtotal' => array('title' => __('Order Subtotal', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'wbs_range', 'wbs_row_class' => 'wbs-subtotal'), 'subtotal_with_tax' => array('title' => __('Subtotal With Tax', 'woowbs'), 'type' => 'checkbox', 'label' => __('After tax included', 'woowbs')), array('type' => 'title', 'title' => __('Costs', 'woowbs'), 'description' => __('This controls shipping price when this rule is active.', 'woowbs')), 'fee' => array('title' => __('Base Cost', 'woowbs'), 'type' => 'decimal', 'description' => __('Leave empty or zero if your shipping price has no flat part.', 'woowbs')), 'weight_rate' => array('title' => __('Weight Rate', 'woowbs'), 'type' => 'wbs_weight_rate', 'description' => __('Leave <code class="wbs-code">charge</code> field empty if your shipping price is flat.', 'woowbs') . '<br>' . __('Use <code class="wbs-code">over</code> field to skip weight part covered with Base Cost or leave it empty to charge for entire order weight.', 'woowbs')), 'shipping_class_rates' => array('title' => __('Shipping Classes', 'woowbs'), 'type' => 'shipping_class_rates', 'description' => __('You can override some options for specific shipping classes', 'woowbs')), array('type' => 'title', 'title' => __('Modificators', 'woowbs'), 'description' => __('With the following you can modify resulting shipping price', 'woowbs')), 'price_clamp' => array('title' => __('Limit Total Cost', 'woowbs'), 'type' => 'wbs_range', 'wbs_range_type' => 'simple', 'description' => __('If shipping price exceeds specified range it will be changed to either lower or upper bound appropriately.', 'woowbs'))); $placeholders = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol()); foreach ($this->form_fields as &$field) { $field['description'] = wbst(@$field['description'], $placeholders); } $this->form_fields = apply_filters('wbs_profile_settings_form', $this->form_fields, $this); }
public function htmlform() { $woocommerce = WC(); $htmlformval = array(array('type' => 'title', 'title' => __('Rule Settings', 'woowbs')), 'enabled' => array('title' => __('Enable/Disable', 'woowbs'), 'type' => 'checkbox', 'label' => __('Enable this rule', 'woowbs'), 'default' => '0', 'name' => 'weightShip_enable'), array('type' => 'title', 'title' => __('Conditions', 'woowbs'), 'description' => __('Define when the delivery option should be shown to the customer. All the following conditions must be met to activate the rule.', 'woowbs')), 'weight' => array('title' => __('Order Weight', 'woowbs'), 'type' => 'wbs_range', 'name' => 'weightShip_weight', 'totalcondition' => 1), 'subtotal' => array('title' => __('Order Subtotal', 'woowbs'), 'type' => 'wbs_custom', 'wbs_real_type' => 'wbs_range', 'wbs_row_class' => 'wbs-subtotal', 'name' => 'weightShip_subtotal', 'totalcondition' => 1), array('type' => 'title', 'title' => __('Maximum cart total / weight', 'woowbs'), 'description' => __('The total cost or weight after which shipping free.', 'woowbs')), 'maxiumm_weight' => array('title' => __('Maximum weight', 'woowbs'), 'type' => 'weight', 'description' => __('Leave empty if dont want to apply this rule.', 'woowbs'), 'default' => '0'), 'maximum_cost' => array('title' => __('Maximum Cost', 'woowbs'), 'type' => 'price', 'description' => __('Leave empty if dont want to apply this rule.'), 'default' => '0')); $placeholders = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol()); foreach ($htmlformval as &$field) { $field['description'] = wbst(@$field['description'], $placeholders); } $htmlformval['placholder'] = array('weight_unit' => __(get_option('woocommerce_weight_unit'), 'woowbs'), 'currency' => get_woocommerce_currency_symbol()); //$htmlformval = apply_filters('wbs_profile_settings_form', $this->form_fields, $this); return $htmlformval; }