css
10 months ago
img
10 months ago
js
10 months ago
partials
10 months ago
class-adv-order-filter.php
10 months ago
class-analytics.php
10 months ago
class-order-tip-promotion.php
10 months ago
class-pi-dtt-labels.php
10 months ago
class-pi-dtt-order-table.php
10 months ago
conflict-fixer.php
10 months ago
menu.php
10 months ago
options-addons.php
10 months ago
options-date.php
10 months ago
options-limit.php
10 months ago
options-pickup.php
10 months ago
options-time-slot.php
10 months ago
options-time.php
10 months ago
options.php
10 months ago
options.php
293 lines
| 1 | <?php |
| 2 | |
| 3 | class pisol_dtt_option{ |
| 4 | |
| 5 | private $settings = array(); |
| 6 | |
| 7 | private $active_tab; |
| 8 | |
| 9 | private $this_tab = 'default'; |
| 10 | |
| 11 | private $tab_name = "General setting"; |
| 12 | |
| 13 | private $setting_key = 'pisol_dtt_default'; |
| 14 | |
| 15 | private $pro_version = false; |
| 16 | |
| 17 | public $billing_fields = array( |
| 18 | 'billing_first_name'=>'Billing First Name', |
| 19 | 'billing_last_name'=>'Billing Last Name', |
| 20 | 'billing_address_1'=>'Billing Address 1', |
| 21 | 'billing_address_2'=>'Billing Address 2', |
| 22 | 'billing_country'=>'Billing Country', |
| 23 | 'billing_city'=>'Billing City', |
| 24 | 'billing_state'=>'Billing State', |
| 25 | 'billing_postcode'=>'Billing Postcode', |
| 26 | 'billing_company'=>'Billing Company', |
| 27 | 'billing_phone'=>'Billing Phone' |
| 28 | ); |
| 29 | |
| 30 | public $tab; |
| 31 | |
| 32 | public $preparation_days; |
| 33 | |
| 34 | function __construct(){ |
| 35 | |
| 36 | $this->pro_version = pi_dtt_pro_check(); |
| 37 | |
| 38 | $this->preparation_days = range(0, 100); |
| 39 | |
| 40 | $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab')); |
| 41 | $this->active_tab = $this->tab != "" ? $this->tab : 'default'; |
| 42 | |
| 43 | $this->migrationScript(); |
| 44 | |
| 45 | $this->settings = array( |
| 46 | |
| 47 | array('field'=>'color-setting', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label' => __('📦 Order Fulfillment Type Settings','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 48 | [ |
| 49 | "name" => "Know more about this ?", |
| 50 | "url" => "https://www.piwebsolution.com/user-documentation/#Order_Fulfillment_Type_Settings" |
| 51 | ] |
| 52 | ]), |
| 53 | |
| 54 | array('field'=>'pi_type', 'label'=>__('Enable Delivery, Pickup, or Both','pisol-dtt'),'desc'=> __('Choose whether to allow Delivery only, Pickup only, or let the customer choose between Delivery and Pickup during checkout.','pisol-dtt'), 'type'=>'radio', 'value'=>array('Both'=>__('Allow customer to choose: Delivery or Pickup','pisol-dtt'), 'Delivery' =>__('Only Delivery available','pisol-dtt'), 'Pickup'=>__('Only Pickup available','pisol-dtt')), 'default'=>"Both"), |
| 55 | |
| 56 | array('field'=>'pi_default_type', 'label'=>__('Default Fulfillment Type','pisol-dtt'),'desc'=>__('Choose whether "Delivery" or "Pickup" is pre-selected by default at checkout. This setting only applies when both options are enabled.','pisol-dtt'), 'type'=>'radio', 'value'=>array('delivery' =>__('Delivery','pisol-dtt'), 'pickup'=>__('Pickup','pisol-dtt')), 'default'=>'delivery'), |
| 57 | |
| 58 | array('field'=>'color-setting', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label' => __('📅 Date and Time Setting','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 59 | [ |
| 60 | "name" => "Know more about this ?", |
| 61 | "url" => "https://www.piwebsolution.com/user-documentation/#Date_and_time_setting" |
| 62 | ] |
| 63 | ]), |
| 64 | |
| 65 | array('field'=>'pi_datetime', 'label'=>__('Enable Date Selection','pisol-dtt'),'desc'=>__('Show date fields for delivery, pickup, or both during checkout.','pisol-dtt'), 'type'=>'radio', 'value'=>array('disable-both'=>__('Disabled for both Delivery and Pickup','pisol-dtt'), 'enable-both'=>__('Enabled for both Delivery and Pickup','pisol-dtt'), 'pickup-only'=>__("Enabled only for Pickup",'pisol-dtt'), 'delivery-only'=>__("Enabled only for Delivery",'pisol-dtt')), 'default'=>"enable-both"), |
| 66 | |
| 67 | array('field'=>'pi_enable_delivery_time', 'label'=>__('Enable Time Selection','pisol-dtt'),'desc'=> __('Show time selection for delivery, pickup, or both. <br><b>Note:</b> This will only work if Date selection is also enabled for the fulfillment type.','pisol-dtt'), 'type'=>'radio', 'value'=>array('enable-both'=>__('Enabled for both Delivery and Pickup','pisol-dtt'),'disable-both' =>__('Disabled for both Delivery and Pickup','pisol-dtt'), 'only-pickup'=>__('Enabled only for Pickup','pisol-dtt'),'only-delivery'=>__('Enabled only for Delivery','pisol-dtt') ), 'default'=>"enable-both", 'links' => [ |
| 68 | [ |
| 69 | "name" => "Know more about this ?", |
| 70 | "url" => "https://www.piwebsolution.com/user-documentation/#Enable_Time_Selection" |
| 71 | ] |
| 72 | ]), |
| 73 | |
| 74 | array('field'=>'pi_preorder_days', 'label'=>__('Preorder days','pisol-dtt'), 'desc'=>__('Set how many days in advance customers are allowed to schedule a delivery or pickup.<br><b>Example:</b> If set to 7, customers can select a date up to 7 days from today.','pisol-dtt'), 'type'=>'number', 'default'=>10, 'min'=> 0, 'links' => [ |
| 75 | [ |
| 76 | "name" => "Know how it works with order preparation days ?", |
| 77 | "url" => "https://www.piwebsolution.com/user-documentation/#Preorder_Days" |
| 78 | ] |
| 79 | ]), |
| 80 | |
| 81 | array('field'=>'pi_enable_different_preparation_time-pro', 'class'=> 'bg-dark opacity-75 text-light free-version force-white-text', 'default'=>0, 'type'=>'switch_category', 'label'=>__('Set different preparation time for Pickup & Delivery order','pisol-dtt'),'desc'=>__('Allow you to set different preparation time for pickup order','pisol-dtt')), |
| 82 | |
| 83 | array('field'=>'shop-preparation-time', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Use Same Preparation Time for Delivery and Pickup','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 84 | [ |
| 85 | "name" => "Know how it works with order preparation days ?", |
| 86 | "url" => "https://www.piwebsolution.com/user-documentation/#Set_Different_Preparation_Time_for_Pickup_Delivery_Order" |
| 87 | ] |
| 88 | ]), |
| 89 | |
| 90 | array('field'=>'pi_order_preparation_days', 'label'=>__('Order Preparation (Days)','pisol-dtt'), 'desc'=>__('Set the number of days needed to prepare an order before it can be delivered or picked up.','pisol-dtt'), 'type'=>'select', 'default'=> 1, 'value'=>$this->preparation_days), |
| 91 | array('field'=>'pi_order_preparation_hours', 'label'=>__('Order Preparation (Minutes)','pisol-dtt'), 'desc'=>__('Specify preparation time in minutes, only when "Order Preparation Days" is set to 0. Maximum allowed is 1439 minutes (i.e., less than a full day).','pisol-dtt'), 'type'=>'number', 'min'=> 0,'max'=>1439, 'default'=> 60), |
| 92 | |
| 93 | |
| 94 | |
| 95 | array('field'=>'color-setting', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('🕐 Time setting','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 96 | [ |
| 97 | "name" => "Know more about this ?", |
| 98 | "url" => "https://www.piwebsolution.com/user-documentation/#Time_setting" |
| 99 | ] |
| 100 | ]), |
| 101 | |
| 102 | array('field'=>'pi_use_time_slot', 'label'=>__('Delivery/Pickup Time Selection Style','pisol-dtt'),'desc'=> __('Choose how customers should select the delivery or pickup time: <br>Time Slot – Customers select from predefined time ranges (e.g., 2 PM – 3 PM, 3 PM – 4 PM).<br> |
| 103 | Single Time – Customers select a specific time point (e.g., 2 PM, 3 PM, 4 PM).','pisol-dtt'), 'type'=>'radio', 'value'=>array('all_slot'=>__('Use Time Slots for Both Delivery and Pickup','pisol-dtt'), 'all_range' =>__('Use Single Time Selection for Both Delivery and Pickup','pisol-dtt'), 'pickup_slot_delivery_range'=>__('Time Slots for Pickup, Single Time for Delivery','pisol-dtt'), 'delivery_slot_pickup_range'=>__('Time Slots for Delivery, Single Time for Pickup','pisol-dtt')), 'default'=>"all_slot", 'links' => [ |
| 104 | [ |
| 105 | "name" => "What is Time slot and Single time ?", |
| 106 | "url" => "https://www.piwebsolution.com/user-documentation/#DeliveryPickup_Time_Selection_Style" |
| 107 | ] |
| 108 | ]), |
| 109 | |
| 110 | |
| 111 | array('field'=>'pi_time_format', 'label'=>__('Time Display Format','pisol-dtt'),'desc'=>__('Choose whether to display time in 12-hour format (e.g., 2:00 PM) or 24-hour format (e.g., 14:00).','pisol-dtt'), 'type'=>'radio', 'value'=>array('h:mm p' =>__('12HR (1:30 PM)','pisol-dtt'), 'H:mm'=>__('24HR (13:30)','pisol-dtt'), 'H:mm p'=>__('24HR with AM PM (13:30 PM)','pisol-dtt')), 'default'=>'h:mm p'), |
| 112 | |
| 113 | array('field'=>'pi_time_interval', 'label'=>__('Time Interval (in Minutes)','pisol-dtt'), 'type'=>'select', 'value'=>array(5 =>__('5 minutes','pisol-dtt'), 10 =>__('10 minutes','pisol-dtt'), 15 =>__('15 minutes','pisol-dtt'), 20=>__('20 minutes','pisol-dtt'), 30=>__('30 minutes','pisol-dtt'), 40=>__('40 minutes','pisol-dtt'), 50=>__('50 minutes','pisol-dtt'), 60=>__('1 hr','pisol-dtt'), 120=>__('2 hour','pisol-dtt'), 180=>__('3 hour','pisol-dtt'), 240=>__('4 hour','pisol-dtt'), 300=>__('5 hour','pisol-dtt'), 360=>__('6 hour','pisol-dtt')), 'default'=>15,'desc'=>__('Set the gap between two time ranges when using the Time Range method. This setting does not apply to the Time Slot method.','pisol-dtt')), |
| 114 | |
| 115 | array('field'=>'color-setting1002', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('📱 WooCommerce mobile app support','pisol-dtt'), 'type'=>'setting_category'), |
| 116 | |
| 117 | array('field'=>'pi_enable_woocommerce_app_support', 'default'=> 1, 'type'=>'switch', 'label'=>__('Enable WooCommerce App Support','pisol-dtt'),'desc'=>__('Adds delivery date, time, and pickup location details to the order note so they are visible in the WooCommerce mobile app.','pisol-dtt'), 'links' => [ |
| 118 | [ |
| 119 | "name" => "Want to know more about this ?", |
| 120 | "url" => "https://www.piwebsolution.com/user-documentation/#Enable_WooCommerce_App_Support" |
| 121 | ] |
| 122 | ]), |
| 123 | |
| 124 | array('field'=>'same-day-cutoff-section', 'class'=> 'bg-dark opacity-75 text-light hide-pro', 'class_title'=>'text-light font-weight-light h6', 'label'=>__('🕐 Same day Delivery/Pickup Cutoff time (Only useful when order preparation days is 0)','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 125 | [ |
| 126 | "name" => "Know more about this ?", |
| 127 | "url" => "https://www.piwebsolution.com/user-documentation/#Same-Day_DeliveryPickup_Cutoff_Time" |
| 128 | ] |
| 129 | ]), |
| 130 | |
| 131 | array('field'=>'pi_same_day_delivery_cutoff_time-pro', 'label'=>__('Same Day delivery cutoff time','pisol-dtt'), 'desc'=>__('Once this time goes by today, user cant place a delivery order for today date','pisol-dtt'), 'type'=>'text', 'pro'=>true), |
| 132 | |
| 133 | array('field'=>'pi_same_day_pickup_cutoff_time-pro', 'label'=>__('Same Day pickup cutoff time','pisol-dtt'), 'desc'=>__('Once this time goes by today, user cant place a pickup order for today date','pisol-dtt'), 'type'=>'text', 'pro'=>true), |
| 134 | |
| 135 | array('field'=>'next-day-cutoff-section', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h6', 'label'=>__('🕐 Next day Delivery/Pickup Cutoff time (Only useful when order preparation days is less then 2)','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 136 | [ |
| 137 | "name" => "Know more about this ?", |
| 138 | "url" => "https://www.piwebsolution.com/user-documentation/#Next-Day_DeliveryPickup_Cutoff_Time" |
| 139 | ] |
| 140 | ]), |
| 141 | |
| 142 | array('field'=>'pi_next_day_delivery_cutoff_time-pro', 'label'=>__('Next Day delivery cutoff time','pisol-dtt'), 'desc'=>__('Once this time goes by today, user cant place a delivery order for tomorrows date','pisol-dtt'), 'type'=>'text', 'pro'=>true), |
| 143 | |
| 144 | array('field'=>'pi_next_day_pickup_cutoff_time-pro', 'label'=>__('Next Day pickup cutoff time','pisol-dtt'), 'desc'=>__('Once this time goes by today, user cant place a pickup order for tomorrows date','pisol-dtt'), 'type'=>'text', 'pro'=>true), |
| 145 | |
| 146 | array('field'=>'color-setting1', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('🛒 Checkout Setting','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 147 | [ |
| 148 | "name" => "Know more about this ?", |
| 149 | "url" => "https://www.piwebsolution.com/user-documentation/#Checkout_Setting" |
| 150 | ] |
| 151 | ]), |
| 152 | |
| 153 | array('field'=>"pi_date_time_location-pro",'type'=>'radio', 'label'=>__('Position of Delivery Options on Checkout Page','pisol-dtt'), 'desc'=>__('Choose where the delivery/pickup, date, time, and location fields should appear in the checkout form layout.<br><b>⚠ Note:</b> This setting only applies to classic checkout pages rendered using the [woocommerce_checkout] shortcode. It does not work with block-based checkout pages','pisol-dtt'), 'default'=>'woocommerce_checkout_before_customer_details', 'value'=>array('woocommerce_checkout_before_customer_details'=>__('Above Customer Details Section','pisol-dtt'), 'woocommerce_checkout_after_customer_details'=>__('Below Customer Details Section','pisol-dtt'), 'woocommerce_after_order_notes'=> __('Below Order Notes','pisol-dtt'), 'woocommerce_before_order_notes'=> __('Above Order Notes','pisol-dtt')), 'pro'=>true), |
| 154 | |
| 155 | array('field'=>'pi_time_required-pro', 'default'=>'1', 'type'=>'radio', 'label'=>__('Require Delivery Time at Checkout'),'desc'=>__('Make the time field mandatory during checkout. <br>Note: If the date is not required, time will remain optional.','pisol-dtt'),'value'=>array('0'=>__('Non required in pickup and delivery','pisol-dtt'), '1'=>__('Required in pickup and delivery','pisol-dtt'), 'pickup-required'=>__('Required in pickup','pisol-dtt'), 'delivery-required'=>__('Required in delivery','pisol-dtt')), 'pro'=>true), |
| 156 | |
| 157 | array('field'=>'pi_date_required-pro', 'default'=>'1', 'type'=>'radio', 'label'=>__('Require Delivery Date at Checkout','pisol-dtt'),'desc'=>__('Make the date field mandatory during checkout. <br>Note: If date is not required, time will also be optional by default.','pisol-dtt'),'value'=>array('0'=>__('Non required in pickup and delivery','pisol-dtt'), '1'=>__('Required in pickup and delivery','pisol-dtt'), 'pickup-required'=>__('Required in pickup','pisol-dtt'), 'delivery-required'=>__('Required in delivery','pisol-dtt')), 'pro'=>true), |
| 158 | |
| 159 | array('field'=>'pi_dtt_remove_billing_when_pickup-pro','desc'=>'Select fields you want to remove from checkout When delivery type is Pickup (This option does not work if your checkout page is made using WooCommerce checkout Block)', 'label'=>__('Remove checkout fields when Pickup','pi-dcw'),'type'=>'multiselect','default'=>array_keys($this->billing_fields), 'value'=>$this->billing_fields,'pro'=>true), |
| 160 | |
| 161 | array('field'=>'pi_dtt_remove_billing_when_delivery-pro','desc'=>'Select fields you want to remove from checkout When delivery type is Delivery (This option does not work if your checkout page is made using WooCommerce checkout Block)', 'label'=>__('Remove checkout fields when Delivery','pi-dcw'),'type'=>'multiselect','default'=>array_keys($this->billing_fields), 'value'=>$this->billing_fields,'pro'=>true), |
| 162 | |
| 163 | |
| 164 | |
| 165 | array('field'=>'color-setting1', 'class'=> 'bg-dark opacity-75 text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Shipping method option for pickup type','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 166 | [ |
| 167 | "name" => "Watch video for explanation", |
| 168 | "url" => "https://www.youtube.com/watch?v=7RxtizKSSTw" |
| 169 | ], |
| 170 | [ |
| 171 | "name" => "Read more about this", |
| 172 | "url" => "https://www.piwebsolution.com/user-documentation/#Shipping_Method_Settings_for_Pickup" |
| 173 | ] |
| 174 | ]), |
| 175 | |
| 176 | array('field'=>'pi_remove_shipping_method-pro', 'label'=>__('Remove shipping method','pisol-dtt'),'desc'=> __('If enabled it will remove all shipping method when pickup delivery type is selected, if disabled it will try to select the WooCommerce "local pickup" shipping method (provided it is available) , if local pickup is available it will be selected and other method will not be allowed to select','pisol-dtt'), 'type'=>'switch', 'default'=>1, 'pro'=>true), |
| 177 | |
| 178 | array('field'=>'pi_show_as_dropdown-pro', 'default'=>0, 'type'=>'switch', 'label'=>__('Show pickup location as Dropdown','pisol-dtt'),'desc'=>__('If you have large number of pickup location then you can show then as dropdown instead of showing them as full address as radio button','pisol-dtt'),'pro'=>true), |
| 179 | |
| 180 | array('field'=>'color-setting1', 'class'=> 'bg-dark opacity-75 text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Checkout form fields as per delivery type','pisol-dtt'), 'type'=>'setting_category'), |
| 181 | |
| 182 | |
| 183 | |
| 184 | array('field'=>'pi_first_day_in_calender-pro', 'label'=>__('First day in calender','pisol-dtt'), 'type'=>'select', 'value'=>array(1 =>__('Monday','pisol-dtt'), 2=>__('Tuesday','pisol-dtt'), 3=>__('Wednesday','pisol-dtt'), 4=>__('Thursday','pisol-dtt'), 5=>__('Friday','pisol-dtt'), 6=>__('Saturday','pisol-dtt'), 7=>__('Sunday','pisol-dtt')), 'default'=>1,'desc'=>__('Using this you can change the order of the Week on the front end calender, when you select "monday" calender will start from monday, when you select sunday calender will start from sunday as first day of the week','pisol-dtt'), 'pro'=>true), |
| 185 | |
| 186 | array('field'=>'pi_enable_zone_for_location-pro', 'default'=>0, 'type'=>'switch', 'label'=>__('Enable shipping zone option for pickup location','pisol-dtt'),'desc'=>__('you can assign shipping zone to pickup location, so the buyer will only see those pickup location that you have assigned for there shipping zones, E.g: if you have pickup location in all the states in your country so instead of showing all you will assign each pickup location a shipping zone (zones will be based on city) so the buyer will only see the pickup location near to there city','pisol-dtt'),'pro'=>true), |
| 187 | |
| 188 | array('field'=>'color-setting1', 'class'=> 'bg-dark opacity-75 text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Remove plugin fields if virtual product in cart','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 189 | [ |
| 190 | "name" => "Read more about this", |
| 191 | "url" => "https://www.piwebsolution.com/user-documentation/#Disable_Plugin_for_Virtual_Products_in_Cart" |
| 192 | ] |
| 193 | ]), |
| 194 | |
| 195 | array('field'=>'pi_virtual_product_disable_plugin-pro', 'label'=>__('Disable plugin if there is any virtual product in customer cart','pisol-dtt'),'desc'=> __('you can either do nothing and leave the plugin active, or you can deactivate plugin setting if there is even single virtual product present in the customer cart, or if there are more virtual product in cart then physical product','pisol-dtt'), 'type'=>'select', 'value'=>array('dont_disable'=>__('Don\'t disable','pisol-dtt'), 'virtual_present' =>__('If there is even single virtual product in cart','pisol-dtt'), 'large_no_virtual'=>__('Disable if there are more virtual product then normal product','pisol-dtt'), 'all_virtual'=>__('Disable if all are virtual product in cart','pisol-dtt')), 'default'=>"dont_disable", 'pro'=>true), |
| 196 | |
| 197 | array('field'=>'color-setting100', 'class'=> 'bg-dark opacity-75 text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Payment method options (control which payment method to show for which delivery type)','pisol-dtt'), 'type'=>'setting_category', 'links' => [ |
| 198 | [ |
| 199 | "name" => "Read more about this", |
| 200 | "url" => "https://www.piwebsolution.com/user-documentation/#Payment_Method_Options" |
| 201 | ] |
| 202 | ]), |
| 203 | |
| 204 | array('field'=>'pi_remove_payment_methods_for_delivery-pro','desc'=>__('Select payment methods you want to remove for delivery','pisol-dtt'), 'label'=>__('Remove Payment methods for Delivery order','pisol-dtt'),'type'=>'multiselect','default'=>array(), 'value'=>$this->paymentMethods(),'pro'=>true), |
| 205 | |
| 206 | array('field'=>'pi_remove_payment_methods_for_pickup-pro','desc'=>__('Select payment methods you want to remove for pickup','pisol-dtt'), 'label'=>__('Remove Payment methods for Pickup order','pisol-dtt'),'type'=>'multiselect','default'=>array(), 'value'=>$this->paymentMethods(), 'pro'=>true), |
| 207 | |
| 208 | ); |
| 209 | |
| 210 | |
| 211 | if($this->this_tab == $this->active_tab){ |
| 212 | add_action('pisol_dtt_tab_content', array($this,'tab_content')); |
| 213 | } |
| 214 | |
| 215 | add_action('pisol_dtt_tab', array($this,'tab'),1); |
| 216 | |
| 217 | $this->register_settings(); |
| 218 | |
| 219 | if(PISOL_DTT_FREE_RESET_SETTING){ |
| 220 | $this->delete_settings(); |
| 221 | } |
| 222 | |
| 223 | } |
| 224 | |
| 225 | function delete_settings(){ |
| 226 | foreach($this->settings as $setting){ |
| 227 | delete_option( $setting['field'] ); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | function paymentMethods(){ |
| 232 | $gateways = WC()->payment_gateways->get_available_payment_gateways(); |
| 233 | $enabled_gateways = []; |
| 234 | |
| 235 | if( !empty($gateways) ) { |
| 236 | foreach( $gateways as $gateway ) { |
| 237 | |
| 238 | if( $gateway->enabled == 'yes' ) { |
| 239 | |
| 240 | $enabled_gateways[$gateway->id] = $gateway->title; |
| 241 | |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | return $enabled_gateways; |
| 246 | } |
| 247 | |
| 248 | function register_settings(){ |
| 249 | |
| 250 | foreach($this->settings as $setting){ |
| 251 | pisol_class_form::register_setting( $this->setting_key, $setting); |
| 252 | } |
| 253 | |
| 254 | } |
| 255 | |
| 256 | function tab(){ |
| 257 | $page = sanitize_text_field(filter_input( INPUT_GET, 'page')); |
| 258 | $this->tab_name = __('General setting','pisol-dtt'); |
| 259 | ?> |
| 260 | <a class=" pi-side-menu <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page='.$page.'&tab='.$this->this_tab ) ); ?>"> |
| 261 | <span class="dashicons dashicons-admin-home"></span> <?php echo esc_html($this->tab_name); ?> |
| 262 | </a> |
| 263 | <?php |
| 264 | } |
| 265 | |
| 266 | function tab_content(){ |
| 267 | ?> |
| 268 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 269 | <?php settings_fields( $this->setting_key ); ?> |
| 270 | <?php |
| 271 | foreach($this->settings as $setting){ |
| 272 | new pisol_class_form($setting, $this->setting_key); |
| 273 | } |
| 274 | ?> |
| 275 | <input type="submit" name="submit" id="submit" class="btn btn-primary btn-md my-3" value="<?php echo esc_attr__('Save Changes','pisol-dtt'); ?>"> |
| 276 | </form> |
| 277 | <?php |
| 278 | } |
| 279 | |
| 280 | function migrationScript(){ |
| 281 | $date_time = get_option('pi_datetime', 'enable-both'); |
| 282 | |
| 283 | if($date_time == '0') update_option('pi_datetime', 'disable-both'); |
| 284 | |
| 285 | if($date_time == '1') update_option('pi_datetime', 'enable-both'); |
| 286 | } |
| 287 | |
| 288 | } |
| 289 | |
| 290 | add_action('wp_loaded',function(){ |
| 291 | new pisol_dtt_option(); |
| 292 | }); |
| 293 |