1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
<?php
include_once( 'prdd-view-deliveries.php' );
include_once( 'prdd-license.php' );
include_once( 'prdd-delivery-labels-settings.php' );
include_once( 'prdd-delivery-settings.php' );
include_once( 'includes/ts-google-calendar-sync-settings.php' );
class prdd_global_menu{
public static function prdd_woocommerce_admin_menu(){
add_menu_page( 'Product Delivery Date', 'Product Delivery Date', 'manage_woocommerce', 'prdd_settings', array( 'prdd_global_menu', 'prdd_woocommerce_prdd_page' ) );
$page = add_submenu_page( 'prdd_settings', __( 'View Deliveries', 'woocommerce-prdd' ), __( 'View Deliveries', 'woocommerce-prdd' ), 'manage_woocommerce', 'woocommerce_prdd_history_page', array( 'view_deliveries', 'prdd_woocommerce_prdd_history_page' ) );
$page = add_submenu_page( 'prdd_settings', __( 'Settings', 'woocommerce-prdd' ), __( 'Settings', 'woocommerce-prdd' ), 'manage_woocommerce', 'woocommerce_prdd_page', array( 'prdd_global_menu', 'prdd_woocommerce_prdd_page' ) );
$page = add_submenu_page( 'prdd_settings', __( 'Activate License', 'woocommerce-prdd' ), __( 'Activate License', 'woocommerce-prdd' ), 'manage_woocommerce', 'prdd_license_page', array( 'prdd_license', 'prdd_get_edd_sample_license_page' ) );
remove_submenu_page( 'prdd_settings', 'prdd_settings' );
do_action( 'prdd_add_submenu' );
}
public static function prdd_delivery_labels() {
add_settings_section(
'prdd_delivery_product_page_labels_section',
__( 'Labels on product page', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_delivery_product_page_labels_section_callback' ),
'prdd_labels_page'
);
add_settings_field(
'delivery_date-label',
__( 'Delivery Date:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_date_label_callback' ),
'prdd_labels_page',
'prdd_delivery_product_page_labels_section',
array ( __( 'Delivery Date label on product page.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_time-label',
__( 'Delivery Time:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_time_label_callback' ),
'prdd_labels_page',
'prdd_delivery_product_page_labels_section',
array ( __( 'Delivery Time label on the product page.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_time-select-option',
__( 'Choose Time Text:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_time_select_option_callback' ),
'prdd_labels_page',
'prdd_delivery_product_page_labels_section',
array ( __( 'Text for the 1st option of Time Slot dropdown field that instructs the customer to select a time slot.', 'woocommerce-prdd' ) )
);
add_settings_section(
'prdd_delivery_order_received_page_labels_section',
__( 'Labels on order received page and in email notification', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_delivery_order_received_page_labels_section_callback' ),
'prdd_labels_page'
);
add_settings_field(
'delivery_item-meta-date',
__( 'Delivery Date:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_meta_date_callback' ),
'prdd_labels_page',
'prdd_delivery_order_received_page_labels_section',
array ( __( 'Delivery Date label on the order received page and email notification.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_item-meta-time',
__( 'Delivery Time:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_meta_time_callback' ),
'prdd_labels_page',
'prdd_delivery_order_received_page_labels_section',
array ( __( 'Delivery Time label on the order received page and email notification.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_ics-file-name',
__( 'ICS File Name:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_ics_file_name_callback' ),
'prdd_labels_page',
'prdd_delivery_order_received_page_labels_section',
array ( __( 'ICS File name.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_item-meta-charges',
__( 'Delivery Charges:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_meta_charges_callback' ),
'prdd_labels_page',
'prdd_delivery_order_received_page_labels_section',
array ( __( 'Delivery Charges label on the order received page and email notification.', 'woocommerce-prdd' ) )
);
add_settings_section(
'prdd_delivery_cart_page_labels_section',
__( 'Labels on Cart & Check-out Page', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_delivery_cart_page_labels_section_callback' ),
'prdd_labels_page'
);
add_settings_field(
'delivery_item-cart-date',
__( 'Delivery Date:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_cart_date_callback' ),
'prdd_labels_page',
'prdd_delivery_cart_page_labels_section',
array ( __( 'Delivery Date label on the cart and checkout page.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_item-cart-time',
__( 'Delivery Time:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_cart_time_callback' ),
'prdd_labels_page',
'prdd_delivery_cart_page_labels_section',
array ( __( 'Delivery Time label on the cart and checkout page.', 'woocommerce-prdd' ) )
);
add_settings_field(
'delivery_item-cart-charges',
__( 'Delivery Charges:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'delivery_item_cart_charges_callback' ),
'prdd_labels_page',
'prdd_delivery_cart_page_labels_section',
array ( __( 'Delivery Charges label on the cart and checkout page.', 'woocommerce-prdd' ) )
);
add_settings_section(
'prdd_estimate_delivery_section',
__( 'Labels for Estimate Delivery Option', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_estimate_delivery_section_callback' ),
'prdd_labels_page'
);
add_settings_field(
'prdd_estimate_delivery_header',
__( 'Estimate Delivery section heading:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_estimate_delivery_header_callback' ),
'prdd_labels_page',
'prdd_estimate_delivery_section'
);
add_settings_field(
'prdd_estimate_delivery_days_text',
__( 'Estimate Delivery display in days text:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_estimate_delivery_days_text_callback' ),
'prdd_labels_page',
'prdd_estimate_delivery_section',
array( __( '<br>Use {{business.days}} shortcode to replace it with the number of business days required for delivery', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_estimate_delivery_date_text',
__( 'Estimate Delivery display with specific date text:', 'woocommerce-prdd' ),
array( 'prdd_delivery_labels_settings', 'prdd_estimate_delivery_date_text_callback' ),
'prdd_labels_page',
'prdd_estimate_delivery_section',
array( __( '<br>Use {{expected.date}} shortcode to replace it with the expected date of delivery', 'woocommerce-prdd' ) )
);
register_setting(
'prdd_labels',
'delivery_date-label'
);
register_setting(
'prdd_labels',
'delivery_time-label'
);
register_setting(
'prdd_labels',
'delivery_time-select-option'
);
register_setting(
'prdd_labels',
'delivery_item-meta-date'
);
register_setting(
'prdd_labels',
'delivery_item-meta-time'
);
register_setting(
'prdd_labels',
'delivery_ics-file-name'
);
register_setting(
'prdd_labels',
'delivery_item-meta-charges'
);
register_setting(
'prdd_labels',
'delivery_item-cart-date'
);
register_setting(
'prdd_labels',
'delivery_item-cart-time'
);
register_setting(
'prdd_labels',
'delivery_item-cart-charges'
);
register_setting(
'prdd_labels',
'prdd_estimate_delivery_header'
);
register_setting(
'prdd_labels',
'prdd_estimate_delivery_days_text'
);
register_setting(
'prdd_labels',
'prdd_estimate_delivery_date_text'
);
}
public static function prdd_delivery_settings() {
add_settings_section(
'prdd_delivery_settings_section',
__( 'Settings', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_delivery_settings_section_callback' ),
'prdd_settings_page'
);
add_settings_field(
'prdd_language',
__( 'Language', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_language_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Choose the language for your delivery calendar.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_date_format',
__( 'Date Format', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_date_format_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'The format in which the delivery date appears to the customers on the product page once the date is selected.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_time_format',
__( 'Time Format', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_time_format_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'The format in which the delivery time appears to the customers on the product page once the date is selected.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_months',
__( 'Number of months to show in calendar', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_months_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'The number of months to be shown on the calendar. If the delivery dates spans across 2 months, then dates of 2 months can be shown simultaneously without the need to press Next or Back buttons.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_calendar_day',
__( 'First Day on Calendar', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_calendar_day_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Choose the first day of week displayed on the Delivery Date calendar.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_add_to_calendar',
__( 'Show "Add to Calendar" button on Order Received page', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_add_to_calendar_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Shows the \'Add to Calendar\' button on the Order Received page. On clicking the button, an ICS file will be downloaded.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_add_to_email',
__( 'Send delivery information as attachments (ICS files) in email notifications', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_add_to_email_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Allow customers to export deliveries as ICS file after placing an order. Sends ICS files as attachments in email notifications.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_theme',
__( 'Preview Theme & Language', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_theme_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Select the theme for the calendar. You can choose a theme which blends with the design of your website.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_global_holidays',
__( 'No delivery on these dates', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_global_holidays_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Select dates for which the delivery will be completely disabled for all the products in your WooCommerce store. <br> The dates selected here will be unavailable for all products. Please click on the date in calendar to add or delete the date from the list.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_enable_rounding',
__( 'Enable Rounding of Prices', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_enable_rounding_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Rounds the Price to the nearest Integer value.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_global_selection',
__( 'Duplicate dates from first product in the cart to other products:', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_global_selection_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array ( __( 'Please select this checkbox if you want to select the date globally for All products once selected for a product and added to cart.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_availability_display',
__( 'Enable Availability Display on the Product page:', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_availability_display_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array( __( 'Please select this checkbox if you want to display the number of deliveries available for a given product on a given date and time.', 'woocommerce-prdd' ) )
);
add_settings_field(
'prdd_disable_price_calculation_on_dates',
__( 'Apply one-time delivery charges for multiple products:', 'woocommerce-prdd' ),
array( 'prdd_delivery_settings', 'prdd_disable_price_calculation_on_dates_callback' ),
'prdd_settings_page',
'prdd_delivery_settings_section',
array( __( 'Select this checkbox to restrict delivery charges to apply only once for multiple products with the same delivery date in the cart.', 'woocommerce-prdd' ) )
);
register_setting(
'prdd_settings',
'woocommerce_prdd_global_settings',
array( 'prdd_delivery_settings', 'woocommerce_prdd_global_settings_save_callback' )
);
}
public static function prdd_woocommerce_prdd_page() {
if ( isset( $_GET[ 'action' ] ) ) {
$action = $_GET[ 'action' ];
} else {
$action = '';
}
if ( $action == 'settings' || $action == '' ) {
$active_settings = "nav-tab-active";
} else {
$active_settings = '';
}
if ( $action == 'labels' ) {
$active_labels = "nav-tab-active";
} else {
$active_labels = '';
}
if ( $action == 'prdd_google_calendar_sync' ) {
$active_google_sync = "nav-tab-active";
} else {
$active_google_sync = '';
}
settings_errors();
?>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
<a href="admin.php?page=woocommerce_prdd_page&action=settings" class="nav-tab <?php echo $active_settings; ?>"> <?php _e( 'Global Delivery Settings', 'woocommerce-prdd' );?> </a>
<a href="admin.php?page=woocommerce_prdd_page&action=labels" class="nav-tab <?php echo $active_labels; ?>"> <?php _e( 'Field Labels', 'woocommerce-prdd' );?> </a>
<a href="admin.php?page=woocommerce_prdd_page&action=prdd_google_calendar_sync" class="nav-tab <?php echo $active_google_sync; ?>"> <?php _e( 'Google Calendar Sync', 'woocommerce-prdd' );?> </a>
</h2>
<?php
if( $action == 'labels' ) {
print( '<div id="content">
<form method="post" action="options.php">' );
settings_fields( "prdd_labels" );
do_settings_sections( "prdd_labels_page" );
submit_button ( __( 'Save Settings', 'woocommerce-prdd' ), 'primary', 'save', true );
print('</form>
</div>');
}
if( $action == 'settings' || $action == '' ) {
print( '<div id="content">
<form method="post" action="options.php">' );
settings_fields( "prdd_settings" );
do_settings_sections( "prdd_settings_page" );
submit_button ( __( 'Save Settings', 'woocommerce-prdd' ), 'primary', 'save', true );
print('</form>
</div>');
}
if( $action == 'prdd_google_calendar_sync' ) {
print( '<div id="content">
<form method="post" action="options.php">' );
settings_fields( "ts_google_calendar_sync" );
do_settings_sections( "ts_google_calendar_sync_page" );
submit_button ( __( 'Save Settings', 'woocommerce-prdd' ), 'primary', 'save', true );
print('</form>
</div>');
}
}
}
?>