Version Description
- Fix - Fixed shipping provider search issue in Shipping provider settings page
- Dev - Improve code quality and security
- Enhancement - Added go pro lightbox in shipping provider page and integration page
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 3.2.6 |
Comparing to | |
See all releases |
Code changes from version 3.2.5 to 3.2.6
- assets/css/admin.css +83 -3
- assets/images/WooCommerce-PDF-Invoices-Packing-Slips.png +0 -0
- assets/images/WooCommerce-PDF-Invoices.png +0 -0
- assets/images/aliexpress.png +0 -0
- assets/images/customcat.png +0 -0
- assets/images/dear-system.png +0 -0
- assets/images/ordoro.png +0 -0
- assets/images/quickbooks.png +0 -0
- assets/images/readytoship.png +0 -0
- assets/images/royal-mail.png +0 -0
- assets/images/shipstation.png +0 -0
- assets/images/woo-UPS-shipping.png +0 -0
- assets/images/woo-shipping.png +0 -0
- assets/js/admin.js +1 -1
- assets/js/customizer-scripts.js +2 -0
- assets/js/settings.js +53 -0
- assets/js/shipping_row.js +4 -0
- includes/api/class-wc-advanced-shipment-tracking-rest-api-controller.php +44 -35
- includes/class-wc-admin-notices.php +7 -7
- includes/class-wc-advanced-shipment-tracking-admin-notice.php +81 -11
- includes/class-wc-advanced-shipment-tracking-admin.php +483 -259
- includes/class-wc-advanced-shipment-tracking-api-call.php +13 -13
- includes/class-wc-advanced-shipment-tracking-front.php +65 -59
- includes/class-wc-advanced-shipment-tracking-install.php +14 -14
- includes/class-wc-advanced-shipment-tracking-late-shipments.php +19 -19
- includes/class-wc-advanced-shipment-tracking-license.php +0 -173
- includes/class-wc-advanced-shipment-tracking-settings.php +43 -37
- includes/class-wc-advanced-shipment-tracking-trackship.php +180 -162
- includes/class-wc-advanced-shipment-tracking.php +165 -139
- includes/customizer/class-trackship-customizer.php +50 -52
- includes/customizer/class-wc-availableforpickup-email-customizer.php +62 -47
- includes/customizer/class-wc-delivered-email-customizer.php +65 -51
- includes/customizer/class-wc-exception-email-customizer.php +59 -49
- includes/customizer/class-wc-failure-email-customizer.php +63 -48
- includes/customizer/class-wc-intransit-email-customizer.php +68 -53
- includes/customizer/class-wc-late-shipments-email-customizer.php +6 -4
- includes/customizer/class-wc-onhold-email-customizer.php +65 -49
- includes/customizer/class-wc-outfordelivery-email-customizer.php +59 -49
- includes/customizer/class-wc-partial-shipped-email-customizer.php +37 -36
- includes/customizer/class-wc-returntosender-email-customizer.php +63 -48
- includes/customizer/class-wc-tracking-info-customizer.php +94 -87
- includes/customizer/class-wc-tracking-page-customizer.php +13 -14
- includes/customizer/class-wc-updated-tracking-email-customizer.php +36 -34
- includes/customizer/class-wcast-customizer.php +59 -62
- includes/customizer/custom-controls.php +25 -25
- includes/customizer/preview/availableforpickup_preview.php +16 -15
- includes/customizer/preview/delivered_status_preview.php +16 -15
- includes/customizer/preview/exception_preview.php +16 -15
- includes/customizer/preview/failure_preview.php +14 -14
- includes/customizer/preview/intransit_preview.php +14 -14
- includes/customizer/preview/late_shipments_preview.php +20 -20
- includes/customizer/preview/onhold_preview.php +9 -9
- includes/customizer/preview/outfordelivery_preview.php +14 -15
- includes/customizer/preview/partial_shipped_preview.php +20 -21
- includes/customizer/preview/preview.php +20 -21
- includes/customizer/preview/returntosender_preview.php +17 -17
- includes/customizer/preview/tracking_page_preview.php +16 -15
- includes/customizer/preview/updated_tracking_preview.php +17 -16
- includes/email-manager.php +7 -7
- includes/emails/class-shipment-partial-shipped-email.php +6 -6
- includes/emails/class-shipment-updated-tracking-email.php +5 -5
- includes/tracking-info.php +2 -4
- includes/trackship-email-manager.php +33 -33
- includes/views/admin_options_addons.php +37 -30
- includes/views/admin_options_bulk_upload.php +21 -21
- includes/views/admin_options_osm.php +31 -27
- includes/views/admin_options_settings.php +11 -11
- includes/views/admin_options_shipping_provider.php +51 -46
- includes/views/admin_options_tools.php +7 -6
- includes/views/admin_options_trackship_integration.php +4 -4
- includes/views/admin_status_notifications.php +51 -45
- includes/views/admin_trackship_dashboard.php +37 -31
- includes/views/front/layout1_tracking_details.php +153 -64
- includes/views/front/preview_tracking_page.php +21 -22
- includes/views/front/tracking_page_header.php +17 -15
- includes/views/integrations_admin_options.php +26 -0
- readme.txt +6 -1
- templates/emails/customer-partial-shipped-order.php +3 -3
- templates/emails/customer-updated-tracking-order.php +3 -3
- templates/emails/plain/tracking-info.php +13 -12
- templates/emails/tracking-info.php +177 -147
- templates/emails/wcast-billing-email-addresses.php +1 -1
- templates/emails/wcast-email-order-details.php +29 -26
- templates/emails/wcast-email-order-items.php +2 -2
- templates/emails/wcast-shipping-email-addresses.php +2 -1
- templates/myaccount/tracking-info.php +156 -130
- templates/tracking/tracking-form.php +6 -6
- woocommerce-advanced-shipment-tracking.php +63 -63
assets/css/admin.css
CHANGED
@@ -381,7 +381,7 @@ input.tab_input_1:checked + label{
|
|
381 |
.tab_inner_container h4 {
|
382 |
margin-top: 0;
|
383 |
}
|
384 |
-
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3, #tab4:checked ~ #content4, #tab5:checked ~ #content5, #tab6:checked ~ #content6, #tab7:checked ~ #content7, #tab8:checked ~ #content8, #tab9:checked ~ #content9, #tab10:checked ~ #content10,#tab_trackship_dashboard:checked ~ #content_trackship_dashboard,#tab_trackship_settings:checked ~ #content_trackship_settings,#tab_tracking_page:checked ~ #content_tracking_page,#tab_status_notifications:checked ~ #content_status_notifications,#tab_tools:checked ~ #content_tools, #tab_license:checked ~ #content_tab_license, #tab_addons:checked ~ #content_tab_addons, #tab_osm:checked ~ #content_osm, #trackship_tab:checked ~ #content_trackship_dashboard, #trackship:checked ~ #trackship_landing {
|
385 |
display: block !important;
|
386 |
}
|
387 |
#tab_email_notifications:checked ~ .shipment-status-email-section,#tab_sms_notifications:checked ~ .shipment-status-sms-section{
|
@@ -2334,7 +2334,8 @@ ul.csv_error_details_ul li:before{
|
|
2334 |
}
|
2335 |
.ast_pro_features_list li{
|
2336 |
margin: 0 0 10px;
|
2337 |
-
padding: 0 0 0
|
|
|
2338 |
position: relative;
|
2339 |
}
|
2340 |
.ast_pro_features_list li:before{
|
@@ -2342,7 +2343,7 @@ ul.csv_error_details_ul li:before{
|
|
2342 |
font-family: dashicons;
|
2343 |
font-size: 28px;
|
2344 |
vertical-align: middle;
|
2345 |
-
color: #
|
2346 |
padding-right: 5px;
|
2347 |
position: absolute;
|
2348 |
left: 0;
|
@@ -2372,6 +2373,85 @@ ul.csv_error_details_ul li:before{
|
|
2372 |
z-index: 1000000 !important;
|
2373 |
}
|
2374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2375 |
/*** RTL CSS ***/
|
2376 |
.rtl .tabs_submit{
|
2377 |
left: 20px;
|
381 |
.tab_inner_container h4 {
|
382 |
margin-top: 0;
|
383 |
}
|
384 |
+
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3, #tab4:checked ~ #content4, #tab5:checked ~ #content5, #tab6:checked ~ #content6, #tab7:checked ~ #content7, #tab8:checked ~ #content8, #tab9:checked ~ #content9, #tab10:checked ~ #content10,#tab_trackship_dashboard:checked ~ #content_trackship_dashboard,#tab_trackship_settings:checked ~ #content_trackship_settings,#tab_tracking_page:checked ~ #content_tracking_page,#tab_status_notifications:checked ~ #content_status_notifications,#tab_tools:checked ~ #content_tools, #tab_license:checked ~ #content_tab_license, #tab_addons:checked ~ #content_tab_addons, #tab_osm:checked ~ #content_osm, #trackship_tab:checked ~ #content_trackship_dashboard, #trackship:checked ~ #trackship_landing,#integrations_tab:checked ~ #integrations_content {
|
385 |
display: block !important;
|
386 |
}
|
387 |
#tab_email_notifications:checked ~ .shipment-status-email-section,#tab_sms_notifications:checked ~ .shipment-status-sms-section{
|
2334 |
}
|
2335 |
.ast_pro_features_list li{
|
2336 |
margin: 0 0 10px;
|
2337 |
+
padding: 0 0 0 30px;
|
2338 |
+
line-height: 20px;
|
2339 |
position: relative;
|
2340 |
}
|
2341 |
.ast_pro_features_list li:before{
|
2343 |
font-family: dashicons;
|
2344 |
font-size: 28px;
|
2345 |
vertical-align: middle;
|
2346 |
+
color: #3bc4e4;
|
2347 |
padding-right: 5px;
|
2348 |
position: absolute;
|
2349 |
left: 0;
|
2373 |
z-index: 1000000 !important;
|
2374 |
}
|
2375 |
|
2376 |
+
/** Integration Panel CSS ***/
|
2377 |
+
.integration-grid-row {
|
2378 |
+
display: flex;
|
2379 |
+
flex-flow: row wrap;
|
2380 |
+
justify-content: flex-start;
|
2381 |
+
border-top: 1px solid #e0e0e0;
|
2382 |
+
padding-top: 5px;
|
2383 |
+
}
|
2384 |
+
.integration-grid-row .grid-item {
|
2385 |
+
flex-basis: 20%;
|
2386 |
+
-ms-flex: auto;
|
2387 |
+
width: 250px;
|
2388 |
+
position: relative;
|
2389 |
+
padding: 10px 15px 10px 0;
|
2390 |
+
box-sizing: border-box;
|
2391 |
+
}
|
2392 |
+
.integration-grid-row .grid-item-wrapper {
|
2393 |
+
border: 1px solid #e0e0e0;
|
2394 |
+
text-align:center;
|
2395 |
+
}
|
2396 |
+
.integration-grid-row .grid-item-wrapper img {
|
2397 |
+
width: 85%;
|
2398 |
+
padding: 15px 0;
|
2399 |
+
}
|
2400 |
+
.integration-grid-row .grid-img-bottom {
|
2401 |
+
border-top: 1px solid #e0e0e0;
|
2402 |
+
padding: 10px;
|
2403 |
+
text-align:left;
|
2404 |
+
}
|
2405 |
+
.integration-grid-row .integration-more-info{
|
2406 |
+
float: right;
|
2407 |
+
color: #005b9a;
|
2408 |
+
cursor: pointer;
|
2409 |
+
text-decoration: none;
|
2410 |
+
}
|
2411 |
+
@media(max-width: 1333px) {
|
2412 |
+
.integration-grid-row .grid-item {
|
2413 |
+
flex-basis: 33.33%;
|
2414 |
+
}
|
2415 |
+
}
|
2416 |
+
|
2417 |
+
@media(max-width: 1073px) {
|
2418 |
+
.integration-grid-row .grid-item {
|
2419 |
+
flex-basis: 33.33%;
|
2420 |
+
}
|
2421 |
+
}
|
2422 |
+
|
2423 |
+
@media(max-width: 815px) {
|
2424 |
+
.integration-grid-row .grid-item {
|
2425 |
+
flex-basis: 50%;
|
2426 |
+
}
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
@media(max-width: 555px) {
|
2430 |
+
.integration-grid-row .grid-item {
|
2431 |
+
flex-basis: 100%;
|
2432 |
+
}
|
2433 |
+
}
|
2434 |
+
/** End CSS ***/
|
2435 |
+
|
2436 |
+
.upgrade_to_pro_popup .popuprow{
|
2437 |
+
max-width: 400px;
|
2438 |
+
}
|
2439 |
+
.upgrade_title{
|
2440 |
+
font-size: 26px;
|
2441 |
+
font-weight: 700;
|
2442 |
+
text-align: center;
|
2443 |
+
margin: 10px 0 30px;
|
2444 |
+
color: #3c4758;
|
2445 |
+
}
|
2446 |
+
.wp-core-ui .upgrade_to_pro_popup .btn_large{
|
2447 |
+
font-weight: 600;
|
2448 |
+
font-size: 18px;
|
2449 |
+
width: 100%;
|
2450 |
+
text-align: center;
|
2451 |
+
height: 50px;
|
2452 |
+
line-height: 47px;
|
2453 |
+
}
|
2454 |
+
|
2455 |
/*** RTL CSS ***/
|
2456 |
.rtl .tabs_submit{
|
2457 |
left: 20px;
|
assets/images/WooCommerce-PDF-Invoices-Packing-Slips.png
ADDED
Binary file
|
assets/images/WooCommerce-PDF-Invoices.png
ADDED
Binary file
|
assets/images/aliexpress.png
ADDED
Binary file
|
assets/images/customcat.png
ADDED
Binary file
|
assets/images/dear-system.png
ADDED
Binary file
|
assets/images/ordoro.png
ADDED
Binary file
|
assets/images/quickbooks.png
ADDED
Binary file
|
assets/images/readytoship.png
ADDED
Binary file
|
assets/images/royal-mail.png
ADDED
Binary file
|
assets/images/shipstation.png
ADDED
Binary file
|
assets/images/woo-UPS-shipping.png
ADDED
Binary file
|
assets/images/woo-shipping.png
ADDED
Binary file
|
assets/js/admin.js
CHANGED
@@ -423,7 +423,7 @@ jQuery(document).on("click", ".inline_tracking_delete", function(){
|
|
423 |
var r = confirm( 'Do you really want to delete tracking number?' );
|
424 |
if (r === true) {
|
425 |
var tracking_id = jQuery( this ).attr( 'rel' );
|
426 |
-
var nonce = jQuery( this ).
|
427 |
var order_id = jQuery( this ).data( 'order' );
|
428 |
jQuery( '#tracking-item-' + tracking_id ).block({
|
429 |
message: null,
|
423 |
var r = confirm( 'Do you really want to delete tracking number?' );
|
424 |
if (r === true) {
|
425 |
var tracking_id = jQuery( this ).attr( 'rel' );
|
426 |
+
var nonce = jQuery( this ).data( 'nonce' );
|
427 |
var order_id = jQuery( this ).data( 'order' );
|
428 |
jQuery( '#tracking-item-' + tracking_id ).block({
|
429 |
message: null,
|
assets/js/customizer-scripts.js
CHANGED
@@ -147,9 +147,11 @@ jQuery('#customize-footer-actions .preview-tablet').click(function(e) {
|
|
147 |
jQuery(document).on("change", ".preview_order_select", function(){
|
148 |
var wcast_preview_order_id = jQuery(this).val();
|
149 |
var data = {
|
|
|
150 |
action: 'update_email_preview_order',
|
151 |
wcast_preview_order_id: wcast_preview_order_id,
|
152 |
};
|
|
|
153 |
jQuery.ajax({
|
154 |
url: ajaxurl,
|
155 |
data: data,
|
147 |
jQuery(document).on("change", ".preview_order_select", function(){
|
148 |
var wcast_preview_order_id = jQuery(this).val();
|
149 |
var data = {
|
150 |
+
security: wcast_customizer.customizer_nonce,
|
151 |
action: 'update_email_preview_order',
|
152 |
wcast_preview_order_id: wcast_preview_order_id,
|
153 |
};
|
154 |
+
console.log(data);
|
155 |
jQuery.ajax({
|
156 |
url: ajaxurl,
|
157 |
data: data,
|
assets/js/settings.js
CHANGED
@@ -14,6 +14,59 @@ jQuery(document).on("click", "#wc_ast_status_shipped_active", function(){
|
|
14 |
}
|
15 |
});
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
jQuery( document ).ready(function() {
|
18 |
|
19 |
jQuery( '.tipTip' ).tipTip( {
|
14 |
}
|
15 |
});
|
16 |
|
17 |
+
jQuery(document).on("click", "#wc_ast_status_partial_shipped", function(){
|
18 |
+
if(jQuery(this).prop("checked") == true){
|
19 |
+
jQuery(this).closest('tr').removeClass('disable_row');
|
20 |
+
var nonce = jQuery( '#wc_ast_settings_form_nonce' ).val();
|
21 |
+
var ajax_data = {
|
22 |
+
action: 'update_custom_order_status_email_display',
|
23 |
+
status: 'partial-shipped',
|
24 |
+
security: nonce,
|
25 |
+
};
|
26 |
+
jQuery.ajax({
|
27 |
+
url: ajaxurl,
|
28 |
+
data: ajax_data,
|
29 |
+
type: 'POST',
|
30 |
+
success: function(response) {
|
31 |
+
jQuery('.partially_shipped_checkbox').show();
|
32 |
+
jQuery('.partially_shipped_checkbox input[type="checkbox"]').prop('checked', true);
|
33 |
+
},
|
34 |
+
error: function(response) {
|
35 |
+
}
|
36 |
+
});
|
37 |
+
|
38 |
+
} else{
|
39 |
+
jQuery(this).closest('tr').addClass('disable_row');
|
40 |
+
jQuery('.partially_shipped_checkbox').hide();
|
41 |
+
}
|
42 |
+
});
|
43 |
+
jQuery(document).on("click", "#wc_ast_status_updated_tracking", function(){
|
44 |
+
if(jQuery(this).prop("checked") == true){
|
45 |
+
|
46 |
+
jQuery(this).closest('tr').removeClass('disable_row');
|
47 |
+
|
48 |
+
var ajax_data = {
|
49 |
+
action: 'update_custom_order_status_email_display',
|
50 |
+
status: 'updated-tracking',
|
51 |
+
};
|
52 |
+
jQuery.ajax({
|
53 |
+
url: ajaxurl,
|
54 |
+
data: ajax_data,
|
55 |
+
type: 'POST',
|
56 |
+
success: function(response) {
|
57 |
+
jQuery('.updated_tracking_checkbox').show();
|
58 |
+
jQuery('.updated_tracking_checkbox input[type="checkbox"]').prop('checked', true);
|
59 |
+
},
|
60 |
+
error: function(response) {
|
61 |
+
}
|
62 |
+
});
|
63 |
+
|
64 |
+
} else{
|
65 |
+
jQuery(this).closest('tr').addClass('disable_row');
|
66 |
+
jQuery('.updated_tracking_checkbox').hide();
|
67 |
+
}
|
68 |
+
});
|
69 |
+
|
70 |
jQuery( document ).ready(function() {
|
71 |
|
72 |
jQuery( '.tipTip' ).tipTip( {
|
assets/js/shipping_row.js
CHANGED
@@ -941,6 +941,10 @@ jQuery(document).on("click", "#reset_providers", function(){
|
|
941 |
});
|
942 |
});
|
943 |
|
|
|
|
|
|
|
|
|
944 |
jQuery(document).on("click", ".sync_providers", function(){
|
945 |
jQuery('.sync_provider_popup').show();
|
946 |
jQuery("#reset_tracking_providers").prop("checked", false);
|
941 |
});
|
942 |
});
|
943 |
|
944 |
+
jQuery(document).on("click", ".upgrade_to_ast_pro", function(){
|
945 |
+
jQuery('.upgrade_to_pro_popup').show();
|
946 |
+
});
|
947 |
+
|
948 |
jQuery(document).on("click", ".sync_providers", function(){
|
949 |
jQuery('.sync_provider_popup').show();
|
950 |
jQuery("#reset_tracking_providers").prop("checked", false);
|
includes/api/class-wc-advanced-shipment-tracking-rest-api-controller.php
CHANGED
@@ -35,9 +35,9 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
35 |
protected $post_type = 'shop_order';
|
36 |
|
37 |
/**
|
38 |
-
*
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
public function set_namespace( $namespace ) {
|
43 |
$this->namespace = $namespace;
|
@@ -93,7 +93,7 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
93 |
'schema' => array( $this, 'get_public_item_schema' ),
|
94 |
) );
|
95 |
|
96 |
-
if(!function_exists('trackship_for_woocommerce')){
|
97 |
|
98 |
//disconnect_from_trackship
|
99 |
register_rest_route( $this->namespace, '/disconnect_from_trackship', array(
|
@@ -145,7 +145,7 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
145 |
/*
|
146 |
* check_wcast_installed_from_third_party_tool
|
147 |
*/
|
148 |
-
public function check_wcast_installed_from_third_party_tool( $request ){
|
149 |
|
150 |
$data = array(
|
151 |
'status' => 'installed'
|
@@ -156,22 +156,24 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
156 |
/*
|
157 |
* check_wcast_installed
|
158 |
*/
|
159 |
-
public function check_wcast_installed( $request ){
|
|
|
160 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
161 |
$wc_ast_api_enabled = get_option('wc_ast_api_enabled');
|
162 |
-
|
163 |
-
|
|
|
164 |
}
|
165 |
|
166 |
-
if($wc_ast_api_enabled
|
167 |
-
update_option('wc_ast_api_enabled',1);
|
168 |
}
|
169 |
|
170 |
-
if($request['trackers_balance']){
|
171 |
update_option( 'trackers_balance', $request['trackers_balance'] );
|
172 |
}
|
173 |
|
174 |
-
$trackship = new WC_Advanced_Shipment_Tracking_Trackship;
|
175 |
$trackship->create_tracking_page();
|
176 |
|
177 |
$data = array(
|
@@ -180,12 +182,11 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
180 |
return rest_ensure_response( $data );
|
181 |
}
|
182 |
|
183 |
-
public function tracking_webhook( $request ){
|
184 |
$content = print_r($request, true);
|
185 |
$logger = wc_get_logger();
|
186 |
$context = array( 'source' => 'trackship_log' );
|
187 |
-
$logger->error( "New tracking_webhook \n\n"
|
188 |
-
//error_log("New tracking_webhook \n\n".$content."\n\n", 3, ABSPATH . "trackship.log");
|
189 |
|
190 |
//validation
|
191 |
|
@@ -205,16 +206,24 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
205 |
|
206 |
$tracking_items = $st->get_tracking_items( $order_id, true );
|
207 |
|
208 |
-
foreach( ( array )$tracking_items as $key => $tracking_item ){
|
209 |
-
|
|
|
|
|
|
|
210 |
|
211 |
-
$shipment_status = get_post_meta( $order_id,
|
212 |
-
$ts_shipment_status = get_post_meta( $order_id,
|
213 |
|
214 |
-
if( is_string($shipment_status) )
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
-
if(isset($shipment_status[$key]['status'])){
|
218 |
$previous_status = $shipment_status[$key]['status'];
|
219 |
}
|
220 |
|
@@ -225,14 +234,14 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
225 |
$shipment_status[$key]['tracking_destination_events'] = json_decode($tracking_destination_events);
|
226 |
|
227 |
$shipment_status[$key]['status_date'] = $tracking_event_date;
|
228 |
-
if($tracking_est_delivery_date){
|
229 |
-
$shipment_status[$key]['est_delivery_date'] =
|
230 |
}
|
231 |
|
232 |
$ts_shipment_status[$key]['status'] = $tracking_event_status;
|
233 |
|
234 |
-
update_post_meta( $order_id,
|
235 |
-
update_post_meta( $order_id,
|
236 |
|
237 |
$trackship->trigger_tracking_email( $order_id, $previous_status, $tracking_event_status, $tracking_item, $shipment_status[$key] );
|
238 |
}
|
@@ -326,7 +335,7 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
326 |
/*
|
327 |
*
|
328 |
*/
|
329 |
-
public function update_user_key($request){
|
330 |
$add_key = update_option( 'wc_ast_api_key', $request['user_key'] );
|
331 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 1 );
|
332 |
$trackers_balance = update_option( 'trackers_balance', $request['trackers_balance'] );
|
@@ -335,7 +344,7 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
335 |
/*
|
336 |
* disconnect store from TS
|
337 |
*/
|
338 |
-
public function disconnect_from_trackship_fun($request){
|
339 |
$add_key = update_option( 'wc_ast_api_key', '' );
|
340 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 0 );
|
341 |
delete_option( 'wc_ast_api_enabled' );
|
@@ -402,20 +411,20 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
402 |
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woo-advanced-shipment-tracking' ), array( 'status' => 404 ) );
|
403 |
}
|
404 |
|
405 |
-
if(preg_match('/[^a-z0-9- \b]+/i', $request['tracking_number'])){
|
406 |
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Special character not allowd in tracking number', 'woo-advanced-shipment-tracking' ), array( 'status' => 404 ) );
|
407 |
}
|
408 |
|
409 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
410 |
|
411 |
-
$tracking_provider_name = (isset($request['custom_tracking_provider']) && !empty($request['custom_tracking_provider'])) ? $request['custom_tracking_provider'] : $request['tracking_provider'];
|
412 |
|
413 |
$replace_tracking = isset($request['replace_tracking']) ? $request['replace_tracking'] : 0;
|
414 |
|
415 |
-
if($replace_tracking
|
416 |
$order = wc_get_order($order_id);
|
417 |
|
418 |
-
if($order){
|
419 |
$tracking_items = $ast->get_tracking_items( $order_id );
|
420 |
|
421 |
if ( count( $tracking_items ) > 0 ) {
|
@@ -527,9 +536,9 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
527 |
* @return WP_REST_Response $response Response data
|
528 |
*/
|
529 |
public function prepare_item_for_response( $tracking_item, $request ) {
|
530 |
-
$date_shipped =
|
531 |
-
if(isset($tracking_item['date_shipped'])){
|
532 |
-
$date_shipped =
|
533 |
}
|
534 |
$data = array(
|
535 |
'tracking_id' => $tracking_item['tracking_id'],
|
@@ -647,4 +656,4 @@ class WC_Advanced_Shipment_Tracking_REST_API_Controller extends WC_REST_Controll
|
|
647 |
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
648 |
);
|
649 |
}
|
650 |
-
}
|
35 |
protected $post_type = 'shop_order';
|
36 |
|
37 |
/**
|
38 |
+
* Set namespace
|
39 |
*
|
40 |
+
* @return WC_Advanced_Shipment_Tracking_REST_API_Controller
|
41 |
*/
|
42 |
public function set_namespace( $namespace ) {
|
43 |
$this->namespace = $namespace;
|
93 |
'schema' => array( $this, 'get_public_item_schema' ),
|
94 |
) );
|
95 |
|
96 |
+
if ( !function_exists( 'trackship_for_woocommerce' ) ) {
|
97 |
|
98 |
//disconnect_from_trackship
|
99 |
register_rest_route( $this->namespace, '/disconnect_from_trackship', array(
|
145 |
/*
|
146 |
* check_wcast_installed_from_third_party_tool
|
147 |
*/
|
148 |
+
public function check_wcast_installed_from_third_party_tool( $request ) {
|
149 |
|
150 |
$data = array(
|
151 |
'status' => 'installed'
|
156 |
/*
|
157 |
* check_wcast_installed
|
158 |
*/
|
159 |
+
public function check_wcast_installed( $request ) {
|
160 |
+
|
161 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
162 |
$wc_ast_api_enabled = get_option('wc_ast_api_enabled');
|
163 |
+
|
164 |
+
if ( empty( $wc_ast_api_key ) ) {
|
165 |
+
update_option( 'wc_ast_api_key', $request['user_key'] );
|
166 |
}
|
167 |
|
168 |
+
if ( '' == $wc_ast_api_enabled ) {
|
169 |
+
update_option( 'wc_ast_api_enabled', 1 );
|
170 |
}
|
171 |
|
172 |
+
if ( $request['trackers_balance'] ) {
|
173 |
update_option( 'trackers_balance', $request['trackers_balance'] );
|
174 |
}
|
175 |
|
176 |
+
$trackship = new WC_Advanced_Shipment_Tracking_Trackship();
|
177 |
$trackship->create_tracking_page();
|
178 |
|
179 |
$data = array(
|
182 |
return rest_ensure_response( $data );
|
183 |
}
|
184 |
|
185 |
+
public function tracking_webhook( $request ) {
|
186 |
$content = print_r($request, true);
|
187 |
$logger = wc_get_logger();
|
188 |
$context = array( 'source' => 'trackship_log' );
|
189 |
+
$logger->error( "New tracking_webhook \n\n" . $content . "\n\n", $context );
|
|
|
190 |
|
191 |
//validation
|
192 |
|
206 |
|
207 |
$tracking_items = $st->get_tracking_items( $order_id, true );
|
208 |
|
209 |
+
foreach ( ( array ) $tracking_items as $key => $tracking_item ) {
|
210 |
+
|
211 |
+
if ( trim($tracking_item['tracking_number']) != trim($tracking_number) ) {
|
212 |
+
continue;
|
213 |
+
}
|
214 |
|
215 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
216 |
+
$ts_shipment_status = get_post_meta( $order_id, 'ts_shipment_status', true);
|
217 |
|
218 |
+
if ( is_string( $shipment_status ) ) {
|
219 |
+
$shipment_status = array();
|
220 |
+
}
|
221 |
+
|
222 |
+
if ( is_string( $ts_shipment_status ) ) {
|
223 |
+
$ts_shipment_status = array();
|
224 |
+
}
|
225 |
|
226 |
+
if ( isset( $shipment_status[$key]['status'] ) ) {
|
227 |
$previous_status = $shipment_status[$key]['status'];
|
228 |
}
|
229 |
|
234 |
$shipment_status[$key]['tracking_destination_events'] = json_decode($tracking_destination_events);
|
235 |
|
236 |
$shipment_status[$key]['status_date'] = $tracking_event_date;
|
237 |
+
if ( $tracking_est_delivery_date ) {
|
238 |
+
$shipment_status[$key]['est_delivery_date'] = gmdate('Y-m-d', strtotime($tracking_est_delivery_date));
|
239 |
}
|
240 |
|
241 |
$ts_shipment_status[$key]['status'] = $tracking_event_status;
|
242 |
|
243 |
+
update_post_meta( $order_id, 'ts_shipment_status', $ts_shipment_status);
|
244 |
+
update_post_meta( $order_id, 'shipment_status', $shipment_status);
|
245 |
|
246 |
$trackship->trigger_tracking_email( $order_id, $previous_status, $tracking_event_status, $tracking_item, $shipment_status[$key] );
|
247 |
}
|
335 |
/*
|
336 |
*
|
337 |
*/
|
338 |
+
public function update_user_key( $request ) {
|
339 |
$add_key = update_option( 'wc_ast_api_key', $request['user_key'] );
|
340 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 1 );
|
341 |
$trackers_balance = update_option( 'trackers_balance', $request['trackers_balance'] );
|
344 |
/*
|
345 |
* disconnect store from TS
|
346 |
*/
|
347 |
+
public function disconnect_from_trackship_fun( $request ) {
|
348 |
$add_key = update_option( 'wc_ast_api_key', '' );
|
349 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 0 );
|
350 |
delete_option( 'wc_ast_api_enabled' );
|
411 |
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woo-advanced-shipment-tracking' ), array( 'status' => 404 ) );
|
412 |
}
|
413 |
|
414 |
+
if ( preg_match( '/[^a-z0-9- \b]+/i', $request['tracking_number'] ) ) {
|
415 |
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Special character not allowd in tracking number', 'woo-advanced-shipment-tracking' ), array( 'status' => 404 ) );
|
416 |
}
|
417 |
|
418 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
419 |
|
420 |
+
$tracking_provider_name = ( isset( $request['custom_tracking_provider'] ) && !empty( $request['custom_tracking_provider'] ) ) ? $request['custom_tracking_provider'] : $request['tracking_provider'];
|
421 |
|
422 |
$replace_tracking = isset($request['replace_tracking']) ? $request['replace_tracking'] : 0;
|
423 |
|
424 |
+
if ( 1 == $replace_tracking ) {
|
425 |
$order = wc_get_order($order_id);
|
426 |
|
427 |
+
if ( $order ) {
|
428 |
$tracking_items = $ast->get_tracking_items( $order_id );
|
429 |
|
430 |
if ( count( $tracking_items ) > 0 ) {
|
536 |
* @return WP_REST_Response $response Response data
|
537 |
*/
|
538 |
public function prepare_item_for_response( $tracking_item, $request ) {
|
539 |
+
$date_shipped = gmdate('Y-m-d');
|
540 |
+
if ( isset( $tracking_item['date_shipped'] ) ) {
|
541 |
+
$date_shipped = gmdate( 'Y-m-d', $tracking_item['date_shipped'] );
|
542 |
}
|
543 |
$data = array(
|
544 |
'tracking_id' => $tracking_item['tracking_id'],
|
656 |
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
657 |
);
|
658 |
}
|
659 |
+
}
|
includes/class-wc-admin-notices.php
CHANGED
@@ -15,9 +15,9 @@ class WC_AST_Admin_Notices_Under_WC_Admin {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
$this->init();
|
20 |
-
|
21 |
|
22 |
/**
|
23 |
* Get the class instance
|
@@ -36,13 +36,13 @@ class WC_AST_Admin_Notices_Under_WC_Admin {
|
|
36 |
/*
|
37 |
* init from parent mail class
|
38 |
*/
|
39 |
-
public function init(){
|
40 |
//add_action('init', array( $this, 'admin_notices_for_ast_pro' ) );
|
41 |
}
|
42 |
|
43 |
public function admin_notices_for_ast_pro() {
|
44 |
|
45 |
-
if( class_exists( 'ast_pro' ) ) {
|
46 |
return;
|
47 |
}
|
48 |
|
@@ -52,7 +52,7 @@ class WC_AST_Admin_Notices_Under_WC_Admin {
|
|
52 |
|
53 |
$already_set = get_transient( 'ast_pro_wc_admin' );
|
54 |
|
55 |
-
if( 'yes' == $already_set ){
|
56 |
return;
|
57 |
}
|
58 |
|
@@ -63,7 +63,7 @@ class WC_AST_Admin_Notices_Under_WC_Admin {
|
|
63 |
|
64 |
// Otherwise, add the note
|
65 |
$activated_time = current_time( 'timestamp', 0 );
|
66 |
-
$activated_time_formatted =
|
67 |
$note = new Automattic\WooCommerce\Admin\Notes\WC_Admin_Note();
|
68 |
$note->set_title( 'Advanced Shipment Tracking PRO' );
|
69 |
$note->set_content( 'We just released the Advanced Shipment Tracking Pro! Upgrade now and enjoy a 20% off early bird discount. To redeem your discount, use coupon code ASTPRO20 (valid until March 31st)' );
|
@@ -108,4 +108,4 @@ function WC_AST_Admin_Notices_Under_WC_Admin() {
|
|
108 |
*
|
109 |
* Backward compatibility.
|
110 |
*/
|
111 |
-
WC_AST_Admin_Notices_Under_WC_Admin();
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
$this->init();
|
20 |
+
}
|
21 |
|
22 |
/**
|
23 |
* Get the class instance
|
36 |
/*
|
37 |
* init from parent mail class
|
38 |
*/
|
39 |
+
public function init() {
|
40 |
//add_action('init', array( $this, 'admin_notices_for_ast_pro' ) );
|
41 |
}
|
42 |
|
43 |
public function admin_notices_for_ast_pro() {
|
44 |
|
45 |
+
if ( class_exists( 'ast_pro' ) ) {
|
46 |
return;
|
47 |
}
|
48 |
|
52 |
|
53 |
$already_set = get_transient( 'ast_pro_wc_admin' );
|
54 |
|
55 |
+
if ( 'yes' == $already_set ) {
|
56 |
return;
|
57 |
}
|
58 |
|
63 |
|
64 |
// Otherwise, add the note
|
65 |
$activated_time = current_time( 'timestamp', 0 );
|
66 |
+
$activated_time_formatted = gmdate( 'F jS', $activated_time );
|
67 |
$note = new Automattic\WooCommerce\Admin\Notes\WC_Admin_Note();
|
68 |
$note->set_title( 'Advanced Shipment Tracking PRO' );
|
69 |
$note->set_content( 'We just released the Advanced Shipment Tracking Pro! Upgrade now and enjoy a 20% off early bird discount. To redeem your discount, use coupon code ASTPRO20 (valid until March 31st)' );
|
108 |
*
|
109 |
* Backward compatibility.
|
110 |
*/
|
111 |
+
WC_AST_Admin_Notices_Under_WC_Admin();
|
includes/class-wc-advanced-shipment-tracking-admin-notice.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
3 |
exit;
|
4 |
}
|
5 |
|
6 |
-
class
|
7 |
|
8 |
/**
|
9 |
* Instance of this class.
|
@@ -15,14 +15,14 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
$this->init();
|
20 |
-
|
21 |
|
22 |
/**
|
23 |
* Get the class instance
|
24 |
*
|
25 |
-
* @return
|
26 |
*/
|
27 |
public static function get_instance() {
|
28 |
|
@@ -40,6 +40,9 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
40 |
add_action( 'admin_notices', array( $this, 'ast_pro_admin_notice' ) );
|
41 |
add_action( 'admin_init', array( $this, 'ast_pro_admin_notice_ignore' ) );
|
42 |
|
|
|
|
|
|
|
43 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
44 |
}
|
45 |
|
@@ -60,7 +63,7 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
60 |
*/
|
61 |
public function ast_pro_admin_notice() {
|
62 |
|
63 |
-
if( class_exists( 'ast_pro' ) ) {
|
64 |
return;
|
65 |
}
|
66 |
|
@@ -98,7 +101,7 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
98 |
<div class="notice updated notice-success ast-dismissable-notice">
|
99 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
100 |
<h3>Get 20% discount to upgrade to the Advanced Shipment Tracking Pro! </h3>
|
101 |
-
<p>Streamline and automate your fulfillment workflow and keep your customers happy and informed! To redeem your discount, use code <strong>ASTPRO20</strong></p>
|
102 |
<a class="button-primary ast_notice_btn" target="blank" href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/">Go Pro</a>
|
103 |
<a class="button-primary ast_notice_btn" href="<?php esc_html_e( $dismissable_url ); ?>">No Thanks</a>
|
104 |
</div>
|
@@ -112,17 +115,84 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
112 |
if ( isset( $_GET['ast-pro-ignore-notice'] ) ) {
|
113 |
update_option( 'ast_pro_standalone_admin_notice_ignore', 'true' );
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
/*
|
118 |
* Display admin notice on if Store is connected to TrackShip and TrackShip For WooCommerce plugin is not activate
|
119 |
*/
|
120 |
-
public function ast_install_ts4wc() {
|
121 |
-
?>
|
122 |
<div class="notice notice-error">
|
123 |
-
<p>
|
124 |
-
|
125 |
</div>
|
126 |
<?php
|
127 |
}
|
128 |
-
}
|
3 |
exit;
|
4 |
}
|
5 |
|
6 |
+
class WC_Advanced_Shipment_Tracking_Admin_Notice {
|
7 |
|
8 |
/**
|
9 |
* Instance of this class.
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
$this->init();
|
20 |
+
}
|
21 |
|
22 |
/**
|
23 |
* Get the class instance
|
24 |
*
|
25 |
+
* @return WC_Advanced_Shipment_Tracking_Admin_Notice
|
26 |
*/
|
27 |
public static function get_instance() {
|
28 |
|
40 |
add_action( 'admin_notices', array( $this, 'ast_pro_admin_notice' ) );
|
41 |
add_action( 'admin_init', array( $this, 'ast_pro_admin_notice_ignore' ) );
|
42 |
|
43 |
+
add_action( 'admin_notices', array( $this, 'shipstation_ast_pro_admin_notice' ) );
|
44 |
+
add_action( 'admin_init', array( $this, 'shipstation_ast_pro_admin_notice_ignore' ) );
|
45 |
+
|
46 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
47 |
}
|
48 |
|
63 |
*/
|
64 |
public function ast_pro_admin_notice() {
|
65 |
|
66 |
+
if ( class_exists( 'ast_pro' ) ) {
|
67 |
return;
|
68 |
}
|
69 |
|
101 |
<div class="notice updated notice-success ast-dismissable-notice">
|
102 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
103 |
<h3>Get 20% discount to upgrade to the Advanced Shipment Tracking Pro! </h3>
|
104 |
+
<p>Streamline and automate your fulfillment workflow and keep your customers happy and informed! To redeem your discount, use code <strong>ASTPRO20</strong></p>
|
105 |
<a class="button-primary ast_notice_btn" target="blank" href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/">Go Pro</a>
|
106 |
<a class="button-primary ast_notice_btn" href="<?php esc_html_e( $dismissable_url ); ?>">No Thanks</a>
|
107 |
</div>
|
115 |
if ( isset( $_GET['ast-pro-ignore-notice'] ) ) {
|
116 |
update_option( 'ast_pro_standalone_admin_notice_ignore', 'true' );
|
117 |
}
|
118 |
+
}
|
119 |
+
|
120 |
+
/*
|
121 |
+
* Display admin notice on plugin install or update if shipstation is active
|
122 |
+
*/
|
123 |
+
public function shipstation_ast_pro_admin_notice() {
|
124 |
+
|
125 |
+
if ( class_exists( 'ast_pro' ) ) {
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( !is_plugin_active( 'woocommerce-shipstation-integration/woocommerce-shipstation.php' ) ) {
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( get_option('shipstation_ast_pro_admin_notice_ignore') ) {
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$dismissable_url = esc_url( add_query_arg( 'shipstation-ast-pro-ignore-notice', 'true' ) );
|
138 |
+
?>
|
139 |
+
<style>
|
140 |
+
.wp-core-ui .notice.ast-dismissable-notice{
|
141 |
+
position: relative;
|
142 |
+
padding-right: 38px;
|
143 |
+
border-left-color: #005B9A;
|
144 |
+
}
|
145 |
+
.wp-core-ui .notice.ast-dismissable-notice h3{
|
146 |
+
margin-bottom: 5px;
|
147 |
+
}
|
148 |
+
.wp-core-ui .notice.ast-dismissable-notice a.notice-dismiss{
|
149 |
+
padding: 9px;
|
150 |
+
text-decoration: none;
|
151 |
+
}
|
152 |
+
.wp-core-ui .button-primary.ast_notice_btn {
|
153 |
+
background: #005B9A;
|
154 |
+
color: #fff;
|
155 |
+
border-color: #005B9A;
|
156 |
+
text-transform: uppercase;
|
157 |
+
padding: 0 11px;
|
158 |
+
font-size: 12px;
|
159 |
+
height: 30px;
|
160 |
+
line-height: 28px;
|
161 |
+
margin: 5px 0 15px;
|
162 |
+
}
|
163 |
+
.ast-logo{
|
164 |
+
margin: 15px 0 0;
|
165 |
+
width: 120px;
|
166 |
+
}
|
167 |
+
</style>
|
168 |
+
<div class="notice updated notice-success ast-dismissable-notice">
|
169 |
+
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
170 |
+
<img class="ast-logo" src="<?php echo esc_html( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/ast-logo.png">
|
171 |
+
<p>We noticed that you are using <strong>ShipStation Integration for WooCommerce</strong>. Now, you can upgrade to <a href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/" target="blank">Advanced Shipment Tracking Pro</a> and automate your workflow. AST PRO will automatically grab the tracking information from ShipStation into the shipment tracking order meta.</p>
|
172 |
+
<p>Get a 20% discount to upgrade to the <a href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/" target="blank">Advanced Shipment Tracking Pro!</a> To redeem your discount, use code <strong>ASTPRO20</strong></p>
|
173 |
+
<a class="button-primary ast_notice_btn" target="blank" href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/">Go Pro</a>
|
174 |
+
<a class="button-primary ast_notice_btn" href="<?php esc_html_e( $dismissable_url ); ?>">No Thanks</a>
|
175 |
+
</div>
|
176 |
+
<?php
|
177 |
+
}
|
178 |
+
|
179 |
+
/*
|
180 |
+
* Dismiss admin notice for shipstation
|
181 |
+
*/
|
182 |
+
public function shipstation_ast_pro_admin_notice_ignore() {
|
183 |
+
if ( isset( $_GET['shipstation-ast-pro-ignore-notice'] ) ) {
|
184 |
+
update_option( 'shipstation_ast_pro_admin_notice_ignore', 'true' );
|
185 |
+
}
|
186 |
}
|
187 |
|
188 |
/*
|
189 |
* Display admin notice on if Store is connected to TrackShip and TrackShip For WooCommerce plugin is not activate
|
190 |
*/
|
191 |
+
public function ast_install_ts4wc() {
|
192 |
+
?>
|
193 |
<div class="notice notice-error">
|
194 |
+
<p>We noticed that your store is connected to TrackShip, Please install the <a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ); ?>" target="blank">TrackShip for WooCommerce</a> plugin (free) to continue using TrackShip on your store as we will remove the TrackShip integration from Advanced Shipment Tracking in the next version.</p>
|
|
|
195 |
</div>
|
196 |
<?php
|
197 |
}
|
198 |
+
}
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -5,12 +5,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
5 |
|
6 |
class WC_Advanced_Shipment_Tracking_Admin {
|
7 |
|
8 |
-
var $zorem_pluginlist;
|
9 |
-
|
10 |
/**
|
11 |
* Initialize the main plugin function
|
12 |
*/
|
13 |
-
|
14 |
|
15 |
global $wpdb;
|
16 |
if ( is_multisite() ) {
|
@@ -22,7 +20,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
22 |
if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
|
23 |
$main_blog_prefix = $wpdb->get_blog_prefix( BLOG_ID_CURRENT_SITE );
|
24 |
$this->table = $main_blog_prefix . 'woo_shippment_provider';
|
25 |
-
} else{
|
26 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
27 |
}
|
28 |
|
@@ -96,9 +94,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
96 |
|
97 |
add_action( 'wp_ajax_update_default_provider', array( $this, 'update_default_provider_fun') );
|
98 |
|
99 |
-
add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
|
100 |
-
|
101 |
-
add_action( 'wp_ajax_update_custom_order_status_email_display', array( $this, 'update_custom_order_status_email_display_fun') );
|
102 |
|
103 |
add_action( 'update_order_status_after_adding_tracking', array( $this, 'update_order_status_after_adding_tracking'), 10, 2 );
|
104 |
|
@@ -150,9 +146,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
150 |
}
|
151 |
|
152 |
/*
|
153 |
-
*
|
154 |
*/
|
155 |
-
function get_shipped_orders() {
|
156 |
$range = get_option( 'wc_ast_api_date_range', 30 );
|
157 |
$args = array(
|
158 |
'status' => 'wc-completed',
|
@@ -160,9 +156,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
160 |
);
|
161 |
|
162 |
if ( 0 != $range ) {
|
163 |
-
$start = strtotime(
|
164 |
-
$end = strtotime(
|
165 |
-
$args['date_completed'] = $start.'...'
|
166 |
}
|
167 |
|
168 |
return wc_get_orders( $args );
|
@@ -186,10 +182,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
186 |
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
|
187 |
wp_enqueue_script( 'select2');
|
188 |
|
189 |
-
wp_enqueue_style( 'ast_styles',
|
190 |
-
wp_register_style( 'trackship_styles',
|
191 |
|
192 |
-
wp_enqueue_style( 'front_style',
|
193 |
|
194 |
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version, true );
|
195 |
|
@@ -225,7 +221,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
225 |
|
226 |
wp_enqueue_script( 'front-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/front.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version );
|
227 |
|
228 |
-
wp_register_script( 'shipment_tracking_table_rows', wc_advanced_shipment_tracking()->plugin_dir_url().'assets/js/shipping_row.js' , array( 'jquery', 'wp-util' ), wc_advanced_shipment_tracking()->version );
|
229 |
|
230 |
wp_localize_script( 'shipment_tracking_table_rows', 'shipment_tracking_table_rows', array(
|
231 |
'i18n' => array(
|
@@ -235,7 +231,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
235 |
'browser_not_html' => __( 'This browser does not support HTML5.', 'woo-advanced-shipment-tracking' ),
|
236 |
'upload_valid_csv_file' => __( 'Please upload a valid CSV file.', 'woo-advanced-shipment-tracking' ),
|
237 |
),
|
238 |
-
'delete_rates_nonce' => wp_create_nonce(
|
239 |
) );
|
240 |
wp_enqueue_media();
|
241 |
}
|
@@ -276,7 +272,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
276 |
|
277 |
<div class="zorem-layout">
|
278 |
<div class="zorem-layout__header">
|
279 |
-
<img class="zorem-layout__header-logo" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/ast-logo.png">
|
280 |
|
281 |
<div class="woocommerce-layout__activity-panel">
|
282 |
<div class="woocommerce-layout__activity-panel-tabs">
|
@@ -354,19 +350,42 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
354 |
<div class="woocommerce zorem_admin_layout">
|
355 |
<div class="ast_admin_content" >
|
356 |
<div class="ast_nav_div">
|
357 |
-
<?php
|
|
|
358 |
require_once( 'views/admin_options_shipping_provider.php' );
|
359 |
require_once( 'views/admin_options_settings.php' );
|
360 |
-
require_once( 'views/admin_options_bulk_upload.php' );
|
|
|
361 |
do_action( 'ast_paypal_settings_panel' );
|
362 |
require_once( 'views/admin_options_addons.php' );
|
363 |
-
include 'views/admin_options_trackship_integration.php';
|
364 |
-
?>
|
365 |
</div>
|
366 |
</div>
|
367 |
</div>
|
368 |
-
</div>
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
/*
|
372 |
* callback for Shipment Tracking menu array
|
@@ -419,6 +438,14 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
419 |
'name' => 'tabs',
|
420 |
'position' => 4,
|
421 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
'trackship' => array(
|
423 |
'title' => 'TrackShip',
|
424 |
'show' => $trackship_display,
|
@@ -468,23 +495,154 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
468 |
return apply_filters( 'ast_general_settings_tab_options', $setting_data );
|
469 |
}
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
/*
|
472 |
* callback for HTML function for Shipment Tracking menu
|
473 |
*/
|
474 |
-
public function get_html_menu_tab( $arrays, $tab_class =
|
475 |
|
476 |
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'settings';
|
477 |
$settings = isset( $_GET['settings'] ) ? sanitize_text_field( $_GET['settings'] ) : 'general-settings';
|
478 |
|
479 |
foreach ( (array) $arrays as $id => $array ) {
|
480 |
$checked = ( $tab == $array['data-tab'] || $settings == $array['data-tab'] ) ? 'checked' : '';
|
481 |
-
if( $array['show'] ) {
|
482 |
-
if( isset( $array['type'] ) && 'link' == $array['type'] ) {
|
483 |
-
?>
|
484 |
<a class="menu_trackship_link" href="<?php esc_html_e( esc_url( $array['link'] ) ); ?>"><?php esc_html_e( $array['title'] ); ?></a>
|
485 |
<?php
|
486 |
} else {
|
487 |
-
|
488 |
<input class="<?php esc_html_e( $tab_class ); ?>" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $array['name'] ); ?>" type="radio" data-tab="<?php esc_html_e( $array['data-tab'] ); ?>" data-label="<?php esc_html_e( $array['data-label'] ); ?>" <?php esc_html_e( $checked ); ?>/>
|
489 |
<label class="<?php esc_html_e( $array['class'] ); ?>" for="<?php esc_html_e( $id ); ?>"><?php esc_html_e( $array['title'] ); ?></label>
|
490 |
<?php
|
@@ -500,11 +658,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
500 |
?>
|
501 |
<ul class="settings_ul">
|
502 |
<?php
|
503 |
-
foreach( (array)$arrays as $id => $array ) {
|
504 |
|
505 |
-
if( $array['show'] ) {
|
506 |
|
507 |
-
if( 'checkbox' == $array['type'] ) {
|
508 |
$default = isset( $array['default'] ) ? $array['default'] : '';
|
509 |
$checked = ( get_option( $id, $default ) ) ? 'checked' : '' ;
|
510 |
?>
|
@@ -523,8 +681,8 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
523 |
$default = isset( $array['default'] ) ? $array['default'] : '';
|
524 |
$checked = ( get_option( $id, $default ) ) ? 'checked' : '' ;
|
525 |
$tgl_class = isset( $array['tgl_color'] ) ? 'ast-tgl-btn-green' : '';
|
526 |
-
$disabled = isset( $array['disabled'] ) && true == $array['disabled'] ? 'disabled' : '';
|
527 |
-
?>
|
528 |
<li>
|
529 |
<span class="ast-tgl-btn-parent">
|
530 |
<input type="hidden" name="<?php esc_html_e( $id ); ?>" value="0"/>
|
@@ -549,7 +707,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
549 |
</li>
|
550 |
<?php
|
551 |
} else if ( 'radio' == $array['type'] ) {
|
552 |
-
|
553 |
<li class="settings_radio_li">
|
554 |
<label><strong><?php esc_html_e( $array['title'] ); ?></strong>
|
555 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
@@ -559,8 +717,8 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
559 |
|
560 |
<?php
|
561 |
|
562 |
-
foreach( (array) $array['options'] as $key => $val ) {
|
563 |
-
$selected = ( get_option( $id, $array['default'] ) == (string)$key ) ? 'checked' : '' ;
|
564 |
?>
|
565 |
<span class="radio_section">
|
566 |
<label class="" for="<?php esc_html_e( $id ); ?>_<?php esc_html_e( $key ); ?>">
|
@@ -568,13 +726,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
568 |
<span class=""><?php esc_html_e( $val ); ?></span></br>
|
569 |
</label>
|
570 |
</span>
|
571 |
-
|
572 |
-
}
|
573 |
-
?>
|
574 |
</li>
|
575 |
<?php
|
576 |
} else if ( 'multiple_select' == $array['type'] ) {
|
577 |
-
|
578 |
<li class="multiple_select_li">
|
579 |
<label><?php esc_html_e( $array['title'] ); ?>
|
580 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
@@ -597,7 +753,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
597 |
</li>
|
598 |
<?php
|
599 |
} else if ( 'multiple_checkbox' == $array['type'] ) {
|
600 |
-
|
601 |
<li>
|
602 |
<div class="multiple_checkbox_label">
|
603 |
<label for=""><strong><?php esc_html_e( $array['title'] ); ?></strong></label>
|
@@ -623,7 +779,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
623 |
</li>
|
624 |
<?php
|
625 |
} else if ( 'dropdown_tpage' == $array['type'] ) {
|
626 |
-
|
627 |
<li>
|
628 |
<label class="left_label"><?php esc_html_e( $array['title'] ); ?>
|
629 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
@@ -635,15 +791,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
635 |
<?php
|
636 |
foreach ( (array) $array['options'] as $page_id => $page_name ) {
|
637 |
$selected = ( get_option( $id ) == $page_id ) ? 'selected' : '' ;
|
638 |
-
|
639 |
<option value="<?php esc_html_e( $page_id ); ?>" <?php esc_html_e( $selected ); ?>><?php esc_html_e( $page_name ); ?></option>
|
640 |
<?php
|
641 |
-
}
|
|
|
642 |
?>
|
643 |
-
<option <?php
|
644 |
</select>
|
645 |
-
|
646 |
-
<fieldset style="<?php
|
647 |
<input type="text" name="wc_ast_trackship_other_page" id="wc_ast_trackship_other_page" value="<?php esc_html_e( get_option('wc_ast_trackship_other_page') ); ?>">
|
648 |
</fieldset>
|
649 |
|
@@ -654,7 +811,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
654 |
</li>
|
655 |
<?php
|
656 |
} else if ( 'button' == $array['type'] ) {
|
657 |
-
|
658 |
<li>
|
659 |
<label class="left_label"><?php esc_html_e( $array['title'] ); ?>
|
660 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
@@ -662,25 +819,25 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
662 |
<?php } ?>
|
663 |
</label>
|
664 |
<?php
|
665 |
-
if ( isset( $array['customize_link'] ) ) {
|
666 |
-
|
667 |
<a href="<?php esc_html_e( $array['customize_link'] ); ?>" class="button-primary btn_ts_transparent btn_large ts_customizer_btn"><?php esc_html_e( 'Customize', 'woo-advanced-shipment-tracking' ); ?></a>
|
668 |
<?php } ?>
|
669 |
</li>
|
670 |
<?php
|
671 |
}
|
672 |
}
|
673 |
-
}
|
674 |
-
?>
|
675 |
</ul>
|
676 |
<?php
|
677 |
}
|
678 |
|
679 |
public function get_add_tracking_options() {
|
680 |
|
681 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
|
682 |
|
683 |
-
if( 1 == $wc_ast_status_shipped ) {
|
684 |
$completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
685 |
} else {
|
686 |
$completed_order_label = __( 'Completed', 'woocommerce' );
|
@@ -710,7 +867,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
710 |
|
711 |
foreach ( $custom_order_status as $key => $value ) {
|
712 |
unset($custom_order_status[$key]);
|
713 |
-
$key = str_replace(
|
714 |
$custom_order_status[$key] = array(
|
715 |
'status' => __( $value, '' ),
|
716 |
'type' => 'custom',
|
@@ -718,37 +875,37 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
718 |
}
|
719 |
|
720 |
$actions_order_status = array(
|
721 |
-
|
722 |
'status' => __( 'Processing', 'woocommerce' ),
|
723 |
'type' => 'default',
|
724 |
),
|
725 |
-
|
726 |
'status' => $completed_order_label,
|
727 |
'type' => 'default',
|
728 |
),
|
729 |
-
|
730 |
'status' => __( 'Partially Shipped', '' ),
|
731 |
'type' => 'default',
|
732 |
'class' => 'partially_shipped_checkbox',
|
733 |
),
|
734 |
-
|
735 |
'status' => __( 'Updated Tracking', '' ),
|
736 |
'type' => 'default',
|
737 |
'class' => 'updated_tracking_checkbox',
|
738 |
),
|
739 |
-
|
740 |
'status' => __( 'On Hold', 'woocommerce' ),
|
741 |
'type' => 'default',
|
742 |
),
|
743 |
-
|
744 |
'status' => __( 'Cancelled', 'woocommerce' ),
|
745 |
'type' => 'default',
|
746 |
),
|
747 |
-
|
748 |
'status' => __( 'Refunded', 'woocommerce' ),
|
749 |
'type' => 'default',
|
750 |
),
|
751 |
-
|
752 |
'status' => __( 'Failed', 'woocommerce' ),
|
753 |
'type' => 'default',
|
754 |
),
|
@@ -776,7 +933,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
776 |
|
777 |
public function get_customer_view_options() {
|
778 |
|
779 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
|
780 |
$completed_order_label = ( 1 == $wc_ast_status_shipped ) ? __( 'Shipped', 'woo-advanced-shipment-tracking' ) : __( 'Completed', 'woocommerce' );
|
781 |
|
782 |
$all_order_status = wc_get_order_statuses();
|
@@ -804,7 +961,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
804 |
|
805 |
foreach ( $custom_order_status as $key => $value ) {
|
806 |
unset($custom_order_status[$key]);
|
807 |
-
$key = str_replace(
|
808 |
$custom_order_status[$key] = array(
|
809 |
'status' => __( $value, '' ),
|
810 |
'type' => 'custom',
|
@@ -812,46 +969,46 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
812 |
}
|
813 |
|
814 |
$order_status = array(
|
815 |
-
|
816 |
'status' => __( 'Processing', 'woocommerce' ),
|
817 |
'type' => 'default',
|
818 |
),
|
819 |
-
|
820 |
'status' => $completed_order_label,
|
821 |
'type' => 'default',
|
822 |
),
|
823 |
-
|
824 |
'status' => __( 'Partially Shipped', '' ),
|
825 |
'type' => 'default',
|
826 |
'class' => 'partially_shipped_checkbox',
|
827 |
),
|
828 |
-
|
829 |
'status' => __( 'Updated Tracking', '' ),
|
830 |
'type' => 'default',
|
831 |
'class' => 'updated_tracking_checkbox',
|
832 |
),
|
833 |
-
|
834 |
'status' => __( 'Cancelled', 'woocommerce' ),
|
835 |
'type' => 'default',
|
836 |
),
|
837 |
-
|
838 |
'status' => __( 'On Hold', 'woocommerce' ),
|
839 |
'type' => 'default',
|
840 |
),
|
841 |
-
|
842 |
'status' => __( 'Refunded', 'woocommerce' ),
|
843 |
'type' => 'default',
|
844 |
),
|
845 |
|
846 |
-
|
847 |
'status' => __( 'Failed', 'woocommerce' ),
|
848 |
'type' => 'default',
|
849 |
),
|
850 |
-
|
851 |
'status' => __( 'Customer Invoice', 'woocommerce' ),
|
852 |
'type' => 'default',
|
853 |
),
|
854 |
-
|
855 |
'status' => __( 'Customer note', 'woocommerce' ),
|
856 |
'type' => 'default',
|
857 |
),
|
@@ -887,11 +1044,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
887 |
$form_data = array(
|
888 |
'wc_ast_api_date_format' => array(
|
889 |
'type' => 'radio',
|
890 |
-
'title' => __( 'API Date Format', '
|
891 |
'desc' => __( 'Choose for which Order status to display', 'woo-advanced-shipment-tracking' ),
|
892 |
'options' => array(
|
893 |
-
|
894 |
-
|
895 |
),
|
896 |
'default' => 'd-m-Y',
|
897 |
'show' => true,
|
@@ -933,7 +1090,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
933 |
'wcast_enable_updated_tracking_email' => array(
|
934 |
'type' => 'checkbox',
|
935 |
'title' => __( 'Enable the Updated Tracking order status email', '' ),
|
936 |
-
'title_link'=> "<a class='settings_edit' href='" . ps_customizer()->get_customizer_url( 'custom_order_status_email' , 'updated_tracking' ) . "'>" . __( 'Edit', 'woocommerce' ) .
|
937 |
'class' => 'updated_tracking_status_label_color_th',
|
938 |
'show' => true,
|
939 |
),
|
@@ -945,7 +1102,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
945 |
* get Partially Shipped array data
|
946 |
* return array
|
947 |
*/
|
948 |
-
public function get_partial_shipped_data(){
|
949 |
$form_data = array(
|
950 |
'wc_ast_status_partial_shipped' => array(
|
951 |
'type' => 'checkbox',
|
@@ -973,7 +1130,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
973 |
'wcast_enable_partial_shipped_email' => array(
|
974 |
'type' => 'checkbox',
|
975 |
'title' => __( 'Enable the Partially Shipped order status email', '' ),
|
976 |
-
'title_link'=> "<a class='settings_edit' href='" . ps_customizer()->get_customizer_url( 'custom_order_status_email', 'partially_shipped' ) . "'>" . __( 'Edit', 'woocommerce' ) .
|
977 |
'class' => 'partial_shipped_status_label_color_th',
|
978 |
'show' => true,
|
979 |
),
|
@@ -986,7 +1143,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
986 |
* get Order Status data
|
987 |
* return array
|
988 |
*/
|
989 |
-
public function get_osm_data(){
|
990 |
$osm_data = array(
|
991 |
'partial_shipped' => array(
|
992 |
'id' => 'wc_ast_status_partial_shipped',
|
@@ -994,14 +1151,14 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
994 |
'label' => __( 'Partially Shipped', 'woo-advanced-shipment-tracking' ),
|
995 |
'label_class' => 'wc-partially-shipped',
|
996 |
'option_id' => 'woocommerce_customer_partial_shipped_order_settings',
|
997 |
-
'edit_email'=> ps_customizer()->get_customizer_url('custom_order_status_email','partially_shipped'),
|
998 |
'label_color_field' => 'wc_ast_status_partial_shipped_label_color',
|
999 |
'font_color_field' => 'wc_ast_status_partial_shipped_label_font_color',
|
1000 |
'email_field' => 'wcast_enable_partial_shipped_email',
|
1001 |
),
|
1002 |
);
|
1003 |
|
1004 |
-
$updated_tracking_status = get_option(
|
1005 |
|
1006 |
if ( true == $updated_tracking_status ) {
|
1007 |
$updated_tracking_data = array(
|
@@ -1011,7 +1168,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1011 |
'label' => __( 'Updated Tracking', 'woo-advanced-shipment-tracking' ),
|
1012 |
'label_class' => 'wc-updated-tracking',
|
1013 |
'option_id' => 'woocommerce_customer_updated_tracking_order_settings',
|
1014 |
-
'edit_email'=> ut_customizer()->get_customizer_url('custom_order_status_email','updated_tracking'),
|
1015 |
'label_color_field' => 'wc_ast_status_updated_tracking_label_color',
|
1016 |
'font_color_field' => 'wc_ast_status_updated_tracking_label_font_color',
|
1017 |
'email_field' => 'wcast_enable_updated_tracking_email',
|
@@ -1039,11 +1196,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1039 |
$_POST[ $key ][$op_status] = 0;
|
1040 |
}
|
1041 |
|
1042 |
-
|
1043 |
-
$_POST[ $key ]
|
|
|
|
|
|
|
|
|
|
|
|
|
1044 |
}
|
1045 |
|
1046 |
-
update_option( $key, wc_clean( $_POST[ $key ] ) );
|
1047 |
|
1048 |
} else {
|
1049 |
|
@@ -1071,7 +1233,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1071 |
$_POST[ $key ][$op_status] = 0;
|
1072 |
}
|
1073 |
|
1074 |
-
foreach ( $_POST[ $key ] as $key1 => $status) {
|
1075 |
$_POST[ $key ][$status] = 1;
|
1076 |
}
|
1077 |
|
@@ -1093,8 +1255,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1093 |
update_option( $key, wc_clean( $_POST[ $key ] ) );
|
1094 |
}
|
1095 |
}
|
1096 |
-
|
1097 |
-
|
|
|
1098 |
|
1099 |
$data = $this->get_partial_shipped_data();
|
1100 |
|
@@ -1150,9 +1313,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1150 |
}
|
1151 |
|
1152 |
/*
|
1153 |
-
*
|
1154 |
*/
|
1155 |
-
public function footer_function(){
|
1156 |
if ( !is_plugin_active( 'woocommerce-order-status-manager/woocommerce-order-status-manager.php' ) ) {
|
1157 |
$bg_color = get_option( 'wc_ast_status_label_color', '#59c889' );
|
1158 |
$color = get_option( 'wc_ast_status_label_font_color', '#fff' );
|
@@ -1165,16 +1328,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1165 |
?>
|
1166 |
<style>
|
1167 |
.order-status.status-delivered,.order-status-table .order-label.wc-delivered{
|
1168 |
-
background: <?php
|
1169 |
-
color: <?php
|
1170 |
}
|
1171 |
.order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
|
1172 |
-
background: <?php
|
1173 |
-
color: <?php
|
1174 |
}
|
1175 |
.order-status.status-updated-tracking,.order-status-table .order-label.wc-updated-tracking{
|
1176 |
-
background: <?php
|
1177 |
-
color: <?php
|
1178 |
}
|
1179 |
</style>
|
1180 |
<?php
|
@@ -1184,66 +1347,74 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1184 |
/*
|
1185 |
* Ajax call for upload tracking details into order from bulk upload
|
1186 |
*/
|
1187 |
-
public function upload_tracking_csv_fun(){
|
1188 |
|
1189 |
check_ajax_referer( 'nonce_csv_import', 'security' );
|
1190 |
|
1191 |
-
$replace_tracking_info = wc_clean( $_POST['replace_tracking_info'] );
|
1192 |
-
$date_format_for_csv_import = wc_clean( $_POST['date_format_for_csv_import'] );
|
1193 |
update_option( 'date_format_for_csv_import', $date_format_for_csv_import );
|
1194 |
-
$
|
1195 |
|
1196 |
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
1197 |
-
$order_id = $wast->get_formated_order_id( $
|
1198 |
-
|
1199 |
-
$tracking_provider = wc_clean( $_POST['tracking_provider'] );
|
1200 |
-
$tracking_number = wc_clean( $_POST['tracking_number'] );
|
1201 |
-
$
|
|
|
|
|
|
|
1202 |
|
1203 |
$sku = isset( $_POST['sku'] ) ? wc_clean( $_POST['sku'] ) : '';
|
1204 |
$qty = isset( $_POST['qty'] ) ? wc_clean( $_POST['qty'] ) : '';
|
1205 |
-
$date_shipped = empty( $date_shipped ) ?
|
1206 |
|
1207 |
global $wpdb;
|
1208 |
|
1209 |
$sql = $wpdb->prepare( "SELECT COUNT(*) FROM {$this->table} WHERE api_provider_name = %s", $tracking_provider );
|
1210 |
$shippment_provider = $wpdb->get_var( $sql );
|
1211 |
|
1212 |
-
if(
|
1213 |
-
$sql = "SELECT COUNT(*) FROM {$this->table} WHERE JSON_CONTAINS(api_provider_name, '[".'"'
|
1214 |
$shippment_provider = $wpdb->get_var( $sql );
|
1215 |
}
|
1216 |
|
1217 |
-
if(
|
1218 |
$sql = $wpdb->prepare( "SELECT COUNT(*) FROM {$this->table} WHERE provider_name = %s", $tracking_provider );
|
1219 |
$shippment_provider = $wpdb->get_var( $sql );
|
1220 |
}
|
1221 |
|
1222 |
$order = wc_get_order($order_id);
|
1223 |
|
1224 |
-
if (
|
1225 |
-
echo '<li class="invalid_order_id_error">Failed - Invalid Order Id - Order '
|
|
|
1226 |
}
|
1227 |
|
1228 |
-
if (
|
1229 |
-
echo '<li class="shipping_provider_error">Failed - Invalid Shipping Provider - Order '
|
|
|
1230 |
}
|
1231 |
|
1232 |
-
if ( empty( $tracking_number ) ){
|
1233 |
-
echo '<li class="tracking_number_error">Failed - Empty Tracking Number - Order '
|
|
|
1234 |
}
|
1235 |
|
1236 |
if ( empty( $date_shipped ) ) {
|
1237 |
-
echo '<li class="empty_date_shipped_error">Failed - Empty Date Shipped - Order '
|
|
|
1238 |
}
|
1239 |
|
1240 |
if ( !$this->isDate( $date_shipped, $date_format_for_csv_import ) ) {
|
1241 |
-
echo '<li class="invalid_date_shipped_error">Failed - Invalid Date Shipped - Order '
|
|
|
1242 |
}
|
1243 |
|
1244 |
if ( 'm-d-Y' == $date_format_for_csv_import ) {
|
1245 |
-
$date_array = explode(
|
1246 |
-
$date_shipped = $date_array[1].'-'
|
1247 |
}
|
1248 |
|
1249 |
$tracking_items = $wast->get_tracking_items( $order_id );
|
@@ -1261,10 +1432,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1261 |
|
1262 |
if ( class_exists( 'ast_woo_advanced_shipment_tracking_by_products' ) ) {
|
1263 |
$item_tracking_number = $item['tracking_number'];
|
1264 |
-
$tracking_exist = in_array( $item_tracking_number, array_column( $
|
1265 |
}
|
1266 |
|
1267 |
-
if( false == $tracking_exist ) {
|
1268 |
unset( $tracking_items[ $key ] );
|
1269 |
}
|
1270 |
}
|
@@ -1278,10 +1449,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1278 |
$tracking_provider = $this->get_provider_slug_from_name( $tracking_provider );
|
1279 |
|
1280 |
$args = array(
|
1281 |
-
'tracking_provider' =>
|
1282 |
-
'tracking_number' =>
|
1283 |
-
'date_shipped' =>
|
1284 |
-
'status_shipped' =>
|
1285 |
);
|
1286 |
|
1287 |
if ( '' != $sku ) {
|
@@ -1304,9 +1475,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1304 |
$product_data_array = array();
|
1305 |
$product_data_array[ $product_id ] = $qty;
|
1306 |
|
1307 |
-
$status_shipped = ( isset( $_POST['status_shipped'] ) ? wc_clean( $_POST['status_shipped'] ) :
|
1308 |
|
1309 |
-
$autocomplete_order_tpi = get_option('autocomplete_order_tpi',0);
|
1310 |
if ( 1 == $autocomplete_order_tpi ) {
|
1311 |
$status_shipped = $this->autocomplete_order_after_adding_all_products( $order_id, $status_shipped, $products_list );
|
1312 |
$args['status_shipped'] = $status_shipped;
|
@@ -1314,7 +1485,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1314 |
|
1315 |
if ( count( $tracking_items ) > 0 ) {
|
1316 |
foreach ( $tracking_items as $key => $item ) {
|
1317 |
-
if ( $item['tracking_number'] == $
|
1318 |
|
1319 |
if ( isset( $item['products_list'] ) && !empty( $item['products_list'] ) ) {
|
1320 |
|
@@ -1325,7 +1496,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1325 |
|
1326 |
$mearge_array = array();
|
1327 |
foreach ( array_keys( $product_data_array + $product_list_array ) as $product) {
|
1328 |
-
$mearge_array[ $product ] = (int)( isset( $product_data_array[ $product ] ) ? $product_data_array[ $product ] : 0 ) + (int)( isset( $product_list_array[$product] ) ? $product_list_array[ $product ] : 0);
|
1329 |
}
|
1330 |
|
1331 |
foreach ( $mearge_array as $productid => $product_qty ) {
|
@@ -1343,7 +1514,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1343 |
|
1344 |
do_action( 'update_order_status_after_adding_tracking', $status_shipped, $order );
|
1345 |
|
1346 |
-
echo '<li class="success">Success - added tracking info to Order '
|
1347 |
exit;
|
1348 |
}
|
1349 |
}
|
@@ -1361,9 +1532,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1361 |
|
1362 |
$wast->add_tracking_item( $order_id, $args );
|
1363 |
|
1364 |
-
echo '<li class="success">Success - added tracking info to Order '
|
1365 |
-
|
1366 |
-
|
|
|
|
|
1367 |
}
|
1368 |
}
|
1369 |
|
@@ -1383,8 +1556,8 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1383 |
foreach ( $products_list as $in_list ) {
|
1384 |
|
1385 |
if ( isset( $new_products[ $in_list->product ] ) ) {
|
1386 |
-
$new_products[ $in_list->product ] = (int)$new_products[ $in_list->product ] + (int)$in_list->qty;
|
1387 |
-
} else{
|
1388 |
$new_products[ $in_list->product ] = $in_list->qty;
|
1389 |
}
|
1390 |
}
|
@@ -1392,7 +1565,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1392 |
$total_products_data = array();
|
1393 |
|
1394 |
foreach ( array_keys( $new_products + $added_products ) as $products ) {
|
1395 |
-
$total_products_data[ $products ] = ( isset( $new_products[ $products ] ) ? $new_products[ $products ] : 0 ) + ( isset( $added_products[ $products ] ) ? $added_products[ $products ] : 0);
|
1396 |
}
|
1397 |
|
1398 |
$orders_products_data = array();
|
@@ -1456,7 +1629,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1456 |
foreach ( $product_list as $list ) {
|
1457 |
foreach ( $list as $in_list ) {
|
1458 |
if ( isset( $all_list[ $in_list->product ] ) ) {
|
1459 |
-
$all_list[ $in_list->product ] = (int)$all_list[ $in_list->product ] + (int)$in_list->qty;
|
1460 |
} else {
|
1461 |
$all_list[ $in_list->product ] = $in_list->qty;
|
1462 |
}
|
@@ -1480,7 +1653,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1480 |
if ( !$custom_shipped ) {
|
1481 |
if ( 'completed' == $order->get_status() ) {
|
1482 |
do_action( 'send_order_to_trackship', $order_id );
|
1483 |
-
} else{
|
1484 |
$order->update_status( 'completed' );
|
1485 |
}
|
1486 |
}
|
@@ -1499,7 +1672,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1499 |
}
|
1500 |
|
1501 |
$order->update_status('partial-shipped');
|
1502 |
-
do_action(
|
1503 |
}
|
1504 |
}
|
1505 |
|
@@ -1539,18 +1712,23 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1539 |
}
|
1540 |
|
1541 |
/*
|
1542 |
-
*
|
1543 |
*/
|
1544 |
public function update_email_preview_order_fun() {
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
set_theme_mod( '
|
1551 |
-
set_theme_mod( '
|
1552 |
-
set_theme_mod( '
|
1553 |
-
set_theme_mod( '
|
|
|
|
|
|
|
|
|
|
|
1554 |
exit;
|
1555 |
}
|
1556 |
|
@@ -1561,7 +1739,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1561 |
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped', 0 );
|
1562 |
// Only on backend Woocommerce Settings "Emails" tab
|
1563 |
if ( 1 == $wc_ast_status_shipped ) {
|
1564 |
-
if ( isset( $_GET['page'] ) && $_GET['page']
|
1565 |
switch ( $email->id ) {
|
1566 |
case 'customer_completed_order':
|
1567 |
$email_title = __( 'Shipped Order', 'woo-advanced-shipment-tracking' );
|
@@ -1577,7 +1755,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1577 |
*/
|
1578 |
public function add_delivered_order_status_actions_button( $actions, $order ) {
|
1579 |
|
1580 |
-
wp_enqueue_style( 'ast_styles',
|
1581 |
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version);
|
1582 |
wp_localize_script(
|
1583 |
'woocommerce-advanced-shipment-tracking-js',
|
@@ -1600,7 +1778,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1600 |
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=delivered&order_id=' . $order_id ), 'woocommerce-mark-order-status' ),
|
1601 |
'name' => __( 'Mark order as delivered', 'woo-advanced-shipment-tracking' ),
|
1602 |
'icon' => '<i class="fa fa-truck"> </i>',
|
1603 |
-
'action' =>
|
1604 |
);
|
1605 |
}
|
1606 |
}
|
@@ -1617,7 +1795,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1617 |
if ( $order->get_shipping_method() != 'Local pickup' && $order->get_shipping_method() != 'Local Pickup' ) {
|
1618 |
if ( $order->has_status( $order_array ) ) {
|
1619 |
$actions['add_tracking'] = array(
|
1620 |
-
'url' =>
|
1621 |
'name' => __( 'Add Tracking', 'woo-advanced-shipment-tracking' ),
|
1622 |
'icon' => '<i class="fa fa-map-marker"> </i>',
|
1623 |
'action' => 'add_inline_tracking', // keep "view" class for a clean button CSS
|
@@ -1649,11 +1827,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1649 |
);
|
1650 |
|
1651 |
// Loop through your custom orders Statuses
|
1652 |
-
foreach ( $custom_statuses as $status_slug => $values ){
|
1653 |
if ( $order->has_status( $values['allowed'] ) ) {
|
1654 |
$actions[ 'status' ][ 'group' ] = __( 'Change status: ', 'woocommerce' );
|
1655 |
$actions[ 'status' ][ 'actions' ][ $status_slug ] = array(
|
1656 |
-
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=' . $status_slug.'&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' ),
|
1657 |
'name' => $values['label'],
|
1658 |
'title' => __( 'Change order status to', 'woo-advanced-shipment-tracking' ) . ' ' . strtolower( $values['label'] ),
|
1659 |
'action' => $status_slug,
|
@@ -1670,12 +1848,14 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1670 |
public function get_provider_html( $default_shippment_providers, $status ) {
|
1671 |
$WC_Countries = new WC_Countries();
|
1672 |
$upload_dir = wp_upload_dir();
|
1673 |
-
$ast_directory = $upload_dir['baseurl'] . '/ast-shipping-providers/';
|
|
|
1674 |
<div class="provider_list">
|
1675 |
-
<?php
|
1676 |
-
if($
|
1677 |
-
|
1678 |
-
|
|
|
1679 |
<?php } ?>
|
1680 |
<div class="provider_table_hc">
|
1681 |
<div class="shipping_provider_counter counter"></div>
|
@@ -1694,7 +1874,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1694 |
<?php
|
1695 |
foreach ( $default_shippment_providers as $d_s_p ) {
|
1696 |
$class = ( 1 == $d_s_p->display_in_order ) ? 'enable' : 'disable' ;
|
1697 |
-
|
1698 |
<tr class="<?php esc_html_e( $class ); ?>">
|
1699 |
<td>
|
1700 |
<?php
|
@@ -1706,17 +1886,17 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1706 |
} else {
|
1707 |
$provider_image = $ast_directory . '' . sanitize_title( $d_s_p->provider_name ) . '.png?v=' . wc_advanced_shipment_tracking()->version;
|
1708 |
}
|
1709 |
-
echo '<img class="provider-thumb" src="' . $provider_image . '">';
|
1710 |
} else {
|
1711 |
$image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array( '60', '60' ) );
|
1712 |
|
1713 |
if ( 0 != $custom_thumb_id ) {
|
1714 |
-
echo '<img class="provider-thumb" src="' . $image_attributes[0] . '">';
|
1715 |
} else {
|
1716 |
-
echo '<img class="provider-thumb" src="' . wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/images/icon-default.png">';
|
1717 |
}
|
1718 |
-
}
|
1719 |
-
|
1720 |
</td>
|
1721 |
<td>
|
1722 |
<span class="provider_name">
|
@@ -1736,7 +1916,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1736 |
} else {
|
1737 |
$api_count = 1;
|
1738 |
}
|
1739 |
-
$api_text = __('API aliases','woo-advanced-shipment-tracking');
|
1740 |
esc_html_e( ' (' . $api_count . ' ' . $api_text . ')' );
|
1741 |
}
|
1742 |
?>
|
@@ -1757,14 +1937,14 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1757 |
<?php
|
1758 |
|
1759 |
if ( 0 == $d_s_p->shipping_default ) {
|
1760 |
-
echo '<span class="dashicons dashicons-trash remove provider_actions_btn" data-pid="' . $d_s_p->id . '"></span>';
|
1761 |
}
|
1762 |
|
1763 |
-
$edit_provider_class = ( $enable_edit ) ? apply_filters( 'edit_provider_class', 'edit_provider' ) : '
|
1764 |
|
1765 |
$provider_type = ( 1 == $d_s_p->shipping_default ) ? 'default_provider' : 'custom_provider';
|
1766 |
|
1767 |
-
echo '<span class="' . $edit_provider_class . ' provider_actions_btn" data-
|
1768 |
|
1769 |
$default_provider = get_option( 'wc_ast_default_provider' );
|
1770 |
|
@@ -1787,12 +1967,14 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1787 |
echo '<span class="dashicons dashicons-yes-alt"></span>';
|
1788 |
} else {
|
1789 |
echo '<span class="dashicons dashicons-dismiss"></span>';
|
1790 |
-
}
|
|
|
1791 |
<span>TrackShip</span>
|
1792 |
</td>
|
1793 |
|
1794 |
<td>
|
1795 |
-
|
|
|
1796 |
<label class="ast-tgl-btn" for="list-switch-<?php esc_html_e( $d_s_p->id ); ?>"></label>
|
1797 |
</td>
|
1798 |
</tr>
|
@@ -1803,19 +1985,31 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1803 |
<div class="shipping_provider_counter counter"></div>
|
1804 |
<div class="paging shipping_provider_paging"></div>
|
1805 |
</div>
|
1806 |
-
<?php
|
1807 |
-
|
1808 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1809 |
<a href="javaScript:void(0);" class="button-primary btn_ast2 btn_large add_custom_provider" id="add-custom">
|
1810 |
<span class="dashicons dashicons-plus-alt"></span>
|
1811 |
<?php esc_html_e( 'Add Custom Provider', 'woo-advanced-shipment-tracking' ); ?>
|
1812 |
</a>
|
1813 |
<?php } else { ?>
|
1814 |
-
<p class="provider_message"
|
|
|
|
|
|
|
|
|
|
|
1815 |
<?php
|
1816 |
-
|
1817 |
-
}
|
1818 |
-
?>
|
1819 |
</div>
|
1820 |
<?php
|
1821 |
}
|
@@ -1825,13 +2019,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1825 |
*/
|
1826 |
public function filter_shipiing_provider_by_status_fun() {
|
1827 |
|
1828 |
-
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
1829 |
|
1830 |
-
$status = wc_clean( $_POST['status'] );
|
1831 |
|
1832 |
global $wpdb;
|
1833 |
|
1834 |
-
if( 'active' == $status ){
|
1835 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE display_in_order = 1" );
|
1836 |
}
|
1837 |
|
@@ -1843,13 +2037,12 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1843 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 0" );
|
1844 |
}
|
1845 |
|
1846 |
-
if( 'all' == $status ) {
|
1847 |
$status = '';
|
1848 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
1849 |
}
|
1850 |
|
1851 |
-
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
1852 |
-
echo $html;
|
1853 |
exit;
|
1854 |
}
|
1855 |
|
@@ -1865,27 +2058,41 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1865 |
*/
|
1866 |
public function update_shipment_status_fun() {
|
1867 |
|
1868 |
-
|
|
|
|
|
1869 |
|
1870 |
-
|
|
|
|
|
|
|
|
|
|
|
1871 |
$success = $wpdb->update( $this->table,
|
1872 |
array(
|
1873 |
-
|
1874 |
),
|
1875 |
-
array( 'id' =>
|
1876 |
);
|
1877 |
exit;
|
1878 |
}
|
1879 |
|
1880 |
/**
|
1881 |
-
*
|
1882 |
*/
|
1883 |
public function update_default_provider_fun() {
|
1884 |
|
|
|
|
|
|
|
|
|
1885 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
1886 |
|
1887 |
-
|
1888 |
-
|
|
|
|
|
|
|
1889 |
} else {
|
1890 |
update_option( 'wc_ast_default_provider', '' );
|
1891 |
}
|
@@ -1914,7 +2121,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1914 |
// lowercase
|
1915 |
$text = strtolower($text);
|
1916 |
|
1917 |
-
$text = 'cp-'
|
1918 |
|
1919 |
if ( empty( $text ) ) {
|
1920 |
return '';
|
@@ -1924,13 +2131,17 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1924 |
}
|
1925 |
|
1926 |
/*
|
1927 |
-
*
|
1928 |
*/
|
1929 |
-
public function woocommerce_shipping_provider_delete(){
|
1930 |
|
|
|
|
|
|
|
|
|
1931 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
1932 |
|
1933 |
-
$provider_id = wc_clean( $_POST['provider_id'] );
|
1934 |
|
1935 |
if ( ! empty( $provider_id ) ) {
|
1936 |
global $wpdb;
|
@@ -1943,19 +2154,22 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1943 |
$status = 'all';
|
1944 |
|
1945 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
1946 |
-
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
1947 |
-
echo $html;
|
1948 |
exit;
|
1949 |
}
|
1950 |
|
1951 |
/**
|
1952 |
* Get shipping provider details fun
|
1953 |
*/
|
1954 |
-
public function get_provider_details_fun(){
|
|
|
|
|
|
|
|
|
1955 |
|
1956 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
1957 |
|
1958 |
-
$id = wc_clean( $_POST['provider_id'] );
|
1959 |
global $wpdb;
|
1960 |
|
1961 |
$shippment_provider = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table WHERE id=%d", $id ) );
|
@@ -1977,85 +2191,110 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1977 |
/**
|
1978 |
* Update custom shipping provider and returen html of it
|
1979 |
*/
|
1980 |
-
public function update_custom_shipment_provider_fun(){
|
|
|
|
|
|
|
|
|
1981 |
|
1982 |
check_ajax_referer( 'nonce_edit_shipping_provider', 'nonce_edit_shipping_provider' );
|
1983 |
|
1984 |
global $wpdb;
|
1985 |
|
1986 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1987 |
$api_provider_name = null;
|
1988 |
} else {
|
1989 |
-
$api_provider_name = wc_clean( json_encode( $
|
1990 |
}
|
1991 |
-
|
1992 |
-
$provider_type = $_POST['provider_type'];
|
1993 |
if ( 'default_provider' == $provider_type ) {
|
1994 |
$data_array = array(
|
1995 |
-
'custom_provider_name' =>
|
1996 |
'api_provider_name' => $api_provider_name,
|
|
|
1997 |
);
|
1998 |
-
} else{
|
1999 |
$data_array = array(
|
2000 |
-
'shipping_country' =>
|
2001 |
-
'provider_name' =>
|
2002 |
-
'custom_provider_name' =>
|
2003 |
-
'ts_slug' =>
|
2004 |
-
'custom_thumb_id' =>
|
2005 |
-
'provider_url' =>
|
2006 |
);
|
2007 |
}
|
2008 |
|
2009 |
$where_array = array(
|
2010 |
-
'id' => $
|
2011 |
);
|
2012 |
$wpdb->update( $this->table, $data_array, $where_array );
|
2013 |
$status = 'active';
|
2014 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2015 |
-
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
2016 |
-
echo $html;
|
2017 |
exit;
|
2018 |
}
|
2019 |
|
2020 |
/**
|
2021 |
* Reset default provider
|
2022 |
*/
|
2023 |
-
public function reset_default_provider_fun(){
|
|
|
|
|
|
|
|
|
2024 |
|
2025 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2026 |
|
2027 |
global $wpdb;
|
2028 |
-
|
|
|
|
|
2029 |
$data_array = array(
|
2030 |
-
'custom_provider_name' =>
|
2031 |
-
'custom_thumb_id' =>
|
2032 |
-
'api_provider_name' =>
|
2033 |
);
|
|
|
2034 |
$where_array = array(
|
2035 |
-
'id' => $
|
2036 |
);
|
|
|
2037 |
$wpdb->update( $this->table, $data_array, $where_array );
|
2038 |
$status = 'active';
|
2039 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2040 |
-
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
2041 |
-
echo $html;
|
2042 |
exit;
|
2043 |
}
|
2044 |
|
2045 |
/**
|
2046 |
* Update bulk status of providers to active
|
2047 |
*/
|
2048 |
-
public function update_provider_status_fun(){
|
|
|
|
|
|
|
|
|
2049 |
|
2050 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2051 |
|
2052 |
global $wpdb;
|
2053 |
|
|
|
|
|
2054 |
$data_array = array(
|
2055 |
-
'display_in_order' => $
|
2056 |
);
|
2057 |
|
2058 |
-
$display_in_order = ( 1 == $
|
2059 |
|
2060 |
$where_array = array(
|
2061 |
'display_in_order' => $display_in_order,
|
@@ -2073,16 +2312,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2073 |
*
|
2074 |
* @since 2.4
|
2075 |
*/
|
2076 |
-
public function filter_orders_by_shipping_provider(){
|
2077 |
global $typenow, $wpdb;
|
2078 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2079 |
|
2080 |
if ( 'shop_order' === $typenow ) {
|
2081 |
-
|
2082 |
<select name="_shop_order_shipping_provider" id="dropdown_shop_order_shipping_provider">
|
2083 |
<option value=""><?php esc_html_e( 'Filter by shipping provider', 'woo-advanced-shipment-tracking' ); ?></option>
|
2084 |
<?php foreach ( $default_shippment_providers as $provider ) : ?>
|
2085 |
-
<option value="<?php echo esc_attr( $provider->ts_slug ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipping_provider'] ) ? selected( $provider->ts_slug, $_GET['_shop_order_shipping_provider'], false ) : '' ); ?>>
|
2086 |
<?php printf( '%1$s', esc_html( $provider->provider_name ) ); ?>
|
2087 |
</option>
|
2088 |
<?php endforeach; ?>
|
@@ -2103,7 +2342,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2103 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && '' != $_GET['_shop_order_shipping_provider'] ) {
|
2104 |
$vars['meta_query'][] = array(
|
2105 |
'key' => '_wc_shipment_tracking_items',
|
2106 |
-
'value' => $_GET['_shop_order_shipping_provider'],
|
2107 |
'compare' => 'LIKE'
|
2108 |
);
|
2109 |
}
|
@@ -2121,41 +2360,26 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2121 |
public function filter_orders_by_tracking_number_query( $search_fields ) {
|
2122 |
$search_fields[] = '_wc_shipment_tracking_items';
|
2123 |
return $search_fields;
|
2124 |
-
}
|
2125 |
-
|
2126 |
-
public function update_custom_order_status_email_display_fun() {
|
2127 |
-
|
2128 |
-
check_ajax_referer( 'wc_ast_settings_form', 'security' );
|
2129 |
-
|
2130 |
-
$status = wc_clean( $_POST['status'] );
|
2131 |
-
|
2132 |
-
$wc_ast_show_orders_actions = get_option( 'wc_ast_show_orders_actions' );
|
2133 |
-
$wc_ast_show_orders_actions[$status] = 1;
|
2134 |
-
update_option( 'wc_ast_show_orders_actions', $wc_ast_show_orders_actions );
|
2135 |
-
|
2136 |
-
$wc_ast_unclude_tracking_info = get_option( 'wc_ast_unclude_tracking_info' );
|
2137 |
-
$wc_ast_unclude_tracking_info[$status] = 1;
|
2138 |
-
update_option( 'wc_ast_unclude_tracking_info', $wc_ast_unclude_tracking_info );
|
2139 |
}
|
2140 |
|
2141 |
/*
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
public function get_provider_slug_from_name( $tracking_provider_name ) {
|
2147 |
|
2148 |
global $wpdb;
|
2149 |
|
2150 |
-
$tracking_provider = $wpdb->get_var( $wpdb->prepare( "SELECT ts_slug FROM $this->table WHERE api_provider_name =
|
2151 |
|
2152 |
if ( !$tracking_provider ) {
|
2153 |
-
$query = "SELECT ts_slug FROM $this->table WHERE JSON_CONTAINS(api_provider_name, '[".'"'
|
2154 |
$tracking_provider = $wpdb->get_var( $query );
|
2155 |
}
|
2156 |
|
2157 |
if ( !$tracking_provider ) {
|
2158 |
-
$tracking_provider = $wpdb->get_var( $wpdb->prepare( "SELECT ts_slug FROM $this->table WHERE provider_name =
|
2159 |
}
|
2160 |
|
2161 |
if ( !$tracking_provider ) {
|
@@ -2169,9 +2393,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2169 |
* function for add more provider btn
|
2170 |
*/
|
2171 |
public function add_more_api_provider() {
|
2172 |
-
$tooltip_text = class_exists( 'ast_pro' ) ? __(
|
2173 |
?>
|
2174 |
<span class="dashicons dashicons-insert woocommerce-help-tip tipTip add_more_api_provider" title="<?php esc_html_e( $tooltip_text ); ?>"></span>
|
2175 |
<?php
|
2176 |
}
|
2177 |
-
}
|
5 |
|
6 |
class WC_Advanced_Shipment_Tracking_Admin {
|
7 |
|
|
|
|
|
8 |
/**
|
9 |
* Initialize the main plugin function
|
10 |
*/
|
11 |
+
public function __construct() {
|
12 |
|
13 |
global $wpdb;
|
14 |
if ( is_multisite() ) {
|
20 |
if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
|
21 |
$main_blog_prefix = $wpdb->get_blog_prefix( BLOG_ID_CURRENT_SITE );
|
22 |
$this->table = $main_blog_prefix . 'woo_shippment_provider';
|
23 |
+
} else {
|
24 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
25 |
}
|
26 |
|
94 |
|
95 |
add_action( 'wp_ajax_update_default_provider', array( $this, 'update_default_provider_fun') );
|
96 |
|
97 |
+
add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
|
|
|
|
|
98 |
|
99 |
add_action( 'update_order_status_after_adding_tracking', array( $this, 'update_order_status_after_adding_tracking'), 10, 2 );
|
100 |
|
146 |
}
|
147 |
|
148 |
/*
|
149 |
+
* Get shipped orders
|
150 |
*/
|
151 |
+
public function get_shipped_orders() {
|
152 |
$range = get_option( 'wc_ast_api_date_range', 30 );
|
153 |
$args = array(
|
154 |
'status' => 'wc-completed',
|
156 |
);
|
157 |
|
158 |
if ( 0 != $range ) {
|
159 |
+
$start = strtotime( gmdate( 'Y-m-d 00:00:00', strtotime( '-' . $range . ' days' ) ) );
|
160 |
+
$end = strtotime( gmdate( 'Y-m-d 23:59:59', strtotime( '-1 days' ) ) );
|
161 |
+
$args['date_completed'] = $start . ' ... ' . $end;
|
162 |
}
|
163 |
|
164 |
return wc_get_orders( $args );
|
182 |
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
|
183 |
wp_enqueue_script( 'select2');
|
184 |
|
185 |
+
wp_enqueue_style( 'ast_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/admin.css', array(), wc_advanced_shipment_tracking()->version );
|
186 |
+
wp_register_style( 'trackship_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/trackship.css', array(), wc_advanced_shipment_tracking()->version );
|
187 |
|
188 |
+
wp_enqueue_style( 'front_style', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/front.css', array(), wc_advanced_shipment_tracking()->version );
|
189 |
|
190 |
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version, true );
|
191 |
|
221 |
|
222 |
wp_enqueue_script( 'front-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/front.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version );
|
223 |
|
224 |
+
wp_register_script( 'shipment_tracking_table_rows', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/shipping_row.js' , array( 'jquery', 'wp-util' ), wc_advanced_shipment_tracking()->version );
|
225 |
|
226 |
wp_localize_script( 'shipment_tracking_table_rows', 'shipment_tracking_table_rows', array(
|
227 |
'i18n' => array(
|
231 |
'browser_not_html' => __( 'This browser does not support HTML5.', 'woo-advanced-shipment-tracking' ),
|
232 |
'upload_valid_csv_file' => __( 'Please upload a valid CSV file.', 'woo-advanced-shipment-tracking' ),
|
233 |
),
|
234 |
+
'delete_rates_nonce' => wp_create_nonce( 'delete-rate' ),
|
235 |
) );
|
236 |
wp_enqueue_media();
|
237 |
}
|
272 |
|
273 |
<div class="zorem-layout">
|
274 |
<div class="zorem-layout__header">
|
275 |
+
<img class="zorem-layout__header-logo" src="<?php echo esc_html( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/ast-logo.png">
|
276 |
|
277 |
<div class="woocommerce-layout__activity-panel">
|
278 |
<div class="woocommerce-layout__activity-panel-tabs">
|
350 |
<div class="woocommerce zorem_admin_layout">
|
351 |
<div class="ast_admin_content" >
|
352 |
<div class="ast_nav_div">
|
353 |
+
<?php
|
354 |
+
$this->get_html_menu_tab( $this->get_ast_tab_settings_data() );
|
355 |
require_once( 'views/admin_options_shipping_provider.php' );
|
356 |
require_once( 'views/admin_options_settings.php' );
|
357 |
+
require_once( 'views/admin_options_bulk_upload.php' );
|
358 |
+
require_once( 'views/integrations_admin_options.php' );
|
359 |
do_action( 'ast_paypal_settings_panel' );
|
360 |
require_once( 'views/admin_options_addons.php' );
|
361 |
+
include 'views/admin_options_trackship_integration.php';
|
362 |
+
?>
|
363 |
</div>
|
364 |
</div>
|
365 |
</div>
|
366 |
+
</div>
|
367 |
+
<div id="" class="popupwrapper upgrade_to_pro_popup" style="display:none;">
|
368 |
+
<div class="popuprow">
|
369 |
+
<div class="popup_body">
|
370 |
+
<h2 class="upgrade_title">Upgrade to AST PRO</h2>
|
371 |
+
<ul class="ast_pro_features_list">
|
372 |
+
<li>Premium Support</li>
|
373 |
+
<li>Tracking per item</li>
|
374 |
+
<li>Fully customizable responsive tracking widget</li>
|
375 |
+
<li>Custom order status "Shipped"</li>
|
376 |
+
<li>Custom email templates</li>
|
377 |
+
<li>PayPal tracking integration</li>
|
378 |
+
<li>Fulfillment dashboard</li>
|
379 |
+
<li>Auto-detect shipping providers</li>
|
380 |
+
<li>Tracking automation - Built-in integrations with ShipStation, Ordoro, WooCommerce Shipping and more..</li>
|
381 |
+
</ul>
|
382 |
+
<a href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/" class="button-primary btn_ast2 btn_large" target="_blank">UPGRADE TO PRO</a>
|
383 |
+
</div>
|
384 |
+
</div>
|
385 |
+
<div class="popupclose"></div>
|
386 |
+
</div>
|
387 |
+
<?php
|
388 |
+
}
|
389 |
|
390 |
/*
|
391 |
* callback for Shipment Tracking menu array
|
438 |
'name' => 'tabs',
|
439 |
'position' => 4,
|
440 |
),
|
441 |
+
'integrations_tab' => array(
|
442 |
+
'title' => __( 'Integrations', 'woo-advanced-shipment-tracking' ),
|
443 |
+
'show' => true,
|
444 |
+
'class' => 'tab_label',
|
445 |
+
'data-tab' => 'integrations',
|
446 |
+
'data-label' => 'Integrations',
|
447 |
+
'name' => 'tabs',
|
448 |
+
),
|
449 |
'trackship' => array(
|
450 |
'title' => 'TrackShip',
|
451 |
'show' => $trackship_display,
|
495 |
return apply_filters( 'ast_general_settings_tab_options', $setting_data );
|
496 |
}
|
497 |
|
498 |
+
/*
|
499 |
+
* functions for add integrations options in AST settings
|
500 |
+
*/
|
501 |
+
public function integrations_settings_options() {
|
502 |
+
|
503 |
+
$form_data = array(
|
504 |
+
'enable_shipstation_integration' => array(
|
505 |
+
'type' => 'tgl_checkbox',
|
506 |
+
'title' => __( 'Enable the ShipStation integration', 'woo-advanced-shipment-tracking' ),
|
507 |
+
'desc' => __( 'Adding tracking information to your orders shipped with ShipStation and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
508 |
+
'img' => 'shipstation.png',
|
509 |
+
'show' => true,
|
510 |
+
'default' => 0,
|
511 |
+
'disabled' => true,
|
512 |
+
'class' => '',
|
513 |
+
),
|
514 |
+
'enable_wc_shipping_integration' => array(
|
515 |
+
'type' => 'tgl_checkbox',
|
516 |
+
'title' => __( 'Enable the WC Shipping integration', 'woo-advanced-shipment-tracking' ),
|
517 |
+
'desc' => __( 'Adding tracking information to your orders shipped with WooCommerce Shipping to the Shipment Tracking and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
518 |
+
'img' => 'woo-shipping.png',
|
519 |
+
'show' => true,
|
520 |
+
'default' => 0,
|
521 |
+
'disabled' => true,
|
522 |
+
'class' => '',
|
523 |
+
),
|
524 |
+
'enable_ups_shipping_label_pluginhive' => array(
|
525 |
+
'type' => 'tgl_checkbox',
|
526 |
+
'title' => __( 'Enable the WooCommerce UPS Shipping Plugin with Print Label plugin integration', 'woo-advanced-shipment-tracking' ),
|
527 |
+
'desc' => __( 'Adding tracking information to your orders when generating shipping labels using the WooCommerce UPS Shipping Plugin with Print Label plugin by PluginHive', 'woo-advanced-shipment-tracking' ),
|
528 |
+
'img' => 'woo-UPS-shipping.png',
|
529 |
+
'show' => true,
|
530 |
+
'default' => 0,
|
531 |
+
'disabled' => true,
|
532 |
+
'class' => '',
|
533 |
+
),
|
534 |
+
'enable_ordoro_integration' => array(
|
535 |
+
'type' => 'tgl_checkbox',
|
536 |
+
'title' => __( 'Enable the Ordoro tracking integration', 'woo-advanced-shipment-tracking' ),
|
537 |
+
'desc' => __( 'Adding tracking information to your orders when generating shipping labels using the Ordoro', 'woo-advanced-shipment-tracking' ),
|
538 |
+
'img' => 'ordoro.png',
|
539 |
+
'show' => true,
|
540 |
+
'default' => 0,
|
541 |
+
'disabled' => true,
|
542 |
+
'class' => '',
|
543 |
+
),
|
544 |
+
'enable_quickbooks_commerce_integration' => array(
|
545 |
+
'type' => 'tgl_checkbox',
|
546 |
+
'title' => __( 'Enable the QuickBooks Commerce (formerly TradeGecko) Integrations', 'woo-advanced-shipment-tracking' ),
|
547 |
+
'desc' => __( 'Adding tracking information to your orders shipped with QuickBooks Commerce and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
548 |
+
'img' => 'quickbooks.png',
|
549 |
+
'show' => true,
|
550 |
+
'default' => 0,
|
551 |
+
'disabled' => true,
|
552 |
+
'class' => '',
|
553 |
+
),
|
554 |
+
'enable_readytoship_integration' => array(
|
555 |
+
'type' => 'tgl_checkbox',
|
556 |
+
'title' => __( 'Enable the ReadyToShip integration', 'woo-advanced-shipment-tracking' ),
|
557 |
+
'desc' => __( 'Adding tracking information to your orders shipped with ReadyToShip and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
558 |
+
'img' => 'readytoship.png',
|
559 |
+
'show' => true,
|
560 |
+
'default' => 0,
|
561 |
+
'disabled' => true,
|
562 |
+
'class' => '',
|
563 |
+
),
|
564 |
+
'enable_royalmail_integration' => array(
|
565 |
+
'type' => 'tgl_checkbox',
|
566 |
+
'title' => __( 'Enable the Royal Mail Click & Drop integration', 'woo-advanced-shipment-tracking' ),
|
567 |
+
'desc' => __( 'Adding tracking information to your orders shipped with Royal Mail Click & Drop and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
568 |
+
'img' => 'royal-mail.png',
|
569 |
+
'show' => true,
|
570 |
+
'default' => 0,
|
571 |
+
'disabled' => true,
|
572 |
+
'class' => '',
|
573 |
+
),
|
574 |
+
'enable_customcat_integration' => array(
|
575 |
+
'type' => 'tgl_checkbox',
|
576 |
+
'title' => __( 'Enable the CustomCat integration', 'woo-advanced-shipment-tracking' ),
|
577 |
+
'desc' => __( 'Adding tracking information to your orders shipped with CustomCat and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
578 |
+
'img' => 'customcat.png',
|
579 |
+
'show' => true,
|
580 |
+
'default' => 0,
|
581 |
+
'disabled' => true,
|
582 |
+
'class' => '',
|
583 |
+
),
|
584 |
+
'enable_dear_inventory_integration' => array(
|
585 |
+
'type' => 'tgl_checkbox',
|
586 |
+
'title' => __( 'Enable the Dear Systems integration', 'woo-advanced-shipment-tracking' ),
|
587 |
+
'desc' => __( 'Adding tracking information to your orders shipped with Dear Systems and automate your workflow', 'woo-advanced-shipment-tracking' ),
|
588 |
+
'img' => 'dear-system.png',
|
589 |
+
'show' => true,
|
590 |
+
'default' => 0,
|
591 |
+
'disabled' => true,
|
592 |
+
'class' => '',
|
593 |
+
),
|
594 |
+
'enable_ali2woo_integration' => array(
|
595 |
+
'type' => 'tgl_checkbox',
|
596 |
+
'title' => __( 'Enable the AliExpress Dropshipping integration', 'woo-advanced-shipment-tracking' ),
|
597 |
+
'desc' => __( 'Add Tracking Information in AST meta fields when you automatically sync tracking numbers from aliexpress orders', 'woo-advanced-shipment-tracking' ),
|
598 |
+
'img' => 'aliexpress.png',
|
599 |
+
'show' => true,
|
600 |
+
'default' => 0,
|
601 |
+
'disabled' => true,
|
602 |
+
'class' => '',
|
603 |
+
),
|
604 |
+
'enable_pdf_invoice_integration_ewout' => array(
|
605 |
+
'type' => 'tgl_checkbox',
|
606 |
+
'title' => __( 'PDF invoices integration for WooCommerce PDF Invoices & Packing Slips plugin By Ewout Fernhout', 'woo-advanced-shipment-tracking' ),
|
607 |
+
'desc' => __( 'Add tracking information in invoice PDF generate by WooCommerce PDF Invoices & Packing Slips plugin By Ewout Fernhout', 'woo-advanced-shipment-tracking' ),
|
608 |
+
'img' => 'WooCommerce-PDF-Invoices-Packing-Slips.png',
|
609 |
+
'show' => true,
|
610 |
+
'default' => 0,
|
611 |
+
'disabled' => true,
|
612 |
+
'class' => '',
|
613 |
+
),
|
614 |
+
'enable_pdf_invoice_integration_bas' => array(
|
615 |
+
'type' => 'tgl_checkbox',
|
616 |
+
'title' => __( 'PDF invoices integration for WooCommerce PDF Invoices plugin By Bas Elbers', 'woo-advanced-shipment-tracking' ),
|
617 |
+
'desc' => __( 'Add tracking information in invoice PDF generate by WooCommerce PDF Invoices plugin By Bas Elbers', 'woo-advanced-shipment-tracking' ),
|
618 |
+
'img' => 'WooCommerce-PDF-Invoices.png',
|
619 |
+
'show' => true,
|
620 |
+
'default' => 0,
|
621 |
+
'disabled' => true,
|
622 |
+
'class' => '',
|
623 |
+
),
|
624 |
+
);
|
625 |
+
|
626 |
+
return $form_data;
|
627 |
+
}
|
628 |
+
|
629 |
/*
|
630 |
* callback for HTML function for Shipment Tracking menu
|
631 |
*/
|
632 |
+
public function get_html_menu_tab( $arrays, $tab_class = 'tab_input' ) {
|
633 |
|
634 |
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'settings';
|
635 |
$settings = isset( $_GET['settings'] ) ? sanitize_text_field( $_GET['settings'] ) : 'general-settings';
|
636 |
|
637 |
foreach ( (array) $arrays as $id => $array ) {
|
638 |
$checked = ( $tab == $array['data-tab'] || $settings == $array['data-tab'] ) ? 'checked' : '';
|
639 |
+
if ( $array['show'] ) {
|
640 |
+
if ( isset( $array['type'] ) && 'link' == $array['type'] ) {
|
641 |
+
?>
|
642 |
<a class="menu_trackship_link" href="<?php esc_html_e( esc_url( $array['link'] ) ); ?>"><?php esc_html_e( $array['title'] ); ?></a>
|
643 |
<?php
|
644 |
} else {
|
645 |
+
?>
|
646 |
<input class="<?php esc_html_e( $tab_class ); ?>" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $array['name'] ); ?>" type="radio" data-tab="<?php esc_html_e( $array['data-tab'] ); ?>" data-label="<?php esc_html_e( $array['data-label'] ); ?>" <?php esc_html_e( $checked ); ?>/>
|
647 |
<label class="<?php esc_html_e( $array['class'] ); ?>" for="<?php esc_html_e( $id ); ?>"><?php esc_html_e( $array['title'] ); ?></label>
|
648 |
<?php
|
658 |
?>
|
659 |
<ul class="settings_ul">
|
660 |
<?php
|
661 |
+
foreach ( (array) $arrays as $id => $array ) {
|
662 |
|
663 |
+
if ( $array['show'] ) {
|
664 |
|
665 |
+
if ( 'checkbox' == $array['type'] ) {
|
666 |
$default = isset( $array['default'] ) ? $array['default'] : '';
|
667 |
$checked = ( get_option( $id, $default ) ) ? 'checked' : '' ;
|
668 |
?>
|
681 |
$default = isset( $array['default'] ) ? $array['default'] : '';
|
682 |
$checked = ( get_option( $id, $default ) ) ? 'checked' : '' ;
|
683 |
$tgl_class = isset( $array['tgl_color'] ) ? 'ast-tgl-btn-green' : '';
|
684 |
+
$disabled = isset( $array['disabled'] ) && true == $array['disabled'] ? 'disabled' : '';
|
685 |
+
?>
|
686 |
<li>
|
687 |
<span class="ast-tgl-btn-parent">
|
688 |
<input type="hidden" name="<?php esc_html_e( $id ); ?>" value="0"/>
|
707 |
</li>
|
708 |
<?php
|
709 |
} else if ( 'radio' == $array['type'] ) {
|
710 |
+
?>
|
711 |
<li class="settings_radio_li">
|
712 |
<label><strong><?php esc_html_e( $array['title'] ); ?></strong>
|
713 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
717 |
|
718 |
<?php
|
719 |
|
720 |
+
foreach ( (array) $array['options'] as $key => $val ) {
|
721 |
+
$selected = ( get_option( $id, $array['default'] ) == (string) $key ) ? 'checked' : '' ;
|
722 |
?>
|
723 |
<span class="radio_section">
|
724 |
<label class="" for="<?php esc_html_e( $id ); ?>_<?php esc_html_e( $key ); ?>">
|
726 |
<span class=""><?php esc_html_e( $val ); ?></span></br>
|
727 |
</label>
|
728 |
</span>
|
729 |
+
<?php } ?>
|
|
|
|
|
730 |
</li>
|
731 |
<?php
|
732 |
} else if ( 'multiple_select' == $array['type'] ) {
|
733 |
+
?>
|
734 |
<li class="multiple_select_li">
|
735 |
<label><?php esc_html_e( $array['title'] ); ?>
|
736 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
753 |
</li>
|
754 |
<?php
|
755 |
} else if ( 'multiple_checkbox' == $array['type'] ) {
|
756 |
+
?>
|
757 |
<li>
|
758 |
<div class="multiple_checkbox_label">
|
759 |
<label for=""><strong><?php esc_html_e( $array['title'] ); ?></strong></label>
|
779 |
</li>
|
780 |
<?php
|
781 |
} else if ( 'dropdown_tpage' == $array['type'] ) {
|
782 |
+
?>
|
783 |
<li>
|
784 |
<label class="left_label"><?php esc_html_e( $array['title'] ); ?>
|
785 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
791 |
<?php
|
792 |
foreach ( (array) $array['options'] as $page_id => $page_name ) {
|
793 |
$selected = ( get_option( $id ) == $page_id ) ? 'selected' : '' ;
|
794 |
+
?>
|
795 |
<option value="<?php esc_html_e( $page_id ); ?>" <?php esc_html_e( $selected ); ?>><?php esc_html_e( $page_name ); ?></option>
|
796 |
<?php
|
797 |
+
}
|
798 |
+
$selected = ( 'other' == get_option( $id ) ) ? 'selected' : '';
|
799 |
?>
|
800 |
+
<option <?php esc_html_e( $selected ); ?> value="other"><?php esc_html_e( 'Other', 'woo-advanced-shipment-tracking' ); ?></option>
|
801 |
</select>
|
802 |
+
<?php $style = ( 'other' != get_option( $id ) ) ? 'display:none;' : ''; ?>
|
803 |
+
<fieldset style="<?php esc_html_e( $style ); ?>" class="trackship_other_page_fieldset">
|
804 |
<input type="text" name="wc_ast_trackship_other_page" id="wc_ast_trackship_other_page" value="<?php esc_html_e( get_option('wc_ast_trackship_other_page') ); ?>">
|
805 |
</fieldset>
|
806 |
|
811 |
</li>
|
812 |
<?php
|
813 |
} else if ( 'button' == $array['type'] ) {
|
814 |
+
?>
|
815 |
<li>
|
816 |
<label class="left_label"><?php esc_html_e( $array['title'] ); ?>
|
817 |
<?php if ( isset( $array['tooltip'] ) ) { ?>
|
819 |
<?php } ?>
|
820 |
</label>
|
821 |
<?php
|
822 |
+
if ( isset( $array['customize_link'] ) ) {
|
823 |
+
?>
|
824 |
<a href="<?php esc_html_e( $array['customize_link'] ); ?>" class="button-primary btn_ts_transparent btn_large ts_customizer_btn"><?php esc_html_e( 'Customize', 'woo-advanced-shipment-tracking' ); ?></a>
|
825 |
<?php } ?>
|
826 |
</li>
|
827 |
<?php
|
828 |
}
|
829 |
}
|
830 |
+
}
|
831 |
+
?>
|
832 |
</ul>
|
833 |
<?php
|
834 |
}
|
835 |
|
836 |
public function get_add_tracking_options() {
|
837 |
|
838 |
+
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped', 0 );
|
839 |
|
840 |
+
if ( 1 == $wc_ast_status_shipped ) {
|
841 |
$completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
842 |
} else {
|
843 |
$completed_order_label = __( 'Completed', 'woocommerce' );
|
867 |
|
868 |
foreach ( $custom_order_status as $key => $value ) {
|
869 |
unset($custom_order_status[$key]);
|
870 |
+
$key = str_replace( 'wc-', '', $key);
|
871 |
$custom_order_status[$key] = array(
|
872 |
'status' => __( $value, '' ),
|
873 |
'type' => 'custom',
|
875 |
}
|
876 |
|
877 |
$actions_order_status = array(
|
878 |
+
'processing' => array(
|
879 |
'status' => __( 'Processing', 'woocommerce' ),
|
880 |
'type' => 'default',
|
881 |
),
|
882 |
+
'completed' => array(
|
883 |
'status' => $completed_order_label,
|
884 |
'type' => 'default',
|
885 |
),
|
886 |
+
'partial-shipped' => array(
|
887 |
'status' => __( 'Partially Shipped', '' ),
|
888 |
'type' => 'default',
|
889 |
'class' => 'partially_shipped_checkbox',
|
890 |
),
|
891 |
+
'updated-tracking' => array(
|
892 |
'status' => __( 'Updated Tracking', '' ),
|
893 |
'type' => 'default',
|
894 |
'class' => 'updated_tracking_checkbox',
|
895 |
),
|
896 |
+
'on-hold' => array(
|
897 |
'status' => __( 'On Hold', 'woocommerce' ),
|
898 |
'type' => 'default',
|
899 |
),
|
900 |
+
'cancelled' => array(
|
901 |
'status' => __( 'Cancelled', 'woocommerce' ),
|
902 |
'type' => 'default',
|
903 |
),
|
904 |
+
'refunded' => array(
|
905 |
'status' => __( 'Refunded', 'woocommerce' ),
|
906 |
'type' => 'default',
|
907 |
),
|
908 |
+
'failed' => array(
|
909 |
'status' => __( 'Failed', 'woocommerce' ),
|
910 |
'type' => 'default',
|
911 |
),
|
933 |
|
934 |
public function get_customer_view_options() {
|
935 |
|
936 |
+
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped', 0 );
|
937 |
$completed_order_label = ( 1 == $wc_ast_status_shipped ) ? __( 'Shipped', 'woo-advanced-shipment-tracking' ) : __( 'Completed', 'woocommerce' );
|
938 |
|
939 |
$all_order_status = wc_get_order_statuses();
|
961 |
|
962 |
foreach ( $custom_order_status as $key => $value ) {
|
963 |
unset($custom_order_status[$key]);
|
964 |
+
$key = str_replace( 'wc-', '', $key);
|
965 |
$custom_order_status[$key] = array(
|
966 |
'status' => __( $value, '' ),
|
967 |
'type' => 'custom',
|
969 |
}
|
970 |
|
971 |
$order_status = array(
|
972 |
+
'processing' => array(
|
973 |
'status' => __( 'Processing', 'woocommerce' ),
|
974 |
'type' => 'default',
|
975 |
),
|
976 |
+
'completed' => array(
|
977 |
'status' => $completed_order_label,
|
978 |
'type' => 'default',
|
979 |
),
|
980 |
+
'partial-shipped' => array(
|
981 |
'status' => __( 'Partially Shipped', '' ),
|
982 |
'type' => 'default',
|
983 |
'class' => 'partially_shipped_checkbox',
|
984 |
),
|
985 |
+
'updated-tracking' => array(
|
986 |
'status' => __( 'Updated Tracking', '' ),
|
987 |
'type' => 'default',
|
988 |
'class' => 'updated_tracking_checkbox',
|
989 |
),
|
990 |
+
'cancelled' => array(
|
991 |
'status' => __( 'Cancelled', 'woocommerce' ),
|
992 |
'type' => 'default',
|
993 |
),
|
994 |
+
'on-hold' => array(
|
995 |
'status' => __( 'On Hold', 'woocommerce' ),
|
996 |
'type' => 'default',
|
997 |
),
|
998 |
+
'refunded' => array(
|
999 |
'status' => __( 'Refunded', 'woocommerce' ),
|
1000 |
'type' => 'default',
|
1001 |
),
|
1002 |
|
1003 |
+
'failed' => array(
|
1004 |
'status' => __( 'Failed', 'woocommerce' ),
|
1005 |
'type' => 'default',
|
1006 |
),
|
1007 |
+
'show_in_customer_invoice' => array(
|
1008 |
'status' => __( 'Customer Invoice', 'woocommerce' ),
|
1009 |
'type' => 'default',
|
1010 |
),
|
1011 |
+
'show_in_customer_note' => array(
|
1012 |
'status' => __( 'Customer note', 'woocommerce' ),
|
1013 |
'type' => 'default',
|
1014 |
),
|
1044 |
$form_data = array(
|
1045 |
'wc_ast_api_date_format' => array(
|
1046 |
'type' => 'radio',
|
1047 |
+
'title' => __( 'API Date Format', 'woo-advanced-shipment-tracking' ),
|
1048 |
'desc' => __( 'Choose for which Order status to display', 'woo-advanced-shipment-tracking' ),
|
1049 |
'options' => array(
|
1050 |
+
'd-m-Y' => 'DD/MM/YYYY',
|
1051 |
+
'm-d-Y' => 'MM/DD/YYYY',
|
1052 |
),
|
1053 |
'default' => 'd-m-Y',
|
1054 |
'show' => true,
|
1090 |
'wcast_enable_updated_tracking_email' => array(
|
1091 |
'type' => 'checkbox',
|
1092 |
'title' => __( 'Enable the Updated Tracking order status email', '' ),
|
1093 |
+
'title_link'=> "<a class='settings_edit' href='" . ps_customizer()->get_customizer_url( 'custom_order_status_email' , 'updated_tracking' ) . "'>" . __( 'Edit', 'woocommerce' ) . '</a>',
|
1094 |
'class' => 'updated_tracking_status_label_color_th',
|
1095 |
'show' => true,
|
1096 |
),
|
1102 |
* get Partially Shipped array data
|
1103 |
* return array
|
1104 |
*/
|
1105 |
+
public function get_partial_shipped_data() {
|
1106 |
$form_data = array(
|
1107 |
'wc_ast_status_partial_shipped' => array(
|
1108 |
'type' => 'checkbox',
|
1130 |
'wcast_enable_partial_shipped_email' => array(
|
1131 |
'type' => 'checkbox',
|
1132 |
'title' => __( 'Enable the Partially Shipped order status email', '' ),
|
1133 |
+
'title_link'=> "<a class='settings_edit' href='" . ps_customizer()->get_customizer_url( 'custom_order_status_email', 'partially_shipped' ) . "'>" . __( 'Edit', 'woocommerce' ) . '</a>',
|
1134 |
'class' => 'partial_shipped_status_label_color_th',
|
1135 |
'show' => true,
|
1136 |
),
|
1143 |
* get Order Status data
|
1144 |
* return array
|
1145 |
*/
|
1146 |
+
public function get_osm_data() {
|
1147 |
$osm_data = array(
|
1148 |
'partial_shipped' => array(
|
1149 |
'id' => 'wc_ast_status_partial_shipped',
|
1151 |
'label' => __( 'Partially Shipped', 'woo-advanced-shipment-tracking' ),
|
1152 |
'label_class' => 'wc-partially-shipped',
|
1153 |
'option_id' => 'woocommerce_customer_partial_shipped_order_settings',
|
1154 |
+
'edit_email'=> ps_customizer()->get_customizer_url( 'custom_order_status_email', 'partially_shipped' ),
|
1155 |
'label_color_field' => 'wc_ast_status_partial_shipped_label_color',
|
1156 |
'font_color_field' => 'wc_ast_status_partial_shipped_label_font_color',
|
1157 |
'email_field' => 'wcast_enable_partial_shipped_email',
|
1158 |
),
|
1159 |
);
|
1160 |
|
1161 |
+
$updated_tracking_status = get_option( 'wc_ast_status_updated_tracking', 0);
|
1162 |
|
1163 |
if ( true == $updated_tracking_status ) {
|
1164 |
$updated_tracking_data = array(
|
1168 |
'label' => __( 'Updated Tracking', 'woo-advanced-shipment-tracking' ),
|
1169 |
'label_class' => 'wc-updated-tracking',
|
1170 |
'option_id' => 'woocommerce_customer_updated_tracking_order_settings',
|
1171 |
+
'edit_email'=> ut_customizer()->get_customizer_url( 'custom_order_status_email', 'updated_tracking' ),
|
1172 |
'label_color_field' => 'wc_ast_status_updated_tracking_label_color',
|
1173 |
'font_color_field' => 'wc_ast_status_updated_tracking_label_font_color',
|
1174 |
'email_field' => 'wcast_enable_updated_tracking_email',
|
1196 |
$_POST[ $key ][$op_status] = 0;
|
1197 |
}
|
1198 |
|
1199 |
+
if ( isset( $_POST[ $key ] ) ) {
|
1200 |
+
foreach ( wc_clean( $_POST[ $key ] ) as $key1 => $status) {
|
1201 |
+
$_POST[ $key ][$status] = 1;
|
1202 |
+
}
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
if ( isset( $_POST[ $key ] ) ) {
|
1206 |
+
update_option( $key, wc_clean( $_POST[ $key ] ) );
|
1207 |
}
|
1208 |
|
|
|
1209 |
|
1210 |
} else {
|
1211 |
|
1233 |
$_POST[ $key ][$op_status] = 0;
|
1234 |
}
|
1235 |
|
1236 |
+
foreach ( wc_clean( $_POST[ $key ] ) as $key1 => $status) {
|
1237 |
$_POST[ $key ][$status] = 1;
|
1238 |
}
|
1239 |
|
1255 |
update_option( $key, wc_clean( $_POST[ $key ] ) );
|
1256 |
}
|
1257 |
}
|
1258 |
+
|
1259 |
+
$wc_ast_status_shipped = isset( $_POST[ 'wc_ast_status_shipped' ] ) ? wc_clean( $_POST[ 'wc_ast_status_shipped' ] ) : '';
|
1260 |
+
update_option( 'wc_ast_status_shipped', $wc_ast_status_shipped );
|
1261 |
|
1262 |
$data = $this->get_partial_shipped_data();
|
1263 |
|
1313 |
}
|
1314 |
|
1315 |
/*
|
1316 |
+
* Change style of delivered order label
|
1317 |
*/
|
1318 |
+
public function footer_function() {
|
1319 |
if ( !is_plugin_active( 'woocommerce-order-status-manager/woocommerce-order-status-manager.php' ) ) {
|
1320 |
$bg_color = get_option( 'wc_ast_status_label_color', '#59c889' );
|
1321 |
$color = get_option( 'wc_ast_status_label_font_color', '#fff' );
|
1328 |
?>
|
1329 |
<style>
|
1330 |
.order-status.status-delivered,.order-status-table .order-label.wc-delivered{
|
1331 |
+
background: <?php esc_html_e( $bg_color ); ?>;
|
1332 |
+
color: <?php esc_html_e( $color ); ?>;
|
1333 |
}
|
1334 |
.order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
|
1335 |
+
background: <?php esc_html_e( $ps_bg_color ); ?>;
|
1336 |
+
color: <?php esc_html_e( $ps_color ); ?>;
|
1337 |
}
|
1338 |
.order-status.status-updated-tracking,.order-status-table .order-label.wc-updated-tracking{
|
1339 |
+
background: <?php esc_html_e( $ut_bg_color ); ?>;
|
1340 |
+
color: <?php esc_html_e( $ut_color ); ?>;
|
1341 |
}
|
1342 |
</style>
|
1343 |
<?php
|
1347 |
/*
|
1348 |
* Ajax call for upload tracking details into order from bulk upload
|
1349 |
*/
|
1350 |
+
public function upload_tracking_csv_fun() {
|
1351 |
|
1352 |
check_ajax_referer( 'nonce_csv_import', 'security' );
|
1353 |
|
1354 |
+
$replace_tracking_info = isset( $_POST['replace_tracking_info'] ) ? wc_clean( $_POST['replace_tracking_info'] ) : '';
|
1355 |
+
$date_format_for_csv_import = isset( $_POST['date_format_for_csv_import'] ) ? wc_clean( $_POST['date_format_for_csv_import'] ) : '';
|
1356 |
update_option( 'date_format_for_csv_import', $date_format_for_csv_import );
|
1357 |
+
$order_number = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
1358 |
|
1359 |
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
1360 |
+
$order_id = $wast->get_formated_order_id( $order_number );
|
1361 |
+
|
1362 |
+
$tracking_provider = isset( $_POST['tracking_provider'] ) ? wc_clean( $_POST['tracking_provider'] ) : '';
|
1363 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
1364 |
+
$status_shipped = ( isset( $_POST['status_shipped'] ) ? wc_clean( $_POST['status_shipped'] ) : '' );
|
1365 |
+
$date_shipped = ( isset( $_POST['date_shipped'] ) ? wc_clean( $_POST['date_shipped'] ) : '' );
|
1366 |
+
$date_shipped = str_replace( '/', '-', $date_shipped );
|
1367 |
+
$trackings = ( isset( $_POST['trackings'] ) ? wc_clean( $_POST['trackings'] ) : '' );
|
1368 |
|
1369 |
$sku = isset( $_POST['sku'] ) ? wc_clean( $_POST['sku'] ) : '';
|
1370 |
$qty = isset( $_POST['qty'] ) ? wc_clean( $_POST['qty'] ) : '';
|
1371 |
+
$date_shipped = empty( $date_shipped ) ? gmdate('d-m-Y') : $date_shipped ;
|
1372 |
|
1373 |
global $wpdb;
|
1374 |
|
1375 |
$sql = $wpdb->prepare( "SELECT COUNT(*) FROM {$this->table} WHERE api_provider_name = %s", $tracking_provider );
|
1376 |
$shippment_provider = $wpdb->get_var( $sql );
|
1377 |
|
1378 |
+
if ( 0 == $shippment_provider ) {
|
1379 |
+
$sql = "SELECT COUNT(*) FROM {$this->table} WHERE JSON_CONTAINS(api_provider_name, '[" . '"' . $tracking_provider . '"' . "]')";
|
1380 |
$shippment_provider = $wpdb->get_var( $sql );
|
1381 |
}
|
1382 |
|
1383 |
+
if ( 0 == $shippment_provider ) {
|
1384 |
$sql = $wpdb->prepare( "SELECT COUNT(*) FROM {$this->table} WHERE provider_name = %s", $tracking_provider );
|
1385 |
$shippment_provider = $wpdb->get_var( $sql );
|
1386 |
}
|
1387 |
|
1388 |
$order = wc_get_order($order_id);
|
1389 |
|
1390 |
+
if ( false === $order ) {
|
1391 |
+
echo '<li class="invalid_order_id_error">Failed - Invalid Order Id - Order ' . esc_html( $order_number ) . '</li>';
|
1392 |
+
exit;
|
1393 |
}
|
1394 |
|
1395 |
+
if ( 0 == $shippment_provider ) {
|
1396 |
+
echo '<li class="shipping_provider_error">Failed - Invalid Shipping Provider - Order ' . esc_html( $order_number ) . '</li>';
|
1397 |
+
exit;
|
1398 |
}
|
1399 |
|
1400 |
+
if ( empty( $tracking_number ) ) {
|
1401 |
+
echo '<li class="tracking_number_error">Failed - Empty Tracking Number - Order ' . esc_html( $order_number ) . '</li>';
|
1402 |
+
exit;
|
1403 |
}
|
1404 |
|
1405 |
if ( empty( $date_shipped ) ) {
|
1406 |
+
echo '<li class="empty_date_shipped_error">Failed - Empty Date Shipped - Order ' . esc_html( $order_number ) . '</li>';
|
1407 |
+
exit;
|
1408 |
}
|
1409 |
|
1410 |
if ( !$this->isDate( $date_shipped, $date_format_for_csv_import ) ) {
|
1411 |
+
echo '<li class="invalid_date_shipped_error">Failed - Invalid Date Shipped - Order ' . esc_html( $order_number ) . '</li>';
|
1412 |
+
exit;
|
1413 |
}
|
1414 |
|
1415 |
if ( 'm-d-Y' == $date_format_for_csv_import ) {
|
1416 |
+
$date_array = explode( '-', $date_shipped );
|
1417 |
+
$date_shipped = $date_array[1] . '-' . $date_array[0] . '-' . $date_array[2];
|
1418 |
}
|
1419 |
|
1420 |
$tracking_items = $wast->get_tracking_items( $order_id );
|
1432 |
|
1433 |
if ( class_exists( 'ast_woo_advanced_shipment_tracking_by_products' ) ) {
|
1434 |
$item_tracking_number = $item['tracking_number'];
|
1435 |
+
$tracking_exist = in_array( $item_tracking_number, array_column( $trackings, 'tracking_number' ) );
|
1436 |
}
|
1437 |
|
1438 |
+
if ( false == $tracking_exist ) {
|
1439 |
unset( $tracking_items[ $key ] );
|
1440 |
}
|
1441 |
}
|
1449 |
$tracking_provider = $this->get_provider_slug_from_name( $tracking_provider );
|
1450 |
|
1451 |
$args = array(
|
1452 |
+
'tracking_provider' => $tracking_provider,
|
1453 |
+
'tracking_number' => $tracking_number,
|
1454 |
+
'date_shipped' => $date_shipped,
|
1455 |
+
'status_shipped' => $status_shipped,
|
1456 |
);
|
1457 |
|
1458 |
if ( '' != $sku ) {
|
1475 |
$product_data_array = array();
|
1476 |
$product_data_array[ $product_id ] = $qty;
|
1477 |
|
1478 |
+
$status_shipped = ( isset( $_POST['status_shipped'] ) ? wc_clean( $_POST['status_shipped'] ) : '' );
|
1479 |
|
1480 |
+
$autocomplete_order_tpi = get_option( 'autocomplete_order_tpi', 0 );
|
1481 |
if ( 1 == $autocomplete_order_tpi ) {
|
1482 |
$status_shipped = $this->autocomplete_order_after_adding_all_products( $order_id, $status_shipped, $products_list );
|
1483 |
$args['status_shipped'] = $status_shipped;
|
1485 |
|
1486 |
if ( count( $tracking_items ) > 0 ) {
|
1487 |
foreach ( $tracking_items as $key => $item ) {
|
1488 |
+
if ( $item['tracking_number'] == $tracking_number ) {
|
1489 |
|
1490 |
if ( isset( $item['products_list'] ) && !empty( $item['products_list'] ) ) {
|
1491 |
|
1496 |
|
1497 |
$mearge_array = array();
|
1498 |
foreach ( array_keys( $product_data_array + $product_list_array ) as $product) {
|
1499 |
+
$mearge_array[ $product ] = (int) ( isset( $product_data_array[ $product ] ) ? $product_data_array[ $product ] : 0 ) + (int) ( isset( $product_list_array[$product] ) ? $product_list_array[ $product ] : 0 );
|
1500 |
}
|
1501 |
|
1502 |
foreach ( $mearge_array as $productid => $product_qty ) {
|
1514 |
|
1515 |
do_action( 'update_order_status_after_adding_tracking', $status_shipped, $order );
|
1516 |
|
1517 |
+
echo '<li class="success">Success - added tracking info to Order ' . esc_html( $order_number ) . '</li>';
|
1518 |
exit;
|
1519 |
}
|
1520 |
}
|
1532 |
|
1533 |
$wast->add_tracking_item( $order_id, $args );
|
1534 |
|
1535 |
+
echo '<li class="success">Success - added tracking info to Order ' . esc_html( $order_number ) . '</li>';
|
1536 |
+
exit;
|
1537 |
+
} else {
|
1538 |
+
echo '<li class="invalid_tracking_data_error">Failed - Invalid Tracking Data</li>';
|
1539 |
+
exit;
|
1540 |
}
|
1541 |
}
|
1542 |
|
1556 |
foreach ( $products_list as $in_list ) {
|
1557 |
|
1558 |
if ( isset( $new_products[ $in_list->product ] ) ) {
|
1559 |
+
$new_products[ $in_list->product ] = (int) $new_products[ $in_list->product ] + (int) $in_list->qty;
|
1560 |
+
} else {
|
1561 |
$new_products[ $in_list->product ] = $in_list->qty;
|
1562 |
}
|
1563 |
}
|
1565 |
$total_products_data = array();
|
1566 |
|
1567 |
foreach ( array_keys( $new_products + $added_products ) as $products ) {
|
1568 |
+
$total_products_data[ $products ] = ( isset( $new_products[ $products ] ) ? $new_products[ $products ] : 0 ) + ( isset( $added_products[ $products ] ) ? $added_products[ $products ] : 0 );
|
1569 |
}
|
1570 |
|
1571 |
$orders_products_data = array();
|
1629 |
foreach ( $product_list as $list ) {
|
1630 |
foreach ( $list as $in_list ) {
|
1631 |
if ( isset( $all_list[ $in_list->product ] ) ) {
|
1632 |
+
$all_list[ $in_list->product ] = (int) $all_list[ $in_list->product ] + (int) $in_list->qty;
|
1633 |
} else {
|
1634 |
$all_list[ $in_list->product ] = $in_list->qty;
|
1635 |
}
|
1653 |
if ( !$custom_shipped ) {
|
1654 |
if ( 'completed' == $order->get_status() ) {
|
1655 |
do_action( 'send_order_to_trackship', $order_id );
|
1656 |
+
} else {
|
1657 |
$order->update_status( 'completed' );
|
1658 |
}
|
1659 |
}
|
1672 |
}
|
1673 |
|
1674 |
$order->update_status('partial-shipped');
|
1675 |
+
do_action( 'send_order_to_trackship', $order_id );
|
1676 |
}
|
1677 |
}
|
1678 |
|
1712 |
}
|
1713 |
|
1714 |
/*
|
1715 |
+
* Update preview order id in customizer
|
1716 |
*/
|
1717 |
public function update_email_preview_order_fun() {
|
1718 |
+
|
1719 |
+
check_ajax_referer( 'ast_customizer', 'security' );
|
1720 |
+
|
1721 |
+
$wcast_preview_order_id = isset( $_POST['wcast_preview_order_id'] ) ? wc_clean( $_POST['wcast_preview_order_id'] ) : '';
|
1722 |
+
|
1723 |
+
set_theme_mod( 'wcast_availableforpickup_email_preview_order_id', $wcast_preview_order_id );
|
1724 |
+
set_theme_mod( 'wcast_returntosender_email_preview_order_id', $wcast_preview_order_id );
|
1725 |
+
set_theme_mod( 'wcast_delivered_status_email_preview_order_id', $wcast_preview_order_id );
|
1726 |
+
set_theme_mod( 'wcast_outfordelivery_email_preview_order_id', $wcast_preview_order_id );
|
1727 |
+
set_theme_mod( 'wcast_intransit_email_preview_order_id', $wcast_preview_order_id );
|
1728 |
+
set_theme_mod( 'wcast_onhold_email_preview_order_id', $wcast_preview_order_id );
|
1729 |
+
set_theme_mod( 'wcast_pretransit_email_preview_order_id', $wcast_preview_order_id );
|
1730 |
+
set_theme_mod( 'wcast_email_preview_order_id', $wcast_preview_order_id );
|
1731 |
+
set_theme_mod( 'wcast_preview_order_id', $wcast_preview_order_id );
|
1732 |
exit;
|
1733 |
}
|
1734 |
|
1739 |
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped', 0 );
|
1740 |
// Only on backend Woocommerce Settings "Emails" tab
|
1741 |
if ( 1 == $wc_ast_status_shipped ) {
|
1742 |
+
if ( isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] && isset( $_GET['tab'] ) && 'email' == $_GET['tab'] ) {
|
1743 |
switch ( $email->id ) {
|
1744 |
case 'customer_completed_order':
|
1745 |
$email_title = __( 'Shipped Order', 'woo-advanced-shipment-tracking' );
|
1755 |
*/
|
1756 |
public function add_delivered_order_status_actions_button( $actions, $order ) {
|
1757 |
|
1758 |
+
wp_enqueue_style( 'ast_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/admin.css', array(), wc_advanced_shipment_tracking()->version );
|
1759 |
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version);
|
1760 |
wp_localize_script(
|
1761 |
'woocommerce-advanced-shipment-tracking-js',
|
1778 |
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=delivered&order_id=' . $order_id ), 'woocommerce-mark-order-status' ),
|
1779 |
'name' => __( 'Mark order as delivered', 'woo-advanced-shipment-tracking' ),
|
1780 |
'icon' => '<i class="fa fa-truck"> </i>',
|
1781 |
+
'action' => 'delivered_icon', // keep "view" class for a clean button CSS
|
1782 |
);
|
1783 |
}
|
1784 |
}
|
1795 |
if ( $order->get_shipping_method() != 'Local pickup' && $order->get_shipping_method() != 'Local Pickup' ) {
|
1796 |
if ( $order->has_status( $order_array ) ) {
|
1797 |
$actions['add_tracking'] = array(
|
1798 |
+
'url' => '#' . $order->get_id(),
|
1799 |
'name' => __( 'Add Tracking', 'woo-advanced-shipment-tracking' ),
|
1800 |
'icon' => '<i class="fa fa-map-marker"> </i>',
|
1801 |
'action' => 'add_inline_tracking', // keep "view" class for a clean button CSS
|
1827 |
);
|
1828 |
|
1829 |
// Loop through your custom orders Statuses
|
1830 |
+
foreach ( $custom_statuses as $status_slug => $values ) {
|
1831 |
if ( $order->has_status( $values['allowed'] ) ) {
|
1832 |
$actions[ 'status' ][ 'group' ] = __( 'Change status: ', 'woocommerce' );
|
1833 |
$actions[ 'status' ][ 'actions' ][ $status_slug ] = array(
|
1834 |
+
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=' . $status_slug . '&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' ),
|
1835 |
'name' => $values['label'],
|
1836 |
'title' => __( 'Change order status to', 'woo-advanced-shipment-tracking' ) . ' ' . strtolower( $values['label'] ),
|
1837 |
'action' => $status_slug,
|
1848 |
public function get_provider_html( $default_shippment_providers, $status ) {
|
1849 |
$WC_Countries = new WC_Countries();
|
1850 |
$upload_dir = wp_upload_dir();
|
1851 |
+
$ast_directory = $upload_dir['baseurl'] . '/ast-shipping-providers/';
|
1852 |
+
?>
|
1853 |
<div class="provider_list">
|
1854 |
+
<?php
|
1855 |
+
if ( $default_shippment_providers ) {
|
1856 |
+
if ( 'custom' == $status ) {
|
1857 |
+
?>
|
1858 |
+
</br><a href="javaScript:void(0);" class="button-primary btn_ast2 btn_large add_custom_provider" id="add-custom"><span class="dashicons dashicons-plus-alt"></span><?php esc_html_e( 'Add Custom Provider', 'woo-advanced-shipment-tracking' ); ?></a>
|
1859 |
<?php } ?>
|
1860 |
<div class="provider_table_hc">
|
1861 |
<div class="shipping_provider_counter counter"></div>
|
1874 |
<?php
|
1875 |
foreach ( $default_shippment_providers as $d_s_p ) {
|
1876 |
$class = ( 1 == $d_s_p->display_in_order ) ? 'enable' : 'disable' ;
|
1877 |
+
?>
|
1878 |
<tr class="<?php esc_html_e( $class ); ?>">
|
1879 |
<td>
|
1880 |
<?php
|
1886 |
} else {
|
1887 |
$provider_image = $ast_directory . '' . sanitize_title( $d_s_p->provider_name ) . '.png?v=' . wc_advanced_shipment_tracking()->version;
|
1888 |
}
|
1889 |
+
echo '<img class="provider-thumb" src="' . esc_url( $provider_image ) . '">';
|
1890 |
} else {
|
1891 |
$image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array( '60', '60' ) );
|
1892 |
|
1893 |
if ( 0 != $custom_thumb_id ) {
|
1894 |
+
echo '<img class="provider-thumb" src="' . esc_url( $image_attributes[0] ) . '">';
|
1895 |
} else {
|
1896 |
+
echo '<img class="provider-thumb" src="' . esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ) . 'assets/images/icon-default.png">';
|
1897 |
}
|
1898 |
+
}
|
1899 |
+
?>
|
1900 |
</td>
|
1901 |
<td>
|
1902 |
<span class="provider_name">
|
1916 |
} else {
|
1917 |
$api_count = 1;
|
1918 |
}
|
1919 |
+
$api_text = __( 'API aliases', 'woo-advanced-shipment-tracking' );
|
1920 |
esc_html_e( ' (' . $api_count . ' ' . $api_text . ')' );
|
1921 |
}
|
1922 |
?>
|
1937 |
<?php
|
1938 |
|
1939 |
if ( 0 == $d_s_p->shipping_default ) {
|
1940 |
+
echo '<span class="dashicons dashicons-trash remove provider_actions_btn" data-pid="' . esc_html( $d_s_p->id ) . '"></span>';
|
1941 |
}
|
1942 |
|
1943 |
+
$edit_provider_class = ( $enable_edit ) ? apply_filters( 'edit_provider_class', 'edit_provider' ) : 'upgrade_to_ast_pro';
|
1944 |
|
1945 |
$provider_type = ( 1 == $d_s_p->shipping_default ) ? 'default_provider' : 'custom_provider';
|
1946 |
|
1947 |
+
echo '<span class="' . esc_html( $edit_provider_class ) . ' provider_actions_btn" data-provider="' . esc_html( $provider_type ) . '" data-pid="' . esc_html( $d_s_p->id ) . '">' . esc_html__( 'edit', 'woo-advanced-shipment-tracking' ) . '</span>';
|
1948 |
|
1949 |
$default_provider = get_option( 'wc_ast_default_provider' );
|
1950 |
|
1967 |
echo '<span class="dashicons dashicons-yes-alt"></span>';
|
1968 |
} else {
|
1969 |
echo '<span class="dashicons dashicons-dismiss"></span>';
|
1970 |
+
}
|
1971 |
+
?>
|
1972 |
<span>TrackShip</span>
|
1973 |
</td>
|
1974 |
|
1975 |
<td>
|
1976 |
+
<?php $checked = ( 1 == $d_s_p->display_in_order ) ? 'checked' : ''; ?>
|
1977 |
+
<input class="ast-tgl ast-tgl-flat status_slide" id="list-switch-<?php esc_html_e( $d_s_p->id ); ?>" name="select_custom_provider[]" type="checkbox" <?php esc_html_e( $checked ); ?> value="<?php esc_html_e( $d_s_p->id ); ?>"/>
|
1978 |
<label class="ast-tgl-btn" for="list-switch-<?php esc_html_e( $d_s_p->id ); ?>"></label>
|
1979 |
</td>
|
1980 |
</tr>
|
1985 |
<div class="shipping_provider_counter counter"></div>
|
1986 |
<div class="paging shipping_provider_paging"></div>
|
1987 |
</div>
|
1988 |
+
<?php
|
1989 |
+
} else {
|
1990 |
+
if ( 'custom' == $status ) {
|
1991 |
+
?>
|
1992 |
+
<p class="provider_message">
|
1993 |
+
<?php
|
1994 |
+
/* translators: %s: replace with status */
|
1995 |
+
printf( esc_html_e( 'You did not create any %s shipping providers yet.', 'woo-advanced-shipment-tracking' ), esc_html( $status ) );
|
1996 |
+
?>
|
1997 |
+
</p>
|
1998 |
<a href="javaScript:void(0);" class="button-primary btn_ast2 btn_large add_custom_provider" id="add-custom">
|
1999 |
<span class="dashicons dashicons-plus-alt"></span>
|
2000 |
<?php esc_html_e( 'Add Custom Provider', 'woo-advanced-shipment-tracking' ); ?>
|
2001 |
</a>
|
2002 |
<?php } else { ?>
|
2003 |
+
<p class="provider_message">
|
2004 |
+
<?php
|
2005 |
+
/* translators: %s: replace with status */
|
2006 |
+
printf( esc_html_e( "You don't have any %s shipping providers.", 'woo-advanced-shipment-tracking' ), esc_html( $status ) );
|
2007 |
+
?>
|
2008 |
+
</p>
|
2009 |
<?php
|
2010 |
+
}
|
2011 |
+
}
|
2012 |
+
?>
|
2013 |
</div>
|
2014 |
<?php
|
2015 |
}
|
2019 |
*/
|
2020 |
public function filter_shipiing_provider_by_status_fun() {
|
2021 |
|
2022 |
+
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2023 |
|
2024 |
+
$status = isset( $_POST['status'] ) ? wc_clean( $_POST['status'] ) : '';
|
2025 |
|
2026 |
global $wpdb;
|
2027 |
|
2028 |
+
if ( 'active' == $status ) {
|
2029 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE display_in_order = 1" );
|
2030 |
}
|
2031 |
|
2037 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 0" );
|
2038 |
}
|
2039 |
|
2040 |
+
if ( 'all' == $status ) {
|
2041 |
$status = '';
|
2042 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2043 |
}
|
2044 |
|
2045 |
+
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
|
|
2046 |
exit;
|
2047 |
}
|
2048 |
|
2058 |
*/
|
2059 |
public function update_shipment_status_fun() {
|
2060 |
|
2061 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2062 |
+
exit( 'You are not allowed' );
|
2063 |
+
}
|
2064 |
|
2065 |
+
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2066 |
+
|
2067 |
+
$checked = isset( $_POST['checked'] ) ? wc_clean( $_POST['checked'] ) : '';
|
2068 |
+
$id = isset( $_POST['id'] ) ? wc_clean( $_POST['id'] ) : '';
|
2069 |
+
|
2070 |
+
global $wpdb;
|
2071 |
$success = $wpdb->update( $this->table,
|
2072 |
array(
|
2073 |
+
'display_in_order' => $checked,
|
2074 |
),
|
2075 |
+
array( 'id' => $id )
|
2076 |
);
|
2077 |
exit;
|
2078 |
}
|
2079 |
|
2080 |
/**
|
2081 |
+
* Update default provider function
|
2082 |
*/
|
2083 |
public function update_default_provider_fun() {
|
2084 |
|
2085 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2086 |
+
exit( 'You are not allowed' );
|
2087 |
+
}
|
2088 |
+
|
2089 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2090 |
|
2091 |
+
$default_provider = isset( $_POST['default_provider'] ) ? wc_clean( $_POST['default_provider'] ) : '';
|
2092 |
+
$checked = isset( $_POST['checked'] ) ? wc_clean( $_POST['checked'] ) : '';
|
2093 |
+
|
2094 |
+
if ( 1 == $checked ) {
|
2095 |
+
update_option( 'wc_ast_default_provider', $default_provider );
|
2096 |
} else {
|
2097 |
update_option( 'wc_ast_default_provider', '' );
|
2098 |
}
|
2121 |
// lowercase
|
2122 |
$text = strtolower($text);
|
2123 |
|
2124 |
+
$text = 'cp-' . $text;
|
2125 |
|
2126 |
if ( empty( $text ) ) {
|
2127 |
return '';
|
2131 |
}
|
2132 |
|
2133 |
/*
|
2134 |
+
* Delet provide by ajax
|
2135 |
*/
|
2136 |
+
public function woocommerce_shipping_provider_delete() {
|
2137 |
|
2138 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2139 |
+
exit( 'You are not allowed' );
|
2140 |
+
}
|
2141 |
+
|
2142 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2143 |
|
2144 |
+
$provider_id = isset( $_POST['provider_id'] ) ? wc_clean( $_POST['provider_id'] ) : '';
|
2145 |
|
2146 |
if ( ! empty( $provider_id ) ) {
|
2147 |
global $wpdb;
|
2154 |
$status = 'all';
|
2155 |
|
2156 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2157 |
+
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
|
|
2158 |
exit;
|
2159 |
}
|
2160 |
|
2161 |
/**
|
2162 |
* Get shipping provider details fun
|
2163 |
*/
|
2164 |
+
public function get_provider_details_fun() {
|
2165 |
+
|
2166 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2167 |
+
exit( 'You are not allowed' );
|
2168 |
+
}
|
2169 |
|
2170 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2171 |
|
2172 |
+
$id = isset( $_POST['provider_id'] ) ? wc_clean( $_POST['provider_id'] ) : '';
|
2173 |
global $wpdb;
|
2174 |
|
2175 |
$shippment_provider = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table WHERE id=%d", $id ) );
|
2191 |
/**
|
2192 |
* Update custom shipping provider and returen html of it
|
2193 |
*/
|
2194 |
+
public function update_custom_shipment_provider_fun() {
|
2195 |
+
|
2196 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2197 |
+
exit( 'You are not allowed' );
|
2198 |
+
}
|
2199 |
|
2200 |
check_ajax_referer( 'nonce_edit_shipping_provider', 'nonce_edit_shipping_provider' );
|
2201 |
|
2202 |
global $wpdb;
|
2203 |
|
2204 |
+
$provider_id = isset( $_POST['provider_id'] ) ? wc_clean( $_POST['provider_id'] ) : '';
|
2205 |
+
$tracking_url = isset( $_POST['tracking_url'] ) ? wc_clean( $_POST['tracking_url'] ) : '';
|
2206 |
+
$thumb_id = isset( $_POST['thumb_id'] ) ? wc_clean( $_POST['thumb_id'] ) : '';
|
2207 |
+
$shipping_provider = isset( $_POST['shipping_provider'] ) ? wc_clean( $_POST['shipping_provider'] ) : '';
|
2208 |
+
$shipping_display_name = isset( $_POST['shipping_display_name'] ) ? wc_clean( $_POST['shipping_display_name'] ) : '';
|
2209 |
+
$shipping_country = isset( $_POST['shipping_country'] ) ? wc_clean( $_POST['shipping_country'] ) : '';
|
2210 |
+
$api_provider_name = isset( $_POST['api_provider_name'] ) ? wc_clean( $_POST['api_provider_name'] ) : '';
|
2211 |
+
$provider_type = isset( $_POST['provider_type'] ) ? wc_clean( $_POST['provider_type'] ) : '';
|
2212 |
+
|
2213 |
+
if ( [] == array_filter( $api_provider_name ) ) {
|
2214 |
$api_provider_name = null;
|
2215 |
} else {
|
2216 |
+
$api_provider_name = wc_clean( json_encode( $api_provider_name ) );
|
2217 |
}
|
2218 |
+
|
|
|
2219 |
if ( 'default_provider' == $provider_type ) {
|
2220 |
$data_array = array(
|
2221 |
+
'custom_provider_name' => $shipping_display_name,
|
2222 |
'api_provider_name' => $api_provider_name,
|
2223 |
+
'custom_thumb_id' => $thumb_id,
|
2224 |
);
|
2225 |
+
} else {
|
2226 |
$data_array = array(
|
2227 |
+
'shipping_country' => $shipping_country,
|
2228 |
+
'provider_name' => $shipping_provider,
|
2229 |
+
'custom_provider_name' => $shipping_display_name,
|
2230 |
+
'ts_slug' => $shipping_provider,
|
2231 |
+
'custom_thumb_id' => $thumb_id,
|
2232 |
+
'provider_url' => $tracking_url
|
2233 |
);
|
2234 |
}
|
2235 |
|
2236 |
$where_array = array(
|
2237 |
+
'id' => $provider_id,
|
2238 |
);
|
2239 |
$wpdb->update( $this->table, $data_array, $where_array );
|
2240 |
$status = 'active';
|
2241 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2242 |
+
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
|
|
2243 |
exit;
|
2244 |
}
|
2245 |
|
2246 |
/**
|
2247 |
* Reset default provider
|
2248 |
*/
|
2249 |
+
public function reset_default_provider_fun() {
|
2250 |
+
|
2251 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2252 |
+
exit('You are not allowed');
|
2253 |
+
}
|
2254 |
|
2255 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2256 |
|
2257 |
global $wpdb;
|
2258 |
+
|
2259 |
+
$provider_id = isset( $_POST['provider_id'] ) ? wc_clean( $_POST['provider_id'] ) : '';
|
2260 |
+
|
2261 |
$data_array = array(
|
2262 |
+
'custom_provider_name' => null,
|
2263 |
+
'custom_thumb_id' => null,
|
2264 |
+
'api_provider_name' => null,
|
2265 |
);
|
2266 |
+
|
2267 |
$where_array = array(
|
2268 |
+
'id' => $provider_id,
|
2269 |
);
|
2270 |
+
|
2271 |
$wpdb->update( $this->table, $data_array, $where_array );
|
2272 |
$status = 'active';
|
2273 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2274 |
+
$html = $this->get_provider_html( $default_shippment_providers, $status );
|
|
|
2275 |
exit;
|
2276 |
}
|
2277 |
|
2278 |
/**
|
2279 |
* Update bulk status of providers to active
|
2280 |
*/
|
2281 |
+
public function update_provider_status_fun() {
|
2282 |
+
|
2283 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
2284 |
+
exit( 'You are not allowed' );
|
2285 |
+
}
|
2286 |
|
2287 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
2288 |
|
2289 |
global $wpdb;
|
2290 |
|
2291 |
+
$status = isset( $_POST['status'] ) ? wc_clean( $_POST['status'] ) : '';
|
2292 |
+
|
2293 |
$data_array = array(
|
2294 |
+
'display_in_order' => $status,
|
2295 |
);
|
2296 |
|
2297 |
+
$display_in_order = ( 1 == $status ) ? 0 : 1;
|
2298 |
|
2299 |
$where_array = array(
|
2300 |
'display_in_order' => $display_in_order,
|
2312 |
*
|
2313 |
* @since 2.4
|
2314 |
*/
|
2315 |
+
public function filter_orders_by_shipping_provider() {
|
2316 |
global $typenow, $wpdb;
|
2317 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
2318 |
|
2319 |
if ( 'shop_order' === $typenow ) {
|
2320 |
+
?>
|
2321 |
<select name="_shop_order_shipping_provider" id="dropdown_shop_order_shipping_provider">
|
2322 |
<option value=""><?php esc_html_e( 'Filter by shipping provider', 'woo-advanced-shipment-tracking' ); ?></option>
|
2323 |
<?php foreach ( $default_shippment_providers as $provider ) : ?>
|
2324 |
+
<option value="<?php echo esc_attr( $provider->ts_slug ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipping_provider'] ) ? selected( $provider->ts_slug, wc_clean( $_GET['_shop_order_shipping_provider'] ), false ) : '' ); ?>>
|
2325 |
<?php printf( '%1$s', esc_html( $provider->provider_name ) ); ?>
|
2326 |
</option>
|
2327 |
<?php endforeach; ?>
|
2342 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && '' != $_GET['_shop_order_shipping_provider'] ) {
|
2343 |
$vars['meta_query'][] = array(
|
2344 |
'key' => '_wc_shipment_tracking_items',
|
2345 |
+
'value' => wc_clean( $_GET['_shop_order_shipping_provider'] ),
|
2346 |
'compare' => 'LIKE'
|
2347 |
);
|
2348 |
}
|
2360 |
public function filter_orders_by_tracking_number_query( $search_fields ) {
|
2361 |
$search_fields[] = '_wc_shipment_tracking_items';
|
2362 |
return $search_fields;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2363 |
}
|
2364 |
|
2365 |
/*
|
2366 |
+
* get tracking provider slug (ts_slug) from database
|
2367 |
+
*
|
2368 |
+
* return provider slug
|
2369 |
+
*/
|
2370 |
public function get_provider_slug_from_name( $tracking_provider_name ) {
|
2371 |
|
2372 |
global $wpdb;
|
2373 |
|
2374 |
+
$tracking_provider = $wpdb->get_var( $wpdb->prepare( "SELECT ts_slug FROM $this->table WHERE api_provider_name = %s", $tracking_provider_name ) );
|
2375 |
|
2376 |
if ( !$tracking_provider ) {
|
2377 |
+
$query = "SELECT ts_slug FROM $this->table WHERE JSON_CONTAINS(api_provider_name, '[" . '"' . $tracking_provider_name . '"' . "]')";
|
2378 |
$tracking_provider = $wpdb->get_var( $query );
|
2379 |
}
|
2380 |
|
2381 |
if ( !$tracking_provider ) {
|
2382 |
+
$tracking_provider = $wpdb->get_var( $wpdb->prepare( "SELECT ts_slug FROM $this->table WHERE provider_name = %s", $tracking_provider_name ) );
|
2383 |
}
|
2384 |
|
2385 |
if ( !$tracking_provider ) {
|
2393 |
* function for add more provider btn
|
2394 |
*/
|
2395 |
public function add_more_api_provider() {
|
2396 |
+
$tooltip_text = class_exists( 'ast_pro' ) ? __( 'Add API Name alias', 'woo-advanced-shipment-tracking' ) : __( 'Multiple API names mapping is a pro features', 'woo-advanced-shipment-tracking' ) ;
|
2397 |
?>
|
2398 |
<span class="dashicons dashicons-insert woocommerce-help-tip tipTip add_more_api_provider" title="<?php esc_html_e( $tooltip_text ); ?>"></span>
|
2399 |
<?php
|
2400 |
}
|
2401 |
+
}
|
includes/class-wc-advanced-shipment-tracking-api-call.php
CHANGED
@@ -11,9 +11,9 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
11 |
/*
|
12 |
* check if string is json or not
|
13 |
*/
|
14 |
-
public function isJson($string) {
|
15 |
json_decode($string);
|
16 |
-
return (json_last_error() == JSON_ERROR_NONE);
|
17 |
}
|
18 |
|
19 |
/*
|
@@ -29,7 +29,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
29 |
$tracking_items = ast_get_tracking_items( $order_id );
|
30 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
31 |
|
32 |
-
if ( $tracking_items ){
|
33 |
foreach ( ( array ) $tracking_items as $key => $val ) {
|
34 |
|
35 |
if ( isset( $shipment_status[$key]['status'] ) && 'delivered' == $shipment_status[$key]['status'] ) {
|
@@ -39,7 +39,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
39 |
$tracking_number = trim($val['tracking_number']);
|
40 |
|
41 |
$tracking_provider = isset( $val['tracking_provider'] ) ? $val['tracking_provider'] : $val['custom_tracking_provider'];
|
42 |
-
$tracking_provider = apply_filters('convert_provider_name_to_slug'
|
43 |
|
44 |
if ( isset( $tracking_number ) ) {
|
45 |
|
@@ -51,7 +51,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
51 |
|
52 |
$logger = wc_get_logger();
|
53 |
$context = array( 'source' => 'Trackship_apicall_is_wp_error' );
|
54 |
-
$logger->error( "Something went wrong: {$error_message} For Order id :"
|
55 |
|
56 |
//error like 403 500 502
|
57 |
$timestamp = time() + 5*60;
|
@@ -71,7 +71,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
71 |
}
|
72 |
|
73 |
$shipment_status[$key]['status'] = "Something went wrong: {$error_message}";
|
74 |
-
$shipment_status[$key]['status_date'] =
|
75 |
|
76 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['status'];
|
77 |
|
@@ -104,7 +104,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
104 |
|
105 |
$shipment_status[$key]['pending_status'] = $body['status_msg'];
|
106 |
|
107 |
-
$shipment_status[$key]['status_date'] =
|
108 |
$shipment_status[$key]['est_delivery_date'] = '';
|
109 |
|
110 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['pending_status'];
|
@@ -113,7 +113,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
113 |
update_post_meta( $order->get_id(), 'shipment_status', $shipment_status);
|
114 |
|
115 |
if ( isset( $body['trackers_balance'] ) ) {
|
116 |
-
update_option('trackers_balance'
|
117 |
}
|
118 |
} else {
|
119 |
//error like 400
|
@@ -130,8 +130,8 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
130 |
$ts_shipment_status = array();
|
131 |
}
|
132 |
|
133 |
-
$shipment_status[$key]['status'] =
|
134 |
-
$shipment_status[$key]['status_date'] =
|
135 |
$shipment_status[$key]['est_delivery_date'] = '';
|
136 |
|
137 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['status'];
|
@@ -141,8 +141,8 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
141 |
|
142 |
$logger = wc_get_logger();
|
143 |
$context = array( 'source' => 'Trackship_apicall_error' );
|
144 |
-
$logger->error(
|
145 |
-
$logger->error(
|
146 |
}
|
147 |
}
|
148 |
}
|
@@ -165,7 +165,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
165 |
$urlSettings = $sitepress->get_setting( 'urls' );
|
166 |
$dir_for_default_language = isset( $urlSettings['directory_for_default_language'] ) && $urlSettings['directory_for_default_language'];
|
167 |
|
168 |
-
if(
|
169 |
$domain = get_site_url();
|
170 |
}
|
171 |
}
|
11 |
/*
|
12 |
* check if string is json or not
|
13 |
*/
|
14 |
+
public function isJson( $string ) {
|
15 |
json_decode($string);
|
16 |
+
return ( json_last_error() == JSON_ERROR_NONE );
|
17 |
}
|
18 |
|
19 |
/*
|
29 |
$tracking_items = ast_get_tracking_items( $order_id );
|
30 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
31 |
|
32 |
+
if ( $tracking_items ) {
|
33 |
foreach ( ( array ) $tracking_items as $key => $val ) {
|
34 |
|
35 |
if ( isset( $shipment_status[$key]['status'] ) && 'delivered' == $shipment_status[$key]['status'] ) {
|
39 |
$tracking_number = trim($val['tracking_number']);
|
40 |
|
41 |
$tracking_provider = isset( $val['tracking_provider'] ) ? $val['tracking_provider'] : $val['custom_tracking_provider'];
|
42 |
+
$tracking_provider = apply_filters( 'convert_provider_name_to_slug', $tracking_provider );
|
43 |
|
44 |
if ( isset( $tracking_number ) ) {
|
45 |
|
51 |
|
52 |
$logger = wc_get_logger();
|
53 |
$context = array( 'source' => 'Trackship_apicall_is_wp_error' );
|
54 |
+
$logger->error( "Something went wrong: {$error_message} For Order id :" . $order->get_id(), $context );
|
55 |
|
56 |
//error like 403 500 502
|
57 |
$timestamp = time() + 5*60;
|
71 |
}
|
72 |
|
73 |
$shipment_status[$key]['status'] = "Something went wrong: {$error_message}";
|
74 |
+
$shipment_status[$key]['status_date'] = gmdate( 'Y-m-d H:i:s' );
|
75 |
|
76 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['status'];
|
77 |
|
104 |
|
105 |
$shipment_status[$key]['pending_status'] = $body['status_msg'];
|
106 |
|
107 |
+
$shipment_status[$key]['status_date'] = gmdate( 'Y-m-d H:i:s' );
|
108 |
$shipment_status[$key]['est_delivery_date'] = '';
|
109 |
|
110 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['pending_status'];
|
113 |
update_post_meta( $order->get_id(), 'shipment_status', $shipment_status);
|
114 |
|
115 |
if ( isset( $body['trackers_balance'] ) ) {
|
116 |
+
update_option('trackers_balance', $body['trackers_balance'] );
|
117 |
}
|
118 |
} else {
|
119 |
//error like 400
|
130 |
$ts_shipment_status = array();
|
131 |
}
|
132 |
|
133 |
+
$shipment_status[$key]['status'] = 'Error message : ' . $body['message'];
|
134 |
+
$shipment_status[$key]['status_date'] = gmdate( 'Y-m-d H:i:s' );
|
135 |
$shipment_status[$key]['est_delivery_date'] = '';
|
136 |
|
137 |
$ts_shipment_status[$key]['status'] = $shipment_status[$key]['status'];
|
141 |
|
142 |
$logger = wc_get_logger();
|
143 |
$context = array( 'source' => 'Trackship_apicall_error' );
|
144 |
+
$logger->error( 'Error code : ' . $code . ' For Order id :' . $order->get_id(), $context );
|
145 |
+
$logger->error( 'Body : ' . $response['body'], $context );
|
146 |
}
|
147 |
}
|
148 |
}
|
165 |
$urlSettings = $sitepress->get_setting( 'urls' );
|
166 |
$dir_for_default_language = isset( $urlSettings['directory_for_default_language'] ) && $urlSettings['directory_for_default_language'];
|
167 |
|
168 |
+
if ( 1 != $language_negotiation_type || !$dir_for_default_language ) {
|
169 |
$domain = get_site_url();
|
170 |
}
|
171 |
}
|
includes/class-wc-advanced-shipment-tracking-front.php
CHANGED
@@ -15,10 +15,10 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
|
20 |
global $wpdb;
|
21 |
-
$this->table = $wpdb->prefix.
|
22 |
|
23 |
if ( is_multisite() ) {
|
24 |
|
@@ -37,7 +37,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
37 |
}
|
38 |
|
39 |
$this->init();
|
40 |
-
|
41 |
|
42 |
/**
|
43 |
* Get the class instance
|
@@ -74,12 +74,12 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
74 |
|
75 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
76 |
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
77 |
-
wp_register_script( 'front-js', wc_advanced_shipment_tracking()->plugin_dir_url().'assets/js/front.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version );
|
78 |
wp_localize_script( 'front-js', 'zorem_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
|
79 |
|
80 |
-
wp_register_style( 'front_style',
|
81 |
|
82 |
-
$action = ( isset( $_REQUEST[ 'action' ] ) ? $_REQUEST[ 'action' ] : '' );
|
83 |
|
84 |
if ( 'preview_tracking_page' == $action ) {
|
85 |
wp_enqueue_style( 'front_style' );
|
@@ -99,7 +99,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
99 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
100 |
|
101 |
if ( !$wc_ast_api_key ) {
|
102 |
-
|
103 |
<p><a href="https://trackship.info/" target="blank">TrackShip</a> is not active.</p>
|
104 |
<?php
|
105 |
return;
|
@@ -127,7 +127,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
127 |
|
128 |
$tracking_items = ast_get_tracking_items( $order_id );
|
129 |
|
130 |
-
$shipment_status = get_post_meta( $order_id,
|
131 |
|
132 |
if ( !$tracking_items ) {
|
133 |
unset($order_id);
|
@@ -141,7 +141,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
141 |
return $form;
|
142 |
} else {
|
143 |
ob_start();
|
144 |
-
echo $this->display_tracking_page( $order_id, $tracking_items, $shipment_status );
|
145 |
$form = ob_get_clean();
|
146 |
return $form;
|
147 |
}
|
@@ -160,8 +160,8 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
160 |
return;
|
161 |
}
|
162 |
|
163 |
-
$order_id = wc_clean($_POST['order_id']);
|
164 |
-
$email =
|
165 |
|
166 |
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
167 |
$order_id = $wast->get_formated_order_id($order_id);
|
@@ -219,20 +219,20 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
219 |
exit;
|
220 |
}
|
221 |
|
222 |
-
$order_id = wc_clean( $_POST['order_id'] );
|
223 |
-
$tracking_number = wc_clean( $_POST['tracking_number'] );
|
224 |
|
225 |
$order = wc_get_order( $order_id );
|
226 |
|
227 |
$tracking_items = ast_get_tracking_items( $order_id );
|
228 |
|
229 |
-
foreach( $tracking_items as $key => $tracking_item ){
|
230 |
if ( $tracking_item['tracking_number'] != $tracking_number ) {
|
231 |
unset( $tracking_items[$key] );
|
232 |
}
|
233 |
}
|
234 |
|
235 |
-
$shipment_status = get_post_meta( $order_id,
|
236 |
|
237 |
ob_start();
|
238 |
$html = $this->display_tracking_page( $order_id, $tracking_items, $shipment_status );
|
@@ -244,11 +244,11 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
244 |
/*
|
245 |
* retuern Tracking form HTML
|
246 |
*/
|
247 |
-
public function track_form_template(){
|
248 |
-
$local_template = get_stylesheet_directory().'/woocommerce/tracking/tracking-form.php';
|
249 |
-
if ( file_exists( $local_template ) && is_writable( $local_template )){
|
250 |
wc_get_template( 'tracking/tracking-form.php', array(), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
251 |
-
} else{
|
252 |
wc_get_template( 'tracking/tracking-form.php', array(), 'woocommerce-advanced-shipment-tracking/', wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/' );
|
253 |
}
|
254 |
}
|
@@ -276,25 +276,25 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
276 |
<style>
|
277 |
<?php if ( $border_color ) { ?>
|
278 |
body .col.tracking-detail{
|
279 |
-
border: 1px solid <?php
|
280 |
}
|
281 |
body .col.tracking-detail .shipment-header{
|
282 |
-
border-bottom: 1px solid <?php
|
283 |
}
|
284 |
body .col.tracking-detail .trackship_branding{
|
285 |
-
border-top: 1px solid <?php
|
286 |
}
|
287 |
-
<?php }
|
288 |
-
<?php if($background_color){ ?>
|
289 |
body .col.tracking-detail{
|
290 |
-
background: <?php
|
291 |
}
|
292 |
-
<?php }
|
293 |
</style>
|
294 |
<?php
|
295 |
|
296 |
$num = 1;
|
297 |
-
$total_trackings =
|
298 |
|
299 |
foreach ( $tracking_items as $key => $item ) {
|
300 |
$tracking_number = $item['tracking_number'];
|
@@ -321,7 +321,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
321 |
|
322 |
if ( isset( $shipment_status[ $key ][ 'tracking_events' ] ) || isset( $shipment_status[ $key ][ 'pending_status' ] ) ) {
|
323 |
|
324 |
-
if( isset( $shipment_status[ $key ][ 'tracking_events' ] ) ) {
|
325 |
$tracker->tracking_detail = json_encode( $shipment_status[ $key ][ 'tracking_events' ] );
|
326 |
}
|
327 |
|
@@ -344,7 +344,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
344 |
|
345 |
foreach ( (array) $trackind_detail_by_status_rev as $key => $details ) {
|
346 |
if ( isset( $details->datetime ) ) {
|
347 |
-
$date =
|
348 |
$tracking_details_by_date[ $date ][] = $details;
|
349 |
}
|
350 |
}
|
@@ -361,7 +361,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
361 |
|
362 |
foreach ( (array) $trackind_destination_detail_by_status_rev as $key => $details ) {
|
363 |
if ( isset( $details->datetime ) ) {
|
364 |
-
$date =
|
365 |
$tracking_destination_details_by_date[$date][] = $details;
|
366 |
}
|
367 |
}
|
@@ -371,13 +371,18 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
371 |
$order_number = $order->get_order_number();
|
372 |
|
373 |
if ( isset( $tracker->ep_status ) ) {
|
374 |
-
$t_layout_class = ( 't_layout_1' != $tracking_page_layout
|
375 |
-
|
376 |
<div class="tracking-detail col <?php esc_html_e( $t_layout_class ); ?>">
|
377 |
|
378 |
<div class="shipment-header">
|
379 |
<?php if ( $total_trackings > 1 ) { ?>
|
380 |
-
<p class="shipment_heading"
|
|
|
|
|
|
|
|
|
|
|
381 |
<span class="wc_order_id"><?php esc_html_e( 'Order', 'woocommerce' ); ?>
|
382 |
<a href="<?php echo esc_url( $order_url ); ?>" target="_blank">
|
383 |
<strong>#<?php esc_html_e( apply_filters( 'ast_order_number_filter', $order_number ) ); ?></strong>
|
@@ -396,25 +401,25 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
396 |
<div class="shipment-content">
|
397 |
<?php
|
398 |
|
399 |
-
echo $this->tracking_page_header( $order_id, $tracker, $item );
|
400 |
|
401 |
-
echo $this->tracking_progress_bar( $tracker );
|
402 |
|
403 |
if ( in_array( $tracker->ep_status, array( 'pending_trackship', 'carrier_unsupported', 'unknown' ) ) ) {
|
404 |
|
405 |
$pending_message = __( 'Tracking information is not available, please try again in a few minutes.', 'woo-advanced-shipment-tracking' );
|
406 |
?>
|
407 |
-
<p class="pending_message"><?php esc_html_e( apply_filters(
|
408 |
<?php
|
409 |
}
|
410 |
|
411 |
if ( !empty( $trackind_detail_by_status_rev ) ) {
|
412 |
-
echo $this->layout1_tracking_details( $trackind_detail_by_status_rev, $tracking_details_by_date, $trackind_destination_detail_by_status_rev, $tracking_destination_details_by_date, $tracker , $order_id, $tracking_provider, $tracking_number );
|
413 |
}
|
414 |
?>
|
415 |
</div>
|
416 |
<div class="trackship_branding">
|
417 |
-
<p>Shipment Tracking info by <a href="https://trackship.info/trackings/?number=<?php esc_html_e( $tracking_number ); ?>" title="TrackShip" target="blank"><img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/trackship-logo.png"></a></p>
|
418 |
</div>
|
419 |
</div>
|
420 |
<?php
|
@@ -444,28 +449,28 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
444 |
|
445 |
public function tracking_progress_bar( $tracker ) {
|
446 |
|
447 |
-
if( in_array( $tracker->ep_status, array( 'INVALID_TRACKING_NUM', 'carrier_unsupported', 'invalid_user_key', 'wrong_shipping_provider', 'deleted', 'pending' ) ) ) {
|
448 |
return;
|
449 |
}
|
450 |
|
451 |
-
if( in_array( $tracker->ep_status, array( 'pending_trackship', 'pending', 'unknown', 'carrier_unsupported' ) ) ){
|
452 |
$width = '17%';
|
453 |
-
} else if( in_array( $tracker->ep_status, array( 'in_transit', 'on_hold' ) ) ){
|
454 |
$width = '33%';
|
455 |
-
} else if($tracker->ep_status
|
456 |
$width = '67%';
|
457 |
-
} else if($tracker->ep_status
|
458 |
$width = '67%';
|
459 |
-
} else if($tracker->ep_status
|
460 |
$width = '67%';
|
461 |
-
} else if($tracker->ep_status
|
462 |
$width = '100%';
|
463 |
} else {
|
464 |
$width = '0';
|
465 |
}
|
466 |
$tracking_page_layout = get_option( 'wc_ast_select_tracking_page_layout', 't_layout_1' );
|
467 |
?>
|
468 |
-
<div class="tracker-progress-bar <?php esc_html_e(
|
469 |
<div class="progress">
|
470 |
<div class="progress-bar <?php esc_html_e( $tracker->ep_status ); ?>" style="width: <?php esc_html_e( $width ); ?>;"></div>
|
471 |
</div>
|
@@ -481,25 +486,26 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
481 |
}
|
482 |
|
483 |
/**
|
484 |
-
*
|
485 |
*/
|
486 |
-
public static function convertString
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
|
|
496 |
|
497 |
/*
|
498 |
* Tracking Page preview
|
499 |
*/
|
500 |
public static function preview_tracking_page() {
|
501 |
|
502 |
-
$action = ( isset( $_REQUEST['action'] ) ? $_REQUEST['action'] :
|
503 |
if ( 'preview_tracking_page' != $action ) {
|
504 |
return;
|
505 |
}
|
@@ -519,4 +525,4 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
519 |
wp_footer();
|
520 |
exit;
|
521 |
}
|
522 |
-
}
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
|
20 |
global $wpdb;
|
21 |
+
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
22 |
|
23 |
if ( is_multisite() ) {
|
24 |
|
37 |
}
|
38 |
|
39 |
$this->init();
|
40 |
+
}
|
41 |
|
42 |
/**
|
43 |
* Get the class instance
|
74 |
|
75 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
76 |
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
77 |
+
wp_register_script( 'front-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/front.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version );
|
78 |
wp_localize_script( 'front-js', 'zorem_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
|
79 |
|
80 |
+
wp_register_style( 'front_style', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/front.css', array(), wc_advanced_shipment_tracking()->version );
|
81 |
|
82 |
+
$action = ( isset( $_REQUEST[ 'action' ] ) ? wc_clean( $_REQUEST[ 'action' ] ) : '' );
|
83 |
|
84 |
if ( 'preview_tracking_page' == $action ) {
|
85 |
wp_enqueue_style( 'front_style' );
|
99 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
100 |
|
101 |
if ( !$wc_ast_api_key ) {
|
102 |
+
?>
|
103 |
<p><a href="https://trackship.info/" target="blank">TrackShip</a> is not active.</p>
|
104 |
<?php
|
105 |
return;
|
127 |
|
128 |
$tracking_items = ast_get_tracking_items( $order_id );
|
129 |
|
130 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
131 |
|
132 |
if ( !$tracking_items ) {
|
133 |
unset($order_id);
|
141 |
return $form;
|
142 |
} else {
|
143 |
ob_start();
|
144 |
+
echo wp_kses_post( $this->display_tracking_page( $order_id, $tracking_items, $shipment_status ) );
|
145 |
$form = ob_get_clean();
|
146 |
return $form;
|
147 |
}
|
160 |
return;
|
161 |
}
|
162 |
|
163 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
164 |
+
$email = isset( $_POST['order_email'] ) ? wc_clean( $_POST['order_email'] ) : '';
|
165 |
|
166 |
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
167 |
$order_id = $wast->get_formated_order_id($order_id);
|
219 |
exit;
|
220 |
}
|
221 |
|
222 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
223 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
224 |
|
225 |
$order = wc_get_order( $order_id );
|
226 |
|
227 |
$tracking_items = ast_get_tracking_items( $order_id );
|
228 |
|
229 |
+
foreach ( $tracking_items as $key => $tracking_item ) {
|
230 |
if ( $tracking_item['tracking_number'] != $tracking_number ) {
|
231 |
unset( $tracking_items[$key] );
|
232 |
}
|
233 |
}
|
234 |
|
235 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
236 |
|
237 |
ob_start();
|
238 |
$html = $this->display_tracking_page( $order_id, $tracking_items, $shipment_status );
|
244 |
/*
|
245 |
* retuern Tracking form HTML
|
246 |
*/
|
247 |
+
public function track_form_template() {
|
248 |
+
$local_template = get_stylesheet_directory() . '/woocommerce/tracking/tracking-form.php';
|
249 |
+
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
250 |
wc_get_template( 'tracking/tracking-form.php', array(), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
251 |
+
} else {
|
252 |
wc_get_template( 'tracking/tracking-form.php', array(), 'woocommerce-advanced-shipment-tracking/', wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/' );
|
253 |
}
|
254 |
}
|
276 |
<style>
|
277 |
<?php if ( $border_color ) { ?>
|
278 |
body .col.tracking-detail{
|
279 |
+
border: 1px solid <?php esc_html_e( $border_color ); ?>;
|
280 |
}
|
281 |
body .col.tracking-detail .shipment-header{
|
282 |
+
border-bottom: 1px solid <?php esc_html_e( $border_color ); ?>;
|
283 |
}
|
284 |
body .col.tracking-detail .trackship_branding{
|
285 |
+
border-top: 1px solid <?php esc_html_e( $border_color ); ?>;
|
286 |
}
|
287 |
+
<?php } ?>
|
288 |
+
<?php if ( $background_color ) { ?>
|
289 |
body .col.tracking-detail{
|
290 |
+
background: <?php esc_html_e( $background_color ); ?>;
|
291 |
}
|
292 |
+
<?php } ?>
|
293 |
</style>
|
294 |
<?php
|
295 |
|
296 |
$num = 1;
|
297 |
+
$total_trackings = count( $tracking_items );
|
298 |
|
299 |
foreach ( $tracking_items as $key => $item ) {
|
300 |
$tracking_number = $item['tracking_number'];
|
321 |
|
322 |
if ( isset( $shipment_status[ $key ][ 'tracking_events' ] ) || isset( $shipment_status[ $key ][ 'pending_status' ] ) ) {
|
323 |
|
324 |
+
if ( isset( $shipment_status[ $key ][ 'tracking_events' ] ) ) {
|
325 |
$tracker->tracking_detail = json_encode( $shipment_status[ $key ][ 'tracking_events' ] );
|
326 |
}
|
327 |
|
344 |
|
345 |
foreach ( (array) $trackind_detail_by_status_rev as $key => $details ) {
|
346 |
if ( isset( $details->datetime ) ) {
|
347 |
+
$date = gmdate( 'Y-m-d', strtotime( $details->datetime ) );
|
348 |
$tracking_details_by_date[ $date ][] = $details;
|
349 |
}
|
350 |
}
|
361 |
|
362 |
foreach ( (array) $trackind_destination_detail_by_status_rev as $key => $details ) {
|
363 |
if ( isset( $details->datetime ) ) {
|
364 |
+
$date = gmdate( 'Y-m-d', strtotime( $details->datetime ) );
|
365 |
$tracking_destination_details_by_date[$date][] = $details;
|
366 |
}
|
367 |
}
|
371 |
$order_number = $order->get_order_number();
|
372 |
|
373 |
if ( isset( $tracker->ep_status ) ) {
|
374 |
+
$t_layout_class = ( 't_layout_1' != $tracking_page_layout ) ? 'tracking-layout-2' : '' ;
|
375 |
+
?>
|
376 |
<div class="tracking-detail col <?php esc_html_e( $t_layout_class ); ?>">
|
377 |
|
378 |
<div class="shipment-header">
|
379 |
<?php if ( $total_trackings > 1 ) { ?>
|
380 |
+
<p class="shipment_heading">
|
381 |
+
<?php
|
382 |
+
/* translators: %1$s: replace with num, %2$s: replace with total_trackings */
|
383 |
+
printf( esc_html__( 'Shipment : %1$s (out of %2$s)', 'woo-advanced-shipment-tracking' ), esc_html( $num ), esc_html( $total_trackings ) );
|
384 |
+
?>
|
385 |
+
</p>
|
386 |
<span class="wc_order_id"><?php esc_html_e( 'Order', 'woocommerce' ); ?>
|
387 |
<a href="<?php echo esc_url( $order_url ); ?>" target="_blank">
|
388 |
<strong>#<?php esc_html_e( apply_filters( 'ast_order_number_filter', $order_number ) ); ?></strong>
|
401 |
<div class="shipment-content">
|
402 |
<?php
|
403 |
|
404 |
+
echo wp_kses_post( $this->tracking_page_header( $order_id, $tracker, $item ) );
|
405 |
|
406 |
+
echo wp_kses_post( $this->tracking_progress_bar( $tracker ) );
|
407 |
|
408 |
if ( in_array( $tracker->ep_status, array( 'pending_trackship', 'carrier_unsupported', 'unknown' ) ) ) {
|
409 |
|
410 |
$pending_message = __( 'Tracking information is not available, please try again in a few minutes.', 'woo-advanced-shipment-tracking' );
|
411 |
?>
|
412 |
+
<p class="pending_message"><?php esc_html_e( apply_filters( 'trackship_pending_status_message', $pending_message, $tracker->ep_status ) ); ?></p>
|
413 |
<?php
|
414 |
}
|
415 |
|
416 |
if ( !empty( $trackind_detail_by_status_rev ) ) {
|
417 |
+
echo wp_kses_post( $this->layout1_tracking_details( $trackind_detail_by_status_rev, $tracking_details_by_date, $trackind_destination_detail_by_status_rev, $tracking_destination_details_by_date, $tracker , $order_id, $tracking_provider, $tracking_number ) );
|
418 |
}
|
419 |
?>
|
420 |
</div>
|
421 |
<div class="trackship_branding">
|
422 |
+
<p>Shipment Tracking info by <a href="https://trackship.info/trackings/?number=<?php esc_html_e( $tracking_number ); ?>" title="TrackShip" target="blank"><img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/trackship-logo.png"></a></p>
|
423 |
</div>
|
424 |
</div>
|
425 |
<?php
|
449 |
|
450 |
public function tracking_progress_bar( $tracker ) {
|
451 |
|
452 |
+
if ( in_array( $tracker->ep_status, array( 'INVALID_TRACKING_NUM', 'carrier_unsupported', 'invalid_user_key', 'wrong_shipping_provider', 'deleted', 'pending' ) ) ) {
|
453 |
return;
|
454 |
}
|
455 |
|
456 |
+
if ( in_array( $tracker->ep_status, array( 'pending_trackship', 'pending', 'unknown', 'carrier_unsupported' ) ) ) {
|
457 |
$width = '17%';
|
458 |
+
} else if ( in_array( $tracker->ep_status, array( 'in_transit', 'on_hold' ) ) ) {
|
459 |
$width = '33%';
|
460 |
+
} else if ( 'out_for_delivery' == $tracker->ep_status ) {
|
461 |
$width = '67%';
|
462 |
+
} else if ( 'available_for_pickup' == $tracker->ep_status ) {
|
463 |
$width = '67%';
|
464 |
+
} else if ( 'return_to_sender' == $tracker->ep_status ) {
|
465 |
$width = '67%';
|
466 |
+
} else if ( 'delivered' == $tracker->ep_status ) {
|
467 |
$width = '100%';
|
468 |
} else {
|
469 |
$width = '0';
|
470 |
}
|
471 |
$tracking_page_layout = get_option( 'wc_ast_select_tracking_page_layout', 't_layout_1' );
|
472 |
?>
|
473 |
+
<div class="tracker-progress-bar <?php esc_html_e( 't_layout_1' == $tracking_page_layout ? 'tracking_layout_1' : '' ); ?>">
|
474 |
<div class="progress">
|
475 |
<div class="progress-bar <?php esc_html_e( $tracker->ep_status ); ?>" style="width: <?php esc_html_e( $width ); ?>;"></div>
|
476 |
</div>
|
486 |
}
|
487 |
|
488 |
/**
|
489 |
+
* Convert string to date
|
490 |
*/
|
491 |
+
public static function convertString( $date ) {
|
492 |
+
|
493 |
+
// convert date and time to seconds
|
494 |
+
$sec = strtotime($date);
|
495 |
+
|
496 |
+
// convert seconds into a specific format
|
497 |
+
$date = gmdate( 'm/d/Y H:i', $sec );
|
498 |
+
|
499 |
+
// print final date and time
|
500 |
+
return $date;
|
501 |
+
}
|
502 |
|
503 |
/*
|
504 |
* Tracking Page preview
|
505 |
*/
|
506 |
public static function preview_tracking_page() {
|
507 |
|
508 |
+
$action = ( isset( $_REQUEST['action'] ) ? wc_clean( $_REQUEST['action'] ) : '' );
|
509 |
if ( 'preview_tracking_page' != $action ) {
|
510 |
return;
|
511 |
}
|
525 |
wp_footer();
|
526 |
exit;
|
527 |
}
|
528 |
+
}
|
includes/class-wc-advanced-shipment-tracking-install.php
CHANGED
@@ -15,10 +15,10 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
|
20 |
global $wpdb;
|
21 |
-
$this->table = $wpdb->prefix .
|
22 |
|
23 |
if ( is_multisite() ) {
|
24 |
|
@@ -37,7 +37,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
37 |
}
|
38 |
|
39 |
$this->init();
|
40 |
-
|
41 |
|
42 |
/**
|
43 |
* Get the class instance
|
@@ -105,7 +105,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
105 |
|
106 |
global $wpdb;
|
107 |
|
108 |
-
if ( !$wpdb->query( $wpdb->prepare(
|
109 |
$charset_collate = $wpdb->get_charset_collate();
|
110 |
$sql = "CREATE TABLE $this->table (
|
111 |
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
@@ -236,7 +236,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
236 |
public function update_ts_shipment_status_order_mete( $page ) {
|
237 |
|
238 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
239 |
-
if( !$wc_ast_api_key ) {
|
240 |
return;
|
241 |
}
|
242 |
|
@@ -260,7 +260,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
260 |
}
|
261 |
|
262 |
/**
|
263 |
-
*
|
264 |
*/
|
265 |
public function add_provider_image_in_upload_directory() {
|
266 |
$upload_dir = wp_upload_dir();
|
@@ -274,12 +274,12 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
274 |
$resp = wp_remote_get( $url );
|
275 |
|
276 |
if ( is_array( $resp ) && ! is_wp_error( $resp ) ) {
|
277 |
-
$providers = json_decode($resp['body'],true);
|
278 |
foreach ( $providers as $provider ) {
|
279 |
$provider_name = $provider['shipping_provider'];
|
280 |
$img_url = $provider['img_url'];
|
281 |
$img_slug = sanitize_title($provider_name);
|
282 |
-
$img = $ast_directory.'/'
|
283 |
$ch = curl_init();
|
284 |
|
285 |
curl_setopt($ch, CURLOPT_HEADER, 0);
|
@@ -294,7 +294,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
294 |
}
|
295 |
|
296 |
/**
|
297 |
-
*
|
298 |
*/
|
299 |
public function update_shipping_providers() {
|
300 |
global $wpdb;
|
@@ -304,13 +304,13 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
304 |
$upload_dir = wp_upload_dir();
|
305 |
$ast_directory = $upload_dir['basedir'] . '/ast-shipping-providers';
|
306 |
|
307 |
-
if( !is_dir( $ast_directory ) ) {
|
308 |
wp_mkdir_p( $ast_directory );
|
309 |
}
|
310 |
|
311 |
if ( is_array( $resp ) && ! is_wp_error( $resp ) ) {
|
312 |
|
313 |
-
$providers = json_decode($resp['body'],true);
|
314 |
|
315 |
$providers_name = array();
|
316 |
|
@@ -353,7 +353,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
353 |
} else {
|
354 |
$img_url = $provider['img_url'];
|
355 |
$img_slug = sanitize_title($provider_name);
|
356 |
-
$img = $ast_directory.'/'
|
357 |
|
358 |
$ch = curl_init();
|
359 |
|
@@ -367,7 +367,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
367 |
file_put_contents($img, $data);
|
368 |
|
369 |
$display_in_order = 1;
|
370 |
-
if( $n > 14 ) {
|
371 |
$display_in_order = 0;
|
372 |
}
|
373 |
|
@@ -397,4 +397,4 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
397 |
}
|
398 |
}
|
399 |
}
|
400 |
-
}
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
|
20 |
global $wpdb;
|
21 |
+
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
22 |
|
23 |
if ( is_multisite() ) {
|
24 |
|
37 |
}
|
38 |
|
39 |
$this->init();
|
40 |
+
}
|
41 |
|
42 |
/**
|
43 |
* Get the class instance
|
105 |
|
106 |
global $wpdb;
|
107 |
|
108 |
+
if ( !$wpdb->query( $wpdb->prepare( 'show tables like %s', $this->table ) ) ) {
|
109 |
$charset_collate = $wpdb->get_charset_collate();
|
110 |
$sql = "CREATE TABLE $this->table (
|
111 |
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
236 |
public function update_ts_shipment_status_order_mete( $page ) {
|
237 |
|
238 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
239 |
+
if ( !$wc_ast_api_key ) {
|
240 |
return;
|
241 |
}
|
242 |
|
260 |
}
|
261 |
|
262 |
/**
|
263 |
+
* Function for add provider image in uploads directory under wp-content/uploads/ast-shipping-providers
|
264 |
*/
|
265 |
public function add_provider_image_in_upload_directory() {
|
266 |
$upload_dir = wp_upload_dir();
|
274 |
$resp = wp_remote_get( $url );
|
275 |
|
276 |
if ( is_array( $resp ) && ! is_wp_error( $resp ) ) {
|
277 |
+
$providers = json_decode( $resp['body'], true );
|
278 |
foreach ( $providers as $provider ) {
|
279 |
$provider_name = $provider['shipping_provider'];
|
280 |
$img_url = $provider['img_url'];
|
281 |
$img_slug = sanitize_title($provider_name);
|
282 |
+
$img = $ast_directory . '/' . $img_slug . '.png';
|
283 |
$ch = curl_init();
|
284 |
|
285 |
curl_setopt($ch, CURLOPT_HEADER, 0);
|
294 |
}
|
295 |
|
296 |
/**
|
297 |
+
* Get providers list from trackship and update providers in database
|
298 |
*/
|
299 |
public function update_shipping_providers() {
|
300 |
global $wpdb;
|
304 |
$upload_dir = wp_upload_dir();
|
305 |
$ast_directory = $upload_dir['basedir'] . '/ast-shipping-providers';
|
306 |
|
307 |
+
if ( !is_dir( $ast_directory ) ) {
|
308 |
wp_mkdir_p( $ast_directory );
|
309 |
}
|
310 |
|
311 |
if ( is_array( $resp ) && ! is_wp_error( $resp ) ) {
|
312 |
|
313 |
+
$providers = json_decode( $resp['body'], true );
|
314 |
|
315 |
$providers_name = array();
|
316 |
|
353 |
} else {
|
354 |
$img_url = $provider['img_url'];
|
355 |
$img_slug = sanitize_title($provider_name);
|
356 |
+
$img = $ast_directory . '/' . $img_slug . '.png';
|
357 |
|
358 |
$ch = curl_init();
|
359 |
|
367 |
file_put_contents($img, $data);
|
368 |
|
369 |
$display_in_order = 1;
|
370 |
+
if ( $n > 14 ) {
|
371 |
$display_in_order = 0;
|
372 |
}
|
373 |
|
397 |
}
|
398 |
}
|
399 |
}
|
400 |
+
}
|
includes/class-wc-advanced-shipment-tracking-late-shipments.php
CHANGED
@@ -46,7 +46,7 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
46 |
*/
|
47 |
public function init() {
|
48 |
|
49 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
50 |
|
51 |
$wcast_enable_late_shipments_email = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_enable_late_shipments_admin_email', '' );
|
52 |
|
@@ -70,8 +70,7 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
70 |
|
71 |
/**
|
72 |
* Remove the Cron
|
73 |
-
*
|
74 |
-
* @access public
|
75 |
* @since 1.0.0
|
76 |
*/
|
77 |
public function remove_cron() {
|
@@ -80,7 +79,7 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
80 |
|
81 |
/**
|
82 |
* Setup the Cron
|
83 |
-
*
|
84 |
* @since 1.0.0
|
85 |
*/
|
86 |
public function setup_cron() {
|
@@ -94,10 +93,10 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
94 |
$wcast_late_shipments_daily_digest_time = isset( $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] ) ? $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] : '';
|
95 |
|
96 |
// Create a Date Time object when the cron should run for the first time
|
97 |
-
$first_cron = new DateTime(
|
98 |
-
$first_cron->setTimeZone(new DateTimeZone(
|
99 |
|
100 |
-
$time = new DateTime(
|
101 |
|
102 |
if ( $time->getTimestamp() > $first_cron->getTimestamp() ) {
|
103 |
$first_cron->modify( '+1 day' );
|
@@ -152,13 +151,13 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
152 |
);
|
153 |
|
154 |
$wcast_late_shipments_settings = new wcast_late_shipments_customizer_email();
|
155 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
156 |
|
157 |
$wcast_late_shipments_days = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_days', $wcast_late_shipments_settings->defaults['wcast_late_shipments_days'] );
|
158 |
|
159 |
foreach ( $orders->posts as $order ) {
|
160 |
$order_object = new WC_Order( $order->ID );
|
161 |
-
$shipment_status = get_post_meta( $order_object->get_id(),
|
162 |
|
163 |
foreach ( $shipment_status as $key => $tracker ) {
|
164 |
|
@@ -213,8 +212,8 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
213 |
$last_date = $last->datetime;
|
214 |
|
215 |
$status = $ep_tracker['status'];
|
216 |
-
if( 'delivered' != $status ) {
|
217 |
-
$last_date =
|
218 |
}
|
219 |
|
220 |
$days = $this->get_num_of_days( $first_date, $last_date );
|
@@ -228,22 +227,23 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
228 |
$date1 = strtotime($first_date);
|
229 |
$date2 = strtotime($last_date);
|
230 |
$diff = abs($date2 - $date1);
|
231 |
-
return
|
232 |
}
|
233 |
|
234 |
/**
|
235 |
-
*
|
236 |
*/
|
237 |
public function late_shippment_email_trigger ( $order_id, $order, $tracker, $tracking_number ) {
|
238 |
|
239 |
$wcast_late_shipments_settings = new wcast_late_shipments_customizer_email();
|
240 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
241 |
|
242 |
$email_subject = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_email_subject', $wcast_late_shipments_settings->defaults[ 'wcast_late_shipments_email_subject' ] );
|
243 |
|
244 |
$subject = wc_trackship_email_manager()->email_subject( $email_subject, $order_id, $order );
|
245 |
|
246 |
-
$email_to = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_email_to', $wcast_late_shipments_settings->defaults[ 'wcast_late_shipments_email_to' ] )
|
|
|
247 |
|
248 |
foreach ( $email_to as $email ) {
|
249 |
|
@@ -269,9 +269,9 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
269 |
|
270 |
ob_start();
|
271 |
|
272 |
-
$local_template = get_stylesheet_directory().'/woocommerce/emails/tracking-info.php';
|
273 |
|
274 |
-
if ( file_exists( $local_template ) && is_writable( $local_template )){
|
275 |
wc_get_template( 'emails/tracking-info.php', array( 'tracking_items' => $tracking_items, 'order_id'=> $order_id ), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
276 |
} elseif ( class_exists( 'ast_pro' ) ) {
|
277 |
wc_get_template( 'emails/fluid-tracking-info.php', array(
|
@@ -299,13 +299,13 @@ class WC_Advanced_Shipment_Tracking_Late_Shipments {
|
|
299 |
$email_send = wp_mail( $recipient, $subject, $email_content, $email->get_headers() );
|
300 |
$logger = wc_get_logger();
|
301 |
$context = array( 'source' => 'trackship_late_shipments_email_log' );
|
302 |
-
$logger->error(
|
303 |
return $email_send;
|
304 |
}
|
305 |
}
|
306 |
|
307 |
/**
|
308 |
-
*
|
309 |
*/
|
310 |
public function email_content ( $email_content, $order_id, $order, $tracker ) {
|
311 |
$shipment_length = $this->get_shipment_length( $tracker );
|
46 |
*/
|
47 |
public function init() {
|
48 |
|
49 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
50 |
|
51 |
$wcast_enable_late_shipments_email = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_enable_late_shipments_admin_email', '' );
|
52 |
|
70 |
|
71 |
/**
|
72 |
* Remove the Cron
|
73 |
+
*
|
|
|
74 |
* @since 1.0.0
|
75 |
*/
|
76 |
public function remove_cron() {
|
79 |
|
80 |
/**
|
81 |
* Setup the Cron
|
82 |
+
*
|
83 |
* @since 1.0.0
|
84 |
*/
|
85 |
public function setup_cron() {
|
93 |
$wcast_late_shipments_daily_digest_time = isset( $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] ) ? $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] : '';
|
94 |
|
95 |
// Create a Date Time object when the cron should run for the first time
|
96 |
+
$first_cron = new DateTime( gmdate( 'Y-m-d' ) . ' ' . $wcast_late_shipments_daily_digest_time . ':00', new DateTimeZone( wc_timezone_string() ) );
|
97 |
+
$first_cron->setTimeZone(new DateTimeZone('GMT'));
|
98 |
|
99 |
+
$time = new DateTime( gmdate( 'Y-m-d H:i:s' ), new DateTimeZone( wc_timezone_string() ) );
|
100 |
|
101 |
if ( $time->getTimestamp() > $first_cron->getTimestamp() ) {
|
102 |
$first_cron->modify( '+1 day' );
|
151 |
);
|
152 |
|
153 |
$wcast_late_shipments_settings = new wcast_late_shipments_customizer_email();
|
154 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
155 |
|
156 |
$wcast_late_shipments_days = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_days', $wcast_late_shipments_settings->defaults['wcast_late_shipments_days'] );
|
157 |
|
158 |
foreach ( $orders->posts as $order ) {
|
159 |
$order_object = new WC_Order( $order->ID );
|
160 |
+
$shipment_status = get_post_meta( $order_object->get_id(), 'shipment_status', true);
|
161 |
|
162 |
foreach ( $shipment_status as $key => $tracker ) {
|
163 |
|
212 |
$last_date = $last->datetime;
|
213 |
|
214 |
$status = $ep_tracker['status'];
|
215 |
+
if ( 'delivered' != $status ) {
|
216 |
+
$last_date = gmdate( 'Y-m-d H:i:s' );
|
217 |
}
|
218 |
|
219 |
$days = $this->get_num_of_days( $first_date, $last_date );
|
227 |
$date1 = strtotime($first_date);
|
228 |
$date2 = strtotime($last_date);
|
229 |
$diff = abs($date2 - $date1);
|
230 |
+
return gmdate( 'd', $diff );
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
+
* Code for send shipment status email
|
235 |
*/
|
236 |
public function late_shippment_email_trigger ( $order_id, $order, $tracker, $tracking_number ) {
|
237 |
|
238 |
$wcast_late_shipments_settings = new wcast_late_shipments_customizer_email();
|
239 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
240 |
|
241 |
$email_subject = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_email_subject', $wcast_late_shipments_settings->defaults[ 'wcast_late_shipments_email_subject' ] );
|
242 |
|
243 |
$subject = wc_trackship_email_manager()->email_subject( $email_subject, $order_id, $order );
|
244 |
|
245 |
+
$email_to = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_late_shipments_email_to', $wcast_late_shipments_settings->defaults[ 'wcast_late_shipments_email_to' ] );
|
246 |
+
$email_to = explode( ',', $email_to );
|
247 |
|
248 |
foreach ( $email_to as $email ) {
|
249 |
|
269 |
|
270 |
ob_start();
|
271 |
|
272 |
+
$local_template = get_stylesheet_directory() . '/woocommerce/emails/tracking-info.php';
|
273 |
|
274 |
+
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
275 |
wc_get_template( 'emails/tracking-info.php', array( 'tracking_items' => $tracking_items, 'order_id'=> $order_id ), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
276 |
} elseif ( class_exists( 'ast_pro' ) ) {
|
277 |
wc_get_template( 'emails/fluid-tracking-info.php', array(
|
299 |
$email_send = wp_mail( $recipient, $subject, $email_content, $email->get_headers() );
|
300 |
$logger = wc_get_logger();
|
301 |
$context = array( 'source' => 'trackship_late_shipments_email_log' );
|
302 |
+
$logger->error( 'Order_Id: ' . $order_id . ' Late Shipments' . $email_send, $context );
|
303 |
return $email_send;
|
304 |
}
|
305 |
}
|
306 |
|
307 |
/**
|
308 |
+
* Code for format email content
|
309 |
*/
|
310 |
public function email_content ( $email_content, $order_id, $order, $tracker ) {
|
311 |
$shipment_length = $this->get_shipment_length( $tracker );
|
includes/class-wc-advanced-shipment-tracking-license.php
DELETED
@@ -1,173 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit;
|
4 |
-
}
|
5 |
-
|
6 |
-
class WC_Advanced_Shipment_Tracking_License {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Instance of this class.
|
10 |
-
*
|
11 |
-
* @var object Class Instance
|
12 |
-
*/
|
13 |
-
private static $instance;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @var string store_url
|
17 |
-
*/
|
18 |
-
var $item_code = 'ast_per_product';
|
19 |
-
var $store_url = 'https://www.zorem.com/';
|
20 |
-
var $default_product_id = '76646';
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Get the class instance
|
24 |
-
*
|
25 |
-
* @since 1.0
|
26 |
-
* @return smswoo_license
|
27 |
-
*/
|
28 |
-
public static function get_instance() {
|
29 |
-
|
30 |
-
if ( null === self::$instance ) {
|
31 |
-
self::$instance = new self();
|
32 |
-
}
|
33 |
-
|
34 |
-
return self::$instance;
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Initialize the main plugin function
|
39 |
-
*
|
40 |
-
* @since 1.0
|
41 |
-
* @return void
|
42 |
-
*/
|
43 |
-
public function __construct() {
|
44 |
-
$this->init();
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Return item code
|
49 |
-
*
|
50 |
-
* @since 1.0
|
51 |
-
* @return string
|
52 |
-
*
|
53 |
-
*/
|
54 |
-
public function get_item_code() {
|
55 |
-
return $this->item_code;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Set license key
|
60 |
-
*
|
61 |
-
* @since 1.0
|
62 |
-
* @return Void
|
63 |
-
*
|
64 |
-
*/
|
65 |
-
public function set_license_key( $license_key ) {
|
66 |
-
update_option( 'ast_product_license_key', $license_key );
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Return licence key
|
71 |
-
*
|
72 |
-
* @since 1.0
|
73 |
-
* @return string
|
74 |
-
*
|
75 |
-
*/
|
76 |
-
public function get_license_key() {
|
77 |
-
return get_option( 'ast_product_license_key', false );
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Set license status
|
82 |
-
*
|
83 |
-
* @since 1.0
|
84 |
-
* @return Void
|
85 |
-
*
|
86 |
-
*/
|
87 |
-
public function set_license_status( $status ) {
|
88 |
-
update_option( 'ast_product_license_status', $status );
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Return license status
|
93 |
-
*
|
94 |
-
* @since 1.0
|
95 |
-
* @return Bool
|
96 |
-
*
|
97 |
-
*/
|
98 |
-
public function get_license_status() {
|
99 |
-
return get_option( 'ast_product_license_status', false );
|
100 |
-
}
|
101 |
-
/*
|
102 |
-
//below line remove if in future not in use
|
103 |
-
*/
|
104 |
-
public function licence_valid() {
|
105 |
-
return get_option( 'ast_product_license_status', false );
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Create Instance ID
|
111 |
-
*
|
112 |
-
* @since 1.0
|
113 |
-
* @return string
|
114 |
-
*
|
115 |
-
*/
|
116 |
-
public function create_instance_id() {
|
117 |
-
return $instance_id = md5( $this->get_item_code().time() );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Set Instance ID
|
122 |
-
*
|
123 |
-
* @since 1.0
|
124 |
-
* @return Void
|
125 |
-
*
|
126 |
-
*/
|
127 |
-
public function set_instance_id( $instance_id ) {
|
128 |
-
update_option( $this->get_item_code().'_instance_id', $instance_id );
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Return Instance ID
|
133 |
-
*
|
134 |
-
* @since 1.0
|
135 |
-
* @return string
|
136 |
-
*
|
137 |
-
*/
|
138 |
-
public function get_instance_id() {
|
139 |
-
return get_option( $this->get_item_code().'_instance_id', false );
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Set Instance ID
|
144 |
-
*
|
145 |
-
* @since 1.0
|
146 |
-
* @return Void
|
147 |
-
*
|
148 |
-
*/
|
149 |
-
public function set_product_id( $product_id ) {
|
150 |
-
update_option( $this->get_item_code().'_product_id', $product_id );
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Return item code
|
155 |
-
*
|
156 |
-
* @since 1.0
|
157 |
-
* @return string
|
158 |
-
*
|
159 |
-
*/
|
160 |
-
public function get_product_id() {
|
161 |
-
$product_id = get_option( $this->get_item_code().'_product_id', false );
|
162 |
-
return !empty( $product_id ) ? $product_id : $this->default_product_id;
|
163 |
-
}
|
164 |
-
|
165 |
-
/*
|
166 |
-
* init function
|
167 |
-
*
|
168 |
-
* @since 1.0
|
169 |
-
*/
|
170 |
-
public function init(){
|
171 |
-
}
|
172 |
-
|
173 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wc-advanced-shipment-tracking-settings.php
CHANGED
@@ -8,10 +8,10 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
8 |
/**
|
9 |
* Initialize the main plugin function
|
10 |
*/
|
11 |
-
|
12 |
|
13 |
global $wpdb;
|
14 |
-
$this->table = $wpdb->prefix .
|
15 |
|
16 |
if ( is_multisite() ) {
|
17 |
|
@@ -61,7 +61,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
61 |
add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses' ), 10, 1 );
|
62 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions' ), 50, 1 );
|
63 |
|
64 |
-
add_action( 'woocommerce_update_options_email_customer_partial_shipped_order', array( $this, 'save_partial_shipped_email' )
|
65 |
add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun' ) );
|
66 |
|
67 |
//new order status
|
@@ -133,6 +133,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
133 |
'show_in_admin_status_list' => true,
|
134 |
'show_in_admin_all_list' => true,
|
135 |
'exclude_from_search' => false,
|
|
|
136 |
'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
137 |
) );
|
138 |
}
|
@@ -147,6 +148,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
147 |
'show_in_admin_status_list' => true,
|
148 |
'show_in_admin_all_list' => true,
|
149 |
'exclude_from_search' => false,
|
|
|
150 |
'label_count' => _n_noop( 'Updated Tracking <span class="count">(%s)</span>', 'Updated Tracking <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
151 |
) );
|
152 |
}
|
@@ -161,6 +163,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
161 |
'show_in_admin_status_list' => true,
|
162 |
'show_in_admin_all_list' => true,
|
163 |
'exclude_from_search' => false,
|
|
|
164 |
'label_count' => _n_noop( 'Partially Shipped <span class="count">(%s)</span>', 'Partially Shipped <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
165 |
) );
|
166 |
}
|
@@ -211,7 +214,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
211 |
/*
|
212 |
* Adding the custom order status to the default woocommerce order statuses
|
213 |
*/
|
214 |
-
public function include_custom_order_status_to_reports( $statuses ){
|
215 |
if ( $statuses ) {
|
216 |
$statuses[] = 'delivered';
|
217 |
}
|
@@ -221,7 +224,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
221 |
/*
|
222 |
* Adding the updated-tracking order status to the default woocommerce order statuses
|
223 |
*/
|
224 |
-
public function include_updated_tracking_order_status_to_reports( $statuses ){
|
225 |
if ( $statuses ) {
|
226 |
$statuses[] = 'updated-tracking';
|
227 |
}
|
@@ -231,7 +234,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
231 |
/*
|
232 |
* Adding the partial-shipped order status to the default woocommerce order statuses
|
233 |
*/
|
234 |
-
public function include_partial_shipped_order_status_to_reports( $statuses ){
|
235 |
if ( $statuses ) {
|
236 |
$statuses[] = 'partial-shipped';
|
237 |
}
|
@@ -268,7 +271,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
268 |
*/
|
269 |
public function add_bulk_actions( $bulk_actions ) {
|
270 |
$lable = wc_get_order_status_name( 'delivered' );
|
271 |
-
$bulk_actions['mark_delivered'] = __( 'Change status to '
|
272 |
return $bulk_actions;
|
273 |
}
|
274 |
|
@@ -278,7 +281,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
278 |
*/
|
279 |
public function add_bulk_actions_updated_tracking( $bulk_actions ) {
|
280 |
$lable = wc_get_order_status_name( 'updated-tracking' );
|
281 |
-
$bulk_actions['mark_updated-tracking'] = __( 'Change status to '
|
282 |
return $bulk_actions;
|
283 |
}
|
284 |
|
@@ -288,7 +291,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
288 |
*/
|
289 |
public function add_bulk_actions_partial_shipped( $bulk_actions ) {
|
290 |
$lable = wc_get_order_status_name( 'partial-shipped' );
|
291 |
-
$bulk_actions['mark_partial-shipped'] = __( 'Change status to '
|
292 |
return $bulk_actions;
|
293 |
}
|
294 |
|
@@ -340,7 +343,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
340 |
foreach ( $order_statuses as $key => $status ) {
|
341 |
$new_order_statuses[ $key ] = $status;
|
342 |
if ( 'wc-completed' === $key ) {
|
343 |
-
$order_statuses['wc-completed'] = esc_html__( 'Shipped','woo-advanced-shipment-tracking' );
|
344 |
}
|
345 |
}
|
346 |
return $order_statuses;
|
@@ -359,6 +362,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
359 |
}
|
360 |
|
361 |
if ( isset( $array[ 'wc-completed' ] ) ) {
|
|
|
362 |
$array[ 'wc-completed' ]['label_count'] = _n_noop( 'Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' );
|
363 |
}
|
364 |
return $array;
|
@@ -384,21 +388,21 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
384 |
* Add class in admin settings page
|
385 |
*/
|
386 |
public function ahipment_tracking_admin_body_class( $classes ) {
|
387 |
-
$page = ( isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '' );
|
388 |
if ( 'woocommerce-advanced-shipment-tracking' == $page ) {
|
389 |
$classes .= ' shipment_tracking_admin_settings';
|
390 |
}
|
391 |
if ( 'trackship-for-woocommerce' == $page ) {
|
392 |
$classes .= ' trackship_admin_settings';
|
393 |
}
|
394 |
-
|
395 |
}
|
396 |
|
397 |
public function ast_open_inline_tracking_form_fun() {
|
398 |
|
399 |
check_ajax_referer( 'ast-order-list', 'security' );
|
400 |
|
401 |
-
$order_id = wc_clean( $_POST['order_id'] );
|
402 |
$order = wc_get_order( $order_id );
|
403 |
$order_number = $order->get_order_number();
|
404 |
|
@@ -408,7 +412,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
408 |
|
409 |
$shippment_countries = $wpdb->get_results( "SELECT shipping_country FROM $this->table WHERE display_in_order = 1 GROUP BY shipping_country" );
|
410 |
|
411 |
-
$default_provider = get_option(
|
412 |
ob_start();
|
413 |
?>
|
414 |
<div id="" class="trackingpopup_wrapper add_tracking_popup" style="display:none;">
|
@@ -429,21 +433,22 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
429 |
<select class="chosen_select tracking_provider_dropdown" id="tracking_provider" name="tracking_provider">
|
430 |
<option value=""><?php esc_html_e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
|
431 |
<?php
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
|
|
447 |
</select>
|
448 |
</p>
|
449 |
<p class="form-field tracking_product_code_field form-50">
|
@@ -452,14 +457,14 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
452 |
</p>
|
453 |
<p class="form-field date_shipped_field form-50">
|
454 |
<label for="date_shipped"><?php esc_html_e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
|
455 |
-
<input type="text" class="ast-date-picker-field" name="date_shipped" id="date_shipped" value="<?php echo date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ); ?>" placeholder="<?php echo date_i18n( esc_html_e( 'Y-m-d', 'woo-advanced-shipment-tracking' ), time() ); ?>">
|
456 |
</p>
|
457 |
<?php do_action( 'ast_after_tracking_field', $order_id ); ?>
|
458 |
<hr>
|
459 |
<?php wc_advanced_shipment_tracking()->actions->mark_order_as_fields_html(); ?>
|
460 |
<hr>
|
461 |
<p>
|
462 |
-
<?php wp_nonce_field( 'wc_ast_inline_tracking_form', 'wc_ast_inline_tracking_form_nonce' )
|
463 |
<input type="hidden" name="action" value="add_inline_tracking_number">
|
464 |
<input type="hidden" name="order_id" id="order_id" value="<?php esc_html_e( $order_id ); ?>">
|
465 |
<input type="submit" name="Submit" value="<?php esc_html_e( 'Fulfill Order', 'woo-advanced-shipment-tracking' ); ?>" class="button-primary btn_green">
|
@@ -471,14 +476,15 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
471 |
</div>
|
472 |
<?php
|
473 |
$html = ob_get_clean();
|
474 |
-
echo $html;
|
|
|
475 |
}
|
476 |
|
477 |
/**
|
478 |
* Update Partially Shipped order email enable/disable in customizer
|
479 |
*/
|
480 |
public function save_partial_shipped_email( $data ) {
|
481 |
-
$woocommerce_customer_partial_shipped_order_enabled = ( isset( $
|
482 |
update_option( 'customizer_partial_shipped_order_settings_enabled', $woocommerce_customer_partial_shipped_order_enabled );
|
483 |
}
|
484 |
|
@@ -489,7 +495,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
489 |
|
490 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
491 |
|
492 |
-
$reset_checked =
|
493 |
global $wpdb;
|
494 |
|
495 |
$url = apply_filters( 'ast_sync_provider_url', 'https://trackship.info/wp-json/WCAST/v1/Provider' );
|
@@ -552,7 +558,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
552 |
$status = 'active';
|
553 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
554 |
ob_start();
|
555 |
-
$admin = new WC_Advanced_Shipment_Tracking_Admin;
|
556 |
$html = $admin->get_provider_html( $default_shippment_providers, $status );
|
557 |
$html = ob_get_clean();
|
558 |
|
@@ -688,7 +694,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
688 |
$status = 'active';
|
689 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
690 |
ob_start();
|
691 |
-
$admin = new WC_Advanced_Shipment_Tracking_Admin;
|
692 |
$html = $admin->get_provider_html( $default_shippment_providers, $status );
|
693 |
$html = ob_get_clean();
|
694 |
|
@@ -751,4 +757,4 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
751 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php esc_html_e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
752 |
<?php
|
753 |
}
|
754 |
-
}
|
8 |
/**
|
9 |
* Initialize the main plugin function
|
10 |
*/
|
11 |
+
public function __construct() {
|
12 |
|
13 |
global $wpdb;
|
14 |
+
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
15 |
|
16 |
if ( is_multisite() ) {
|
17 |
|
61 |
add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses' ), 10, 1 );
|
62 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions' ), 50, 1 );
|
63 |
|
64 |
+
add_action( 'woocommerce_update_options_email_customer_partial_shipped_order', array( $this, 'save_partial_shipped_email' ), 100, 1);
|
65 |
add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun' ) );
|
66 |
|
67 |
//new order status
|
133 |
'show_in_admin_status_list' => true,
|
134 |
'show_in_admin_all_list' => true,
|
135 |
'exclude_from_search' => false,
|
136 |
+
/* translators: %s: replace with Delivered Count */
|
137 |
'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
138 |
) );
|
139 |
}
|
148 |
'show_in_admin_status_list' => true,
|
149 |
'show_in_admin_all_list' => true,
|
150 |
'exclude_from_search' => false,
|
151 |
+
/* translators: %s: replace with Updated Tracking Count */
|
152 |
'label_count' => _n_noop( 'Updated Tracking <span class="count">(%s)</span>', 'Updated Tracking <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
153 |
) );
|
154 |
}
|
163 |
'show_in_admin_status_list' => true,
|
164 |
'show_in_admin_all_list' => true,
|
165 |
'exclude_from_search' => false,
|
166 |
+
/* translators: %s: replace with Partially Shipped Count */
|
167 |
'label_count' => _n_noop( 'Partially Shipped <span class="count">(%s)</span>', 'Partially Shipped <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
168 |
) );
|
169 |
}
|
214 |
/*
|
215 |
* Adding the custom order status to the default woocommerce order statuses
|
216 |
*/
|
217 |
+
public function include_custom_order_status_to_reports( $statuses ) {
|
218 |
if ( $statuses ) {
|
219 |
$statuses[] = 'delivered';
|
220 |
}
|
224 |
/*
|
225 |
* Adding the updated-tracking order status to the default woocommerce order statuses
|
226 |
*/
|
227 |
+
public function include_updated_tracking_order_status_to_reports( $statuses ) {
|
228 |
if ( $statuses ) {
|
229 |
$statuses[] = 'updated-tracking';
|
230 |
}
|
234 |
/*
|
235 |
* Adding the partial-shipped order status to the default woocommerce order statuses
|
236 |
*/
|
237 |
+
public function include_partial_shipped_order_status_to_reports( $statuses ) {
|
238 |
if ( $statuses ) {
|
239 |
$statuses[] = 'partial-shipped';
|
240 |
}
|
271 |
*/
|
272 |
public function add_bulk_actions( $bulk_actions ) {
|
273 |
$lable = wc_get_order_status_name( 'delivered' );
|
274 |
+
$bulk_actions['mark_delivered'] = __( 'Change status to ' . $lable . '', 'woo-advanced-shipment-tracking' );
|
275 |
return $bulk_actions;
|
276 |
}
|
277 |
|
281 |
*/
|
282 |
public function add_bulk_actions_updated_tracking( $bulk_actions ) {
|
283 |
$lable = wc_get_order_status_name( 'updated-tracking' );
|
284 |
+
$bulk_actions['mark_updated-tracking'] = __( 'Change status to ' . $lable . '', 'woo-advanced-shipment-tracking' );
|
285 |
return $bulk_actions;
|
286 |
}
|
287 |
|
291 |
*/
|
292 |
public function add_bulk_actions_partial_shipped( $bulk_actions ) {
|
293 |
$lable = wc_get_order_status_name( 'partial-shipped' );
|
294 |
+
$bulk_actions['mark_partial-shipped'] = __( 'Change status to ' . $lable . '', 'woo-advanced-shipment-tracking' );
|
295 |
return $bulk_actions;
|
296 |
}
|
297 |
|
343 |
foreach ( $order_statuses as $key => $status ) {
|
344 |
$new_order_statuses[ $key ] = $status;
|
345 |
if ( 'wc-completed' === $key ) {
|
346 |
+
$order_statuses['wc-completed'] = esc_html__( 'Shipped', 'woo-advanced-shipment-tracking' );
|
347 |
}
|
348 |
}
|
349 |
return $order_statuses;
|
362 |
}
|
363 |
|
364 |
if ( isset( $array[ 'wc-completed' ] ) ) {
|
365 |
+
/* translators: %s: replace with shipped order count */
|
366 |
$array[ 'wc-completed' ]['label_count'] = _n_noop( 'Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' );
|
367 |
}
|
368 |
return $array;
|
388 |
* Add class in admin settings page
|
389 |
*/
|
390 |
public function ahipment_tracking_admin_body_class( $classes ) {
|
391 |
+
$page = ( isset( $_REQUEST['page'] ) ? wc_clean( $_REQUEST['page'] ) : '' );
|
392 |
if ( 'woocommerce-advanced-shipment-tracking' == $page ) {
|
393 |
$classes .= ' shipment_tracking_admin_settings';
|
394 |
}
|
395 |
if ( 'trackship-for-woocommerce' == $page ) {
|
396 |
$classes .= ' trackship_admin_settings';
|
397 |
}
|
398 |
+
return $classes;
|
399 |
}
|
400 |
|
401 |
public function ast_open_inline_tracking_form_fun() {
|
402 |
|
403 |
check_ajax_referer( 'ast-order-list', 'security' );
|
404 |
|
405 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) :'';
|
406 |
$order = wc_get_order( $order_id );
|
407 |
$order_number = $order->get_order_number();
|
408 |
|
412 |
|
413 |
$shippment_countries = $wpdb->get_results( "SELECT shipping_country FROM $this->table WHERE display_in_order = 1 GROUP BY shipping_country" );
|
414 |
|
415 |
+
$default_provider = get_option( 'wc_ast_default_provider' );
|
416 |
ob_start();
|
417 |
?>
|
418 |
<div id="" class="trackingpopup_wrapper add_tracking_popup" style="display:none;">
|
433 |
<select class="chosen_select tracking_provider_dropdown" id="tracking_provider" name="tracking_provider">
|
434 |
<option value=""><?php esc_html_e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
|
435 |
<?php
|
436 |
+
foreach ( $shippment_countries as $s_c ) {
|
437 |
+
if ( 'Global' != $s_c->shipping_country ) {
|
438 |
+
$country_name = esc_attr( $WC_Countries->countries[ $s_c->shipping_country ] );
|
439 |
+
} else {
|
440 |
+
$country_name = 'Global';
|
441 |
+
}
|
442 |
+
echo '<optgroup label="' . esc_html( $country_name ) . '">';
|
443 |
+
$country = $s_c->shipping_country;
|
444 |
+
$shippment_providers_by_country = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table WHERE shipping_country = %s AND display_in_order = 1", $country ) );
|
445 |
+
foreach ( $shippment_providers_by_country as $providers ) {
|
446 |
+
$selected = ( esc_attr( $providers->provider_name ) == $default_provider ) ? 'selected' : '';
|
447 |
+
echo '<option value="' . esc_attr( $providers->ts_slug ) . '" ' . esc_html( $selected ) . '>' . esc_html( $providers->provider_name ) . '</option>';
|
448 |
+
}
|
449 |
+
echo '</optgroup>';
|
450 |
+
}
|
451 |
+
?>
|
452 |
</select>
|
453 |
</p>
|
454 |
<p class="form-field tracking_product_code_field form-50">
|
457 |
</p>
|
458 |
<p class="form-field date_shipped_field form-50">
|
459 |
<label for="date_shipped"><?php esc_html_e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
|
460 |
+
<input type="text" class="ast-date-picker-field" name="date_shipped" id="date_shipped" value="<?php echo esc_html( date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ) ); ?>" placeholder="<?php echo esc_html( date_i18n( esc_html_e( 'Y-m-d', 'woo-advanced-shipment-tracking' ), time() ) ); ?>">
|
461 |
</p>
|
462 |
<?php do_action( 'ast_after_tracking_field', $order_id ); ?>
|
463 |
<hr>
|
464 |
<?php wc_advanced_shipment_tracking()->actions->mark_order_as_fields_html(); ?>
|
465 |
<hr>
|
466 |
<p>
|
467 |
+
<?php wp_nonce_field( 'wc_ast_inline_tracking_form', 'wc_ast_inline_tracking_form_nonce' ); ?>
|
468 |
<input type="hidden" name="action" value="add_inline_tracking_number">
|
469 |
<input type="hidden" name="order_id" id="order_id" value="<?php esc_html_e( $order_id ); ?>">
|
470 |
<input type="submit" name="Submit" value="<?php esc_html_e( 'Fulfill Order', 'woo-advanced-shipment-tracking' ); ?>" class="button-primary btn_green">
|
476 |
</div>
|
477 |
<?php
|
478 |
$html = ob_get_clean();
|
479 |
+
echo $html;
|
480 |
+
exit;
|
481 |
}
|
482 |
|
483 |
/**
|
484 |
* Update Partially Shipped order email enable/disable in customizer
|
485 |
*/
|
486 |
public function save_partial_shipped_email( $data ) {
|
487 |
+
$woocommerce_customer_partial_shipped_order_enabled = ( isset( $_REQUEST['woocommerce_customer_partial_shipped_order_enabled'] ) ? wc_clean( $_REQUEST['woocommerce_customer_partial_shipped_order_enabled'] ) : '' );
|
488 |
update_option( 'customizer_partial_shipped_order_settings_enabled', $woocommerce_customer_partial_shipped_order_enabled );
|
489 |
}
|
490 |
|
495 |
|
496 |
check_ajax_referer( 'nonce_shipping_provider', 'security' );
|
497 |
|
498 |
+
$reset_checked = isset( $_POST[ 'reset_checked' ] ) ? wc_clean( $_POST[ 'reset_checked' ] ) : '';
|
499 |
global $wpdb;
|
500 |
|
501 |
$url = apply_filters( 'ast_sync_provider_url', 'https://trackship.info/wp-json/WCAST/v1/Provider' );
|
558 |
$status = 'active';
|
559 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
560 |
ob_start();
|
561 |
+
$admin = new WC_Advanced_Shipment_Tracking_Admin();
|
562 |
$html = $admin->get_provider_html( $default_shippment_providers, $status );
|
563 |
$html = ob_get_clean();
|
564 |
|
694 |
$status = 'active';
|
695 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table ORDER BY shipping_default ASC, display_in_order DESC, trackship_supported DESC, id ASC" );
|
696 |
ob_start();
|
697 |
+
$admin = new WC_Advanced_Shipment_Tracking_Admin();
|
698 |
$html = $admin->get_provider_html( $default_shippment_providers, $status );
|
699 |
$html = ob_get_clean();
|
700 |
|
757 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php esc_html_e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
758 |
<?php
|
759 |
}
|
760 |
+
}
|
includes/class-wc-advanced-shipment-tracking-trackship.php
CHANGED
@@ -8,10 +8,10 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
8 |
/**
|
9 |
* Initialize the main plugin function
|
10 |
*/
|
11 |
-
|
12 |
|
13 |
global $wpdb;
|
14 |
-
$this->table = $wpdb->prefix .
|
15 |
|
16 |
if ( is_multisite() ) {
|
17 |
|
@@ -67,8 +67,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
67 |
|
68 |
add_action('admin_menu', array( $this, 'register_woocommerce_trackship_menu' ), 99 );
|
69 |
|
70 |
-
add_action( 'admin_notices', array( $this, 'notice_install_ts4wc' ) );
|
71 |
-
add_action( 'admin_init', array( $this, 'ts4wc_integration_notice_ignore' ) );
|
72 |
|
73 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
74 |
|
@@ -149,6 +149,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
149 |
|
150 |
/**
|
151 |
* Display TS4WC active notice
|
|
|
152 |
* @since 3.2.4
|
153 |
*/
|
154 |
public function notice_install_ts4wc() {
|
@@ -182,9 +183,12 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
182 |
</style>
|
183 |
<div class="notice notice-error is-dismissible ts4wc-dismissable-notice">
|
184 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
185 |
-
<p
|
|
|
186 |
/* translators: %s: search TS4WC plugin link */
|
187 |
-
printf( esc_html__( 'Hi there, We noticed that your store is connected to TrackShip and there is a new and better TrackShip integration plugin for WooCommerce that will work with AST. Please install and activate the new %1$sTrackShip For WooCommerce%2$s plugin.', 'woo-advanced-shipment-tracking' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ) . '">', '</a>' );
|
|
|
|
|
188 |
</div>
|
189 |
<?php
|
190 |
}
|
@@ -205,8 +209,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
205 |
|
206 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
207 |
|
208 |
-
wp_register_style( 'trackship_styles',
|
209 |
-
wp_register_script( 'trackship_script',
|
210 |
wp_localize_script( 'trackship_script', 'trackship_script', array(
|
211 |
'i18n' => array(
|
212 |
'data_saved' => __( 'Data saved successfully.', 'woo-advanced-shipment-tracking' ),
|
@@ -334,7 +338,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
334 |
?>
|
335 |
<div class="zorem-layout">
|
336 |
<div class="zorem-layout__header">
|
337 |
-
<img class="zorem-layout__header-logo" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/trackship-logo.png">
|
338 |
|
339 |
<div class="woocommerce-layout__activity-panel">
|
340 |
<div class="woocommerce-layout__activity-panel-tabs">
|
@@ -393,38 +397,36 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
393 |
$ast_admin = new WC_Advanced_Shipment_Tracking_Admin();
|
394 |
|
395 |
do_action( 'ast_settings_admin_notice' );
|
396 |
-
|
397 |
-
$
|
398 |
-
$
|
399 |
-
$
|
400 |
-
$completed_order_with_do_connection = $trackship->completed_order_with_do_connection();
|
401 |
|
402 |
$url = 'https://my.trackship.info/wp-json/tracking/get_user_plan';
|
403 |
$args['body'] = array(
|
404 |
'user_key' => $wc_ast_api_key,
|
405 |
);
|
406 |
$response = wp_remote_post( $url, $args );
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
<div class="ts_nav_div">
|
414 |
<?php
|
415 |
$this->get_html_menu_tab( $this->ast_menu_trackship_options() );
|
416 |
require_once( 'views/admin_trackship_dashboard.php' );
|
417 |
require_once( 'views/admin_status_notifications.php' );
|
418 |
-
?>
|
419 |
</div>
|
420 |
-
|
421 |
-
|
422 |
-
<!--div id="trackship_settings_snackbar" class="ast_snackbar"><?php esc_html_e( 'Data saved successfully.', 'woo-advanced-shipment-tracking' ); ?></div-->
|
423 |
</div>
|
424 |
<?php
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
}
|
429 |
|
430 |
/*
|
@@ -432,7 +434,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
432 |
*/
|
433 |
public function get_html_menu_tab( $arrays ) {
|
434 |
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'ts_dashboard' ;
|
435 |
-
foreach( (array)$arrays as $id => $array ) {
|
436 |
$checked = ( $tab == $array['data-tab'] ) ? 'checked' : '' ;
|
437 |
?>
|
438 |
<input class="tab_input" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $array['name'] ); ?>" type="radio" data-tab="<?php esc_html_e( $array['data-tab'] ); ?>" data-label="<?php esc_html_e( $array['data-label'] ); ?>" <?php esc_html_e( $checked ); ?> />
|
@@ -540,7 +542,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
540 |
* get settings tab array data
|
541 |
* return array
|
542 |
*/
|
543 |
-
public function get_trackship_general_data(){
|
544 |
|
545 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
546 |
$show_trackship_field = ( $wc_ast_api_key ) ? true : false;
|
@@ -561,7 +563,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
561 |
* get settings tab array data
|
562 |
* return array
|
563 |
*/
|
564 |
-
public function get_tracking_page_data(){
|
565 |
|
566 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
567 |
$show_trackship_field = ( $wc_ast_api_key ) ? true : false;
|
@@ -633,9 +635,9 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
633 |
'type' => 'dropdown',
|
634 |
'title' => __( 'Delivered Label font color', '' ),
|
635 |
'options' => array(
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
),
|
640 |
'class' => 'status_label_color_th',
|
641 |
'show' => true,
|
@@ -688,41 +690,42 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
688 |
global $post;
|
689 |
if ( 'shipment_status' === $column ) {
|
690 |
|
691 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
692 |
$tracking_items = $ast->get_tracking_items( $post->ID );
|
693 |
$shipment_status = get_post_meta( $post->ID, 'shipment_status', true );
|
694 |
$wp_date_format = get_option( 'date_format' );
|
695 |
-
$date_format = (
|
696 |
|
697 |
if ( count( $tracking_items ) > 0 ) {
|
698 |
?>
|
699 |
-
|
700 |
-
|
701 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
702 |
|
703 |
if ( !isset( $shipment_status[$key] ) ) {
|
704 |
-
echo '<li class="tracking-item-' . $tracking_item['tracking_id'] . '"></li>';
|
|
|
705 |
}
|
706 |
|
707 |
$status = isset( $shipment_status[$key]['pending_status'] ) ? $shipment_status[$key]['pending_status'] : $shipment_status[$key]['status'];
|
708 |
$status_date = $shipment_status[$key]['status_date'];
|
709 |
$est_delivery_date = isset( $shipment_status[$key]['est_delivery_date'] ) ? $shipment_status[$key]['est_delivery_date'] : '';
|
710 |
$has_est_delivery = ( 'delivered' != $status && 'return_to_sender' != $status && !empty( $est_delivery_date ) ) ? true : false ;
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
<?php echo apply_filters( 'trackship_status_icon_filter',
|
715 |
-
<span class="ast-shipment-tracking-status"><?php
|
716 |
<?php if ( '' != $status_date ) { ?>
|
717 |
-
<span class="showif_has_est_delivery_0 ft11">on <?php esc_html_e(
|
718 |
<?php } ?>
|
719 |
-
|
720 |
-
|
721 |
<?php } ?>
|
722 |
-
|
723 |
-
|
724 |
<?php } ?>
|
725 |
-
|
726 |
<?php
|
727 |
} else {
|
728 |
echo '–';
|
@@ -757,7 +760,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
757 |
$processed_ids[] = $post_id;
|
758 |
}
|
759 |
|
760 |
-
return
|
761 |
'get_shipment_status' => '1',
|
762 |
'processed_count' => count( $processed_ids ),
|
763 |
'processed_ids' => implode( ',', $processed_ids ),
|
@@ -783,7 +786,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
783 |
|
784 |
$order_id = $order->get_id();
|
785 |
|
786 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
787 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
788 |
|
789 |
if ( $tracking_items ) {
|
@@ -798,14 +801,14 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
798 |
wp_schedule_single_event( time() + 1, 'wcast_retry_trackship_apicall', array( $order_id ) );
|
799 |
}
|
800 |
|
801 |
-
if( isset( $shipment_status[ $key ][ 'pending_status' ] ) && 'TrackShip connection issue' == $shipment_status[$key]['pending_status'] ) {
|
802 |
wp_schedule_single_event( time() + 1, 'wcast_retry_trackship_apicall', array( $order_id ) );
|
803 |
}
|
804 |
}
|
805 |
}
|
806 |
}
|
807 |
$url = admin_url( '/edit.php?post_type=shop_order' );
|
808 |
-
echo $url;
|
809 |
die();
|
810 |
}
|
811 |
|
@@ -818,14 +821,15 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
818 |
return; // Exit
|
819 |
}
|
820 |
|
821 |
-
$
|
|
|
822 |
|
823 |
printf( '<div id="message" class="updated fade"><p>' .
|
824 |
-
_n( 'The shipment status updates will run in the background, please refresh the page in a few minutes.',
|
825 |
'The shipment status updates will run in the background, please refresh the page in a few minutes.',
|
826 |
$count,
|
827 |
'get_shipment_status'
|
828 |
-
) . '</p></div>', $count );
|
829 |
}
|
830 |
|
831 |
/**
|
@@ -875,9 +879,9 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
875 |
|
876 |
?>
|
877 |
<select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
|
878 |
-
<option value=""><?php
|
879 |
<?php foreach ( $terms as $value => $term ) : ?>
|
880 |
-
<option value="<?php echo esc_attr( $value ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipment_status'] ) ? selected( $value, $_GET['_shop_order_shipment_status'], false ) : '' ); ?>>
|
881 |
<?php printf( '%1$s', esc_html( $term->term ) ); ?>
|
882 |
</option>
|
883 |
<?php endforeach; ?>
|
@@ -895,10 +899,11 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
895 |
*/
|
896 |
public function filter_orders_by_shipment_status_query( $vars ) {
|
897 |
global $typenow;
|
898 |
-
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] ) && $_GET['_shop_order_shipment_status']
|
|
|
899 |
$vars['meta_query'][] = array(
|
900 |
'key' => 'ts_shipment_status',
|
901 |
-
'value' => $_GET['_shop_order_shipment_status'],
|
902 |
'compare' => 'LIKE'
|
903 |
);
|
904 |
}
|
@@ -914,8 +919,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
914 |
$order = wc_get_order( $order_id );
|
915 |
$order_shipped = apply_filters( 'is_order_shipped', true, $order );
|
916 |
|
917 |
-
if( $order_shipped ) {
|
918 |
-
$api = new WC_Advanced_Shipment_Tracking_Api_Call;
|
919 |
$array = $api->get_trackship_apicall( $order_id );
|
920 |
}
|
921 |
}
|
@@ -925,58 +930,58 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
925 |
*/
|
926 |
public function trackship_status_filter_func( $status ) {
|
927 |
switch ( $status ) {
|
928 |
-
case
|
929 |
$status = __( 'In Transit', 'woo-advanced-shipment-tracking' );
|
930 |
break;
|
931 |
-
case
|
932 |
$status = __( 'On Hold', 'woo-advanced-shipment-tracking' );
|
933 |
break;
|
934 |
-
case
|
935 |
$status = __( 'Pre Transit', 'woo-advanced-shipment-tracking' );
|
936 |
break;
|
937 |
-
case
|
938 |
$status = __( 'Delivered', 'woo-advanced-shipment-tracking' );
|
939 |
break;
|
940 |
-
case
|
941 |
$status = __( 'Out For Delivery', 'woo-advanced-shipment-tracking' );
|
942 |
break;
|
943 |
-
case
|
944 |
$status = __( 'Available For Pickup', 'woo-advanced-shipment-tracking' );
|
945 |
break;
|
946 |
-
case
|
947 |
$status = __( 'Return To Sender', 'woo-advanced-shipment-tracking' );
|
948 |
break;
|
949 |
-
case
|
950 |
$status = __( 'Failed Attempt', 'woo-advanced-shipment-tracking' );
|
951 |
break;
|
952 |
-
case
|
953 |
$status = __( 'Exception', 'woo-advanced-shipment-tracking' );
|
954 |
break;
|
955 |
-
case
|
956 |
$status = __( 'Unknown', 'woo-advanced-shipment-tracking' );
|
957 |
break;
|
958 |
-
case
|
959 |
$status = __( 'Pending TrackShip', 'woo-advanced-shipment-tracking' );
|
960 |
break;
|
961 |
-
case
|
962 |
$status = __( 'Pending', 'woo-advanced-shipment-tracking' );
|
963 |
break;
|
964 |
-
case
|
965 |
$status = __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' );
|
966 |
break;
|
967 |
-
case
|
968 |
$status = __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' );
|
969 |
break;
|
970 |
-
case
|
971 |
$status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
|
972 |
break;
|
973 |
-
case
|
974 |
$status = __( 'Wrong Shipping Provider', 'woo-advanced-shipment-tracking' );
|
975 |
break;
|
976 |
-
case
|
977 |
$status = __( 'Deleted', 'woocommerce' );
|
978 |
break;
|
979 |
-
case
|
980 |
$status = __( 'TrackShip balance is 0', 'woocommerce' );
|
981 |
break;
|
982 |
}
|
@@ -988,50 +993,50 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
988 |
*/
|
989 |
public function trackship_status_icon_filter_func( $html, $status ) {
|
990 |
switch ( $status ) {
|
991 |
-
case
|
992 |
-
$html = '<span class="shipment-icon icon-'
|
993 |
break;
|
994 |
-
case
|
995 |
-
$html = '<span class="shipment-icon icon-'
|
996 |
break;
|
997 |
-
case
|
998 |
-
$html = '<span class="shipment-icon icon-'
|
999 |
break;
|
1000 |
-
case
|
1001 |
-
$html = '<span class="shipment-icon icon-'
|
1002 |
break;
|
1003 |
-
case
|
1004 |
-
$html = '<span class="shipment-icon icon-'
|
1005 |
break;
|
1006 |
-
case
|
1007 |
-
$html = '<span class="shipment-icon icon-'
|
1008 |
break;
|
1009 |
-
case
|
1010 |
-
$html = '<span class="shipment-icon icon-'
|
1011 |
break;
|
1012 |
-
case
|
1013 |
-
$html = '<span class="shipment-icon icon-'
|
1014 |
break;
|
1015 |
-
case
|
1016 |
-
$html = '<span class="shipment-icon icon-'
|
1017 |
break;
|
1018 |
-
case
|
1019 |
-
$html = '<span class="shipment-icon icon-'
|
1020 |
break;
|
1021 |
-
case
|
1022 |
-
$html = '<span class="shipment-icon icon-'
|
1023 |
break;
|
1024 |
-
case
|
1025 |
-
$html = '<span class="shipment-icon icon-'
|
1026 |
break;
|
1027 |
-
case
|
1028 |
-
$html = '<span class="shipment-icon icon-'
|
1029 |
break;
|
1030 |
-
case
|
1031 |
-
$html = '<span class="shipment-icon icon-'
|
1032 |
break;
|
1033 |
-
case
|
1034 |
-
$html = '<span class="shipment-icon icon-'
|
1035 |
break;
|
1036 |
default:
|
1037 |
$html = '<span class="shipment-icon icon-default">';
|
@@ -1046,7 +1051,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1046 |
public function wcast_retry_trackship_apicall_func( $order_id ) {
|
1047 |
$logger = wc_get_logger();
|
1048 |
$context = array( 'source' => 'retry_trackship_apicall' );
|
1049 |
-
$logger->info(
|
1050 |
$this->trigger_woocommerce_order_status_completed( $order_id );
|
1051 |
}
|
1052 |
|
@@ -1055,9 +1060,16 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1055 |
*/
|
1056 |
public function update_shipment_status_email_status_fun() {
|
1057 |
check_ajax_referer( 'ts_late_shipments_email_form', 'security' );
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
exit;
|
1062 |
}
|
1063 |
|
@@ -1065,9 +1077,12 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1065 |
* update late shipment email status
|
1066 |
*/
|
1067 |
public function update_enable_late_shipments_email_fun() {
|
1068 |
-
check_ajax_referer( 'ts_late_shipments_email_form', 'security' );
|
1069 |
-
$
|
1070 |
-
|
|
|
|
|
|
|
1071 |
exit;
|
1072 |
}
|
1073 |
|
@@ -1089,14 +1104,15 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1089 |
|
1090 |
if ( 1 == $wc_ast_status_shipped ) {
|
1091 |
$completed_order_label = '<span class="shipped_label">shipped</span>';
|
1092 |
-
} else{
|
1093 |
$completed_order_label = '<span class="shipped_label">completed</span>';
|
1094 |
}
|
1095 |
|
1096 |
$form_data = array(
|
1097 |
'wc_ast_bulk_shipment_status' => array(
|
1098 |
'type' => 'button',
|
1099 |
-
|
|
|
1100 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1101 |
'show' => true,
|
1102 |
'disable' => $disable_bulk_sync,
|
@@ -1105,7 +1121,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1105 |
),
|
1106 |
'wc_ast_bulk_shipment_status_for_zero_tracker_balace' => array(
|
1107 |
'type' => 'button',
|
1108 |
-
|
|
|
1109 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1110 |
'show' => true,
|
1111 |
'disable' => $disable_bulk_sync_zero_balance,
|
@@ -1114,7 +1131,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1114 |
),
|
1115 |
'wc_ast_bulk_shipment_status_for_trackship_connection_issue' => array(
|
1116 |
'type' => 'button',
|
1117 |
-
|
|
|
1118 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1119 |
'show' => true,
|
1120 |
'disable' => $disable_bulk_sync_do_connection,
|
@@ -1145,13 +1163,13 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1145 |
foreach ( $orders as $order ) {
|
1146 |
$order_id = $order->get_id();
|
1147 |
|
1148 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1149 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1150 |
|
1151 |
if ( $tracking_items ) {
|
1152 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
1153 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
1154 |
-
if( !isset( $shipment_status[ $key ] ) ) {
|
1155 |
$completed_order_with_tracking++;
|
1156 |
}
|
1157 |
}
|
@@ -1180,7 +1198,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1180 |
foreach ( $orders as $order ) {
|
1181 |
$order_id = $order->get_id();
|
1182 |
|
1183 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1184 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1185 |
|
1186 |
if ( $tracking_items ) {
|
@@ -1215,7 +1233,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1215 |
foreach ( $orders as $order ) {
|
1216 |
$order_id = $order->get_id();
|
1217 |
|
1218 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1219 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1220 |
|
1221 |
if ( $tracking_items ) {
|
@@ -1240,7 +1258,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1240 |
|
1241 |
$tracking_id = $item['tracking_id'];
|
1242 |
|
1243 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1244 |
$tracking_items = $ast->get_tracking_items( $order_id );
|
1245 |
|
1246 |
$wp_date_format = get_option( 'date_format' );
|
@@ -1248,7 +1266,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1248 |
|
1249 |
if ( count( $tracking_items ) > 0 ) {
|
1250 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
1251 |
-
if( $tracking_id == $tracking_item['tracking_id'] ) {
|
1252 |
if ( isset( $shipment_status[$key] ) ) {
|
1253 |
$has_est_delivery = false;
|
1254 |
|
@@ -1256,23 +1274,23 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1256 |
$status_date = $shipment_status[$key]['status_date'];
|
1257 |
$est_delivery_date = isset( $shipment_status[$key]['est_delivery_date'] ) ? $shipment_status[$key]['est_delivery_date'] : '';
|
1258 |
|
1259 |
-
if (
|
1260 |
$has_est_delivery = true;
|
1261 |
-
}
|
1262 |
-
?>
|
1263 |
<div class="ast-shipment-status-div">
|
1264 |
-
<span class="open_tracking_details ast-shipment-status shipment-<?php echo
|
1265 |
-
<?php echo apply_filters( 'trackship_status_icon_filter',
|
1266 |
</span>
|
1267 |
<?php if ( '' != $status_date ) { ?>
|
1268 |
-
<span class="">on <?php echo
|
1269 |
<?php } ?>
|
1270 |
<br>
|
1271 |
<?php if ( $has_est_delivery ) { ?>
|
1272 |
-
<span class="wcast-shipment-est-delivery ft11">Est. Delivery(<?php echo
|
1273 |
<?php } ?>
|
1274 |
</div>
|
1275 |
-
|
1276 |
}
|
1277 |
}
|
1278 |
}
|
@@ -1285,10 +1303,10 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1285 |
public function delete_tracking_number_from_trackship( $tracking_items, $tracking_id, $order_id ) {
|
1286 |
|
1287 |
foreach ( $tracking_items as $tracking_item ) {
|
1288 |
-
if ( $tracking_item['tracking_id'] == $
|
1289 |
$tracking_number = $tracking_item['tracking_number'];
|
1290 |
$tracking_provider = $tracking_item['tracking_provider'];
|
1291 |
-
$api = new WC_Advanced_Shipment_Tracking_Api_Call;
|
1292 |
$array = $api->delete_tracking_number_from_trackship( $order_id, $tracking_number, $tracking_provider );
|
1293 |
}
|
1294 |
}
|
@@ -1297,7 +1315,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1297 |
/*
|
1298 |
* fix shipment tracking for deleted tracking
|
1299 |
*/
|
1300 |
-
public function func_fix_shipment_tracking_for_deleted_tracking( $order_id, $key, $item ){
|
1301 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
1302 |
if ( isset( $shipment_status[ $key ] ) ) {
|
1303 |
unset($shipment_status[$key]);
|
@@ -1305,14 +1323,14 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1305 |
}
|
1306 |
|
1307 |
$ts_shipment_status = get_post_meta( $order_id, 'ts_shipment_status', true );
|
1308 |
-
if( isset( $ts_shipment_status[ $key ] ) ) {
|
1309 |
unset( $ts_shipment_status[$key] );
|
1310 |
update_post_meta( $order_id, 'ts_shipment_status', $ts_shipment_status );
|
1311 |
}
|
1312 |
}
|
1313 |
|
1314 |
/**
|
1315 |
-
*
|
1316 |
*/
|
1317 |
public function check_tracking_delivered( $order_id ) {
|
1318 |
|
@@ -1320,21 +1338,21 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1320 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true );
|
1321 |
$wc_ast_status_delivered = get_option( 'wc_ast_status_delivered' );
|
1322 |
|
1323 |
-
foreach( (array) $shipment_status as $shipment ) {
|
1324 |
$status = $shipment['status'];
|
1325 |
-
if( 'delivered' != $status ) {
|
1326 |
$delivered = false;
|
1327 |
}
|
1328 |
}
|
1329 |
|
1330 |
-
if ( count( $shipment_status ) > 0 &&
|
1331 |
|
1332 |
$order = wc_get_order( $order_id );
|
1333 |
$order_status = $order->get_status();
|
1334 |
|
1335 |
$change_to_delivered = apply_filters( 'ts_change_order_to_delivered', false, $order_status );
|
1336 |
|
1337 |
-
if (
|
1338 |
$change_to_delivered = true;
|
1339 |
}
|
1340 |
|
@@ -1345,19 +1363,19 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1345 |
}
|
1346 |
|
1347 |
/**
|
1348 |
-
*
|
1349 |
*/
|
1350 |
public function trigger_tracking_email( $order_id, $old_status, $new_status, $tracking_item, $shipment_status ) {
|
1351 |
$order = wc_get_order( $order_id );
|
1352 |
require_once( 'email-manager.php' );
|
1353 |
|
1354 |
if ( $old_status != $new_status ) {
|
1355 |
-
if (
|
1356 |
wc_trackship_email_manager()->delivered_shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status );
|
1357 |
-
} elseif(
|
1358 |
wc_trackship_email_manager()->shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status );
|
1359 |
}
|
1360 |
-
do_action( 'ast_trigger_ts_status_change'
|
1361 |
}
|
1362 |
}
|
1363 |
|
@@ -1365,7 +1383,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1365 |
* Add a new dashboard widget.
|
1366 |
*/
|
1367 |
public function ast_add_dashboard_widgets() {
|
1368 |
-
wp_enqueue_style( 'trackship_styles',
|
1369 |
wp_add_dashboard_widget( 'trackship_dashboard_widget', 'TrackShip Analytics <small>(last 30 days)</small>', array( $this, 'dashboard_widget_function' ) );
|
1370 |
}
|
1371 |
|
@@ -1384,7 +1402,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1384 |
</div>
|
1385 |
<div class="ts-widget__section ts-widget-bborder">
|
1386 |
<h3><?php esc_html_e( 'Avg Shipment Length', 'woo-advanced-shipment-tracking' ); ?></h3>
|
1387 |
-
<span class="ts-widget-analytics-number"><?php esc_html_e( round( (int)$tracking_analytics['avg_shipment_length'] ) ); ?></span>
|
1388 |
<span><?php esc_html_e( 'days', 'woo-advanced-shipment-tracking' ); ?></span>
|
1389 |
</div>
|
1390 |
</div>
|
@@ -1399,8 +1417,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1399 |
</div>
|
1400 |
</div>
|
1401 |
<div class="ts-widget-footer">
|
1402 |
-
<a class="" href="https://trackship.info/my-account/analytics/" target="blank"><?php esc_html_e( 'View Tracking Analytics','woo-advanced-shipment-tracking' ); ?></a>
|
1403 |
-
<a class="ts_link" href="https://trackship.info" title="TrackShip" target="blank"><img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/trackship-logo.png"></a>
|
1404 |
</div>
|
1405 |
</div>
|
1406 |
<?php
|
@@ -1413,8 +1431,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1413 |
global $wpdb;
|
1414 |
$paid_order_statuses = array( 'completed', 'delivered', 'shipped' );
|
1415 |
|
1416 |
-
$end_date =
|
1417 |
-
$start_date =
|
1418 |
|
1419 |
global $wpdb;
|
1420 |
$paid_order_statuses = array('completed','delivered','shipped');
|
@@ -1435,8 +1453,8 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1435 |
AND shipment_tracking_items.meta_key IN ( '_wc_shipment_tracking_items')
|
1436 |
AND shipment_tracking_items.meta_key IS NOT NULL
|
1437 |
AND shipment_status.meta_key IN ( 'shipment_status')
|
1438 |
-
AND post_date < '"
|
1439 |
-
AND post_date > '"
|
1440 |
|
1441 |
ORDER BY
|
1442 |
posts.ID DESC
|
@@ -1481,10 +1499,10 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1481 |
$status = isset( $val['status'] ) ? $val['status'] : '';
|
1482 |
|
1483 |
if ( 'delivered' != $status ) {
|
1484 |
-
$last_date =
|
1485 |
}
|
1486 |
|
1487 |
-
$days =
|
1488 |
$days = $this->get_num_of_days( $first_date, $last_date );
|
1489 |
|
1490 |
$avg_shipment_days_array[] = $days;
|
@@ -1522,7 +1540,7 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1522 |
$date1 = strtotime($first_date);
|
1523 |
$date2 = strtotime($last_date);
|
1524 |
$diff = abs($date2 - $date1);
|
1525 |
-
return
|
1526 |
}
|
1527 |
|
1528 |
public function get_average( $array ) {
|
@@ -1605,15 +1623,15 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
1605 |
|
1606 |
foreach ( $custom_order_status as $key => $value ) {
|
1607 |
unset( $custom_order_status[ $key ] );
|
1608 |
-
$key = str_replace(
|
1609 |
$custom_order_status[] = $key;
|
1610 |
}
|
1611 |
|
1612 |
-
if ( 'updated-tracking' == $order_status || 'completed' == $order_status || 'shipped' == $order_status || in_array( $order_status, $custom_order_status )){
|
1613 |
return true;
|
1614 |
} else {
|
1615 |
return false;
|
1616 |
}
|
1617 |
return $value;
|
1618 |
}
|
1619 |
-
}
|
8 |
/**
|
9 |
* Initialize the main plugin function
|
10 |
*/
|
11 |
+
public function __construct() {
|
12 |
|
13 |
global $wpdb;
|
14 |
+
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
15 |
|
16 |
if ( is_multisite() ) {
|
17 |
|
67 |
|
68 |
add_action('admin_menu', array( $this, 'register_woocommerce_trackship_menu' ), 99 );
|
69 |
|
70 |
+
//add_action( 'admin_notices', array( $this, 'notice_install_ts4wc' ) );
|
71 |
+
//add_action( 'admin_init', array( $this, 'ts4wc_integration_notice_ignore' ) );
|
72 |
|
73 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
74 |
|
149 |
|
150 |
/**
|
151 |
* Display TS4WC active notice
|
152 |
+
*
|
153 |
* @since 3.2.4
|
154 |
*/
|
155 |
public function notice_install_ts4wc() {
|
183 |
</style>
|
184 |
<div class="notice notice-error is-dismissible ts4wc-dismissable-notice">
|
185 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
186 |
+
<p>
|
187 |
+
<?php
|
188 |
/* translators: %s: search TS4WC plugin link */
|
189 |
+
printf( esc_html__( 'Hi there, We noticed that your store is connected to TrackShip and there is a new and better TrackShip integration plugin for WooCommerce that will work with AST. Please install and activate the new %1$sTrackShip For WooCommerce%2$s plugin.', 'woo-advanced-shipment-tracking' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ) . '">', '</a>' );
|
190 |
+
?>
|
191 |
+
</p>
|
192 |
</div>
|
193 |
<?php
|
194 |
}
|
209 |
|
210 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
211 |
|
212 |
+
wp_register_style( 'trackship_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/trackship.css', array(), wc_advanced_shipment_tracking()->version );
|
213 |
+
wp_register_script( 'trackship_script', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/trackship.js', array( 'jquery', 'wp-util' ), wc_advanced_shipment_tracking()->version, true );
|
214 |
wp_localize_script( 'trackship_script', 'trackship_script', array(
|
215 |
'i18n' => array(
|
216 |
'data_saved' => __( 'Data saved successfully.', 'woo-advanced-shipment-tracking' ),
|
338 |
?>
|
339 |
<div class="zorem-layout">
|
340 |
<div class="zorem-layout__header">
|
341 |
+
<img class="zorem-layout__header-logo" src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/trackship-logo.png">
|
342 |
|
343 |
<div class="woocommerce-layout__activity-panel">
|
344 |
<div class="woocommerce-layout__activity-panel-tabs">
|
397 |
$ast_admin = new WC_Advanced_Shipment_Tracking_Admin();
|
398 |
|
399 |
do_action( 'ast_settings_admin_notice' );
|
400 |
+
|
401 |
+
$completed_order_with_tracking = $this->completed_order_with_tracking();
|
402 |
+
$completed_order_with_zero_balance = $this->completed_order_with_zero_balance();
|
403 |
+
$completed_order_with_do_connection = $this->completed_order_with_do_connection();
|
|
|
404 |
|
405 |
$url = 'https://my.trackship.info/wp-json/tracking/get_user_plan';
|
406 |
$args['body'] = array(
|
407 |
'user_key' => $wc_ast_api_key,
|
408 |
);
|
409 |
$response = wp_remote_post( $url, $args );
|
410 |
+
if ( !is_wp_error( $response ) ) {
|
411 |
+
$plan_data = json_decode($response['body']);
|
412 |
+
}
|
413 |
+
?>
|
414 |
+
<div class="woocommerce zorem_admin_layout">
|
415 |
+
<div class="ast_admin_content" >
|
416 |
<div class="ts_nav_div">
|
417 |
<?php
|
418 |
$this->get_html_menu_tab( $this->ast_menu_trackship_options() );
|
419 |
require_once( 'views/admin_trackship_dashboard.php' );
|
420 |
require_once( 'views/admin_status_notifications.php' );
|
421 |
+
?>
|
422 |
</div>
|
423 |
+
</div>
|
424 |
+
</div>
|
|
|
425 |
</div>
|
426 |
<?php
|
427 |
+
} else {
|
428 |
+
include 'views/admin_options_trackship_integration.php';
|
429 |
+
}
|
430 |
}
|
431 |
|
432 |
/*
|
434 |
*/
|
435 |
public function get_html_menu_tab( $arrays ) {
|
436 |
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'ts_dashboard' ;
|
437 |
+
foreach ( (array) $arrays as $id => $array ) {
|
438 |
$checked = ( $tab == $array['data-tab'] ) ? 'checked' : '' ;
|
439 |
?>
|
440 |
<input class="tab_input" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $array['name'] ); ?>" type="radio" data-tab="<?php esc_html_e( $array['data-tab'] ); ?>" data-label="<?php esc_html_e( $array['data-label'] ); ?>" <?php esc_html_e( $checked ); ?> />
|
542 |
* get settings tab array data
|
543 |
* return array
|
544 |
*/
|
545 |
+
public function get_trackship_general_data() {
|
546 |
|
547 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
548 |
$show_trackship_field = ( $wc_ast_api_key ) ? true : false;
|
563 |
* get settings tab array data
|
564 |
* return array
|
565 |
*/
|
566 |
+
public function get_tracking_page_data() {
|
567 |
|
568 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
569 |
$show_trackship_field = ( $wc_ast_api_key ) ? true : false;
|
635 |
'type' => 'dropdown',
|
636 |
'title' => __( 'Delivered Label font color', '' ),
|
637 |
'options' => array(
|
638 |
+
'' =>__( 'Select', 'woocommerce' ),
|
639 |
+
'#fff' =>__( 'Light', '' ),
|
640 |
+
'#000' =>__( 'Dark', '' ),
|
641 |
),
|
642 |
'class' => 'status_label_color_th',
|
643 |
'show' => true,
|
690 |
global $post;
|
691 |
if ( 'shipment_status' === $column ) {
|
692 |
|
693 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
694 |
$tracking_items = $ast->get_tracking_items( $post->ID );
|
695 |
$shipment_status = get_post_meta( $post->ID, 'shipment_status', true );
|
696 |
$wp_date_format = get_option( 'date_format' );
|
697 |
+
$date_format = ( 'd/m/Y' == $wp_date_format ) ? 'd/m' : 'm/d' ;
|
698 |
|
699 |
if ( count( $tracking_items ) > 0 ) {
|
700 |
?>
|
701 |
+
<ul class="wcast-shipment-status-list">
|
702 |
+
<?php
|
703 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
704 |
|
705 |
if ( !isset( $shipment_status[$key] ) ) {
|
706 |
+
echo '<li class="tracking-item-' . esc_attr( $tracking_item['tracking_id'] ) . '"></li>';
|
707 |
+
continue;
|
708 |
}
|
709 |
|
710 |
$status = isset( $shipment_status[$key]['pending_status'] ) ? $shipment_status[$key]['pending_status'] : $shipment_status[$key]['status'];
|
711 |
$status_date = $shipment_status[$key]['status_date'];
|
712 |
$est_delivery_date = isset( $shipment_status[$key]['est_delivery_date'] ) ? $shipment_status[$key]['est_delivery_date'] : '';
|
713 |
$has_est_delivery = ( 'delivered' != $status && 'return_to_sender' != $status && !empty( $est_delivery_date ) ) ? true : false ;
|
714 |
+
?>
|
715 |
+
<li id="shipment-item-<?php esc_html_e( $tracking_item['tracking_id'] ); ?>" class="tracking-item-<?php esc_html_e( $tracking_item['tracking_id'] ); ?> open_tracking_details" data-orderid="<?php esc_html_e( $post->ID ); ?>" data-tracking_id="<?php esc_html_e( $tracking_item['tracking_id'] ); ?>">
|
716 |
+
<div class="ast-shipment-status shipment-<?php esc_html_e( $status ); ?> has_est_delivery_<?php esc_html_e ( $has_est_delivery ? 1 : 0 ); ?>">
|
717 |
+
<?php echo wp_kses_post( apply_filters( 'trackship_status_icon_filter', '', $status ) ); ?>
|
718 |
+
<span class="ast-shipment-tracking-status"><?php esc_html_e( apply_filters( 'trackship_status_filter', $status ) ); ?></span>
|
719 |
<?php if ( '' != $status_date ) { ?>
|
720 |
+
<span class="showif_has_est_delivery_0 ft11">on <?php esc_html_e( gmdate( $date_format, strtotime( $status_date ) ) ); ?></span>
|
721 |
<?php } ?>
|
722 |
+
<?php if ( $has_est_delivery ) { ?>
|
723 |
+
<span class="wcast-shipment-est-delivery ft11">Est. Delivery(<?php esc_html_e( gmdate( $date_format, strtotime( $est_delivery_date ) ) ); ?>)</span>
|
724 |
<?php } ?>
|
725 |
+
</div>
|
726 |
+
</li>
|
727 |
<?php } ?>
|
728 |
+
</ul>
|
729 |
<?php
|
730 |
} else {
|
731 |
echo '–';
|
760 |
$processed_ids[] = $post_id;
|
761 |
}
|
762 |
|
763 |
+
return add_query_arg( array(
|
764 |
'get_shipment_status' => '1',
|
765 |
'processed_count' => count( $processed_ids ),
|
766 |
'processed_ids' => implode( ',', $processed_ids ),
|
786 |
|
787 |
$order_id = $order->get_id();
|
788 |
|
789 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
790 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
791 |
|
792 |
if ( $tracking_items ) {
|
801 |
wp_schedule_single_event( time() + 1, 'wcast_retry_trackship_apicall', array( $order_id ) );
|
802 |
}
|
803 |
|
804 |
+
if ( isset( $shipment_status[ $key ][ 'pending_status' ] ) && 'TrackShip connection issue' == $shipment_status[$key]['pending_status'] ) {
|
805 |
wp_schedule_single_event( time() + 1, 'wcast_retry_trackship_apicall', array( $order_id ) );
|
806 |
}
|
807 |
}
|
808 |
}
|
809 |
}
|
810 |
$url = admin_url( '/edit.php?post_type=shop_order' );
|
811 |
+
echo esc_url( $url );
|
812 |
die();
|
813 |
}
|
814 |
|
821 |
return; // Exit
|
822 |
}
|
823 |
|
824 |
+
$processed_count = isset( $_REQUEST['processed_count'] ) ? wc_clean( $_REQUEST['processed_count'] ) : '';
|
825 |
+
$count = intval( $processed_count );
|
826 |
|
827 |
printf( '<div id="message" class="updated fade"><p>' .
|
828 |
+
esc_html( _n( 'The shipment status updates will run in the background, please refresh the page in a few minutes.',
|
829 |
'The shipment status updates will run in the background, please refresh the page in a few minutes.',
|
830 |
$count,
|
831 |
'get_shipment_status'
|
832 |
+
) ) . '</p></div>', esc_html( $count ) );
|
833 |
}
|
834 |
|
835 |
/**
|
879 |
|
880 |
?>
|
881 |
<select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
|
882 |
+
<option value=""><?php esc_html_e( 'Filter by shipment status', 'woo-advanced-shipment-tracking' ); ?></option>
|
883 |
<?php foreach ( $terms as $value => $term ) : ?>
|
884 |
+
<option value="<?php echo esc_attr( $value ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipment_status'] ) ? selected( $value, wc_clean( $_GET['_shop_order_shipment_status'] ), false ) : '' ); ?>>
|
885 |
<?php printf( '%1$s', esc_html( $term->term ) ); ?>
|
886 |
</option>
|
887 |
<?php endforeach; ?>
|
899 |
*/
|
900 |
public function filter_orders_by_shipment_status_query( $vars ) {
|
901 |
global $typenow;
|
902 |
+
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] ) && '' != $_GET['_shop_order_shipment_status'] ) {
|
903 |
+
|
904 |
$vars['meta_query'][] = array(
|
905 |
'key' => 'ts_shipment_status',
|
906 |
+
'value' => wc_clean( $_GET['_shop_order_shipment_status'] ),
|
907 |
'compare' => 'LIKE'
|
908 |
);
|
909 |
}
|
919 |
$order = wc_get_order( $order_id );
|
920 |
$order_shipped = apply_filters( 'is_order_shipped', true, $order );
|
921 |
|
922 |
+
if ( $order_shipped ) {
|
923 |
+
$api = new WC_Advanced_Shipment_Tracking_Api_Call();
|
924 |
$array = $api->get_trackship_apicall( $order_id );
|
925 |
}
|
926 |
}
|
930 |
*/
|
931 |
public function trackship_status_filter_func( $status ) {
|
932 |
switch ( $status ) {
|
933 |
+
case 'in_transit':
|
934 |
$status = __( 'In Transit', 'woo-advanced-shipment-tracking' );
|
935 |
break;
|
936 |
+
case 'on_hold':
|
937 |
$status = __( 'On Hold', 'woo-advanced-shipment-tracking' );
|
938 |
break;
|
939 |
+
case 'pre_transit':
|
940 |
$status = __( 'Pre Transit', 'woo-advanced-shipment-tracking' );
|
941 |
break;
|
942 |
+
case 'delivered':
|
943 |
$status = __( 'Delivered', 'woo-advanced-shipment-tracking' );
|
944 |
break;
|
945 |
+
case 'out_for_delivery':
|
946 |
$status = __( 'Out For Delivery', 'woo-advanced-shipment-tracking' );
|
947 |
break;
|
948 |
+
case 'available_for_pickup':
|
949 |
$status = __( 'Available For Pickup', 'woo-advanced-shipment-tracking' );
|
950 |
break;
|
951 |
+
case 'return_to_sender':
|
952 |
$status = __( 'Return To Sender', 'woo-advanced-shipment-tracking' );
|
953 |
break;
|
954 |
+
case 'failure':
|
955 |
$status = __( 'Failed Attempt', 'woo-advanced-shipment-tracking' );
|
956 |
break;
|
957 |
+
case 'exception':
|
958 |
$status = __( 'Exception', 'woo-advanced-shipment-tracking' );
|
959 |
break;
|
960 |
+
case 'unknown':
|
961 |
$status = __( 'Unknown', 'woo-advanced-shipment-tracking' );
|
962 |
break;
|
963 |
+
case 'pending_trackship':
|
964 |
$status = __( 'Pending TrackShip', 'woo-advanced-shipment-tracking' );
|
965 |
break;
|
966 |
+
case 'pending':
|
967 |
$status = __( 'Pending', 'woo-advanced-shipment-tracking' );
|
968 |
break;
|
969 |
+
case 'INVALID_TRACKING_NUM':
|
970 |
$status = __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' );
|
971 |
break;
|
972 |
+
case 'carrier_unsupported':
|
973 |
$status = __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' );
|
974 |
break;
|
975 |
+
case 'invalid_user_key':
|
976 |
$status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
|
977 |
break;
|
978 |
+
case 'wrong_shipping_provider':
|
979 |
$status = __( 'Wrong Shipping Provider', 'woo-advanced-shipment-tracking' );
|
980 |
break;
|
981 |
+
case 'deleted':
|
982 |
$status = __( 'Deleted', 'woocommerce' );
|
983 |
break;
|
984 |
+
case 'balance_zero':
|
985 |
$status = __( 'TrackShip balance is 0', 'woocommerce' );
|
986 |
break;
|
987 |
}
|
993 |
*/
|
994 |
public function trackship_status_icon_filter_func( $html, $status ) {
|
995 |
switch ( $status ) {
|
996 |
+
case 'in_transit':
|
997 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
998 |
break;
|
999 |
+
case 'on_hold':
|
1000 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1001 |
break;
|
1002 |
+
case 'pre_transit':
|
1003 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1004 |
break;
|
1005 |
+
case 'delivered':
|
1006 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1007 |
break;
|
1008 |
+
case 'out_for_delivery':
|
1009 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1010 |
break;
|
1011 |
+
case 'available_for_pickup':
|
1012 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1013 |
break;
|
1014 |
+
case 'return_to_sender':
|
1015 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1016 |
break;
|
1017 |
+
case 'failure':
|
1018 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1019 |
break;
|
1020 |
+
case 'exception':
|
1021 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1022 |
break;
|
1023 |
+
case 'unknown':
|
1024 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1025 |
break;
|
1026 |
+
case 'pending_trackship':
|
1027 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1028 |
break;
|
1029 |
+
case 'INVALID_TRACKING_NUM':
|
1030 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1031 |
break;
|
1032 |
+
case 'wrong_shipping_provider':
|
1033 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1034 |
break;
|
1035 |
+
case 'invalid_user_key':
|
1036 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1037 |
break;
|
1038 |
+
case 'carrier_unsupported':
|
1039 |
+
$html = '<span class="shipment-icon icon-' . $status . '">';
|
1040 |
break;
|
1041 |
default:
|
1042 |
$html = '<span class="shipment-icon icon-default">';
|
1051 |
public function wcast_retry_trackship_apicall_func( $order_id ) {
|
1052 |
$logger = wc_get_logger();
|
1053 |
$context = array( 'source' => 'retry_trackship_apicall' );
|
1054 |
+
$logger->info( 'Retry trackship api call for Order id : ' . $order_id, $context );
|
1055 |
$this->trigger_woocommerce_order_status_completed( $order_id );
|
1056 |
}
|
1057 |
|
1060 |
*/
|
1061 |
public function update_shipment_status_email_status_fun() {
|
1062 |
check_ajax_referer( 'ts_late_shipments_email_form', 'security' );
|
1063 |
+
|
1064 |
+
|
1065 |
+
$settings_data = isset( $_POST[ 'settings_data' ] ) ? wc_clean( $_POST[ 'settings_data' ] ) : '';
|
1066 |
+
$post_id = isset( $_POST[ 'id' ] ) ? wc_clean( $_POST[ 'id' ] ) : '';
|
1067 |
+
$wcast_enable_status_email = isset( $_POST[ 'wcast_enable_status_email' ] ) ? wc_clean( $_POST[ 'wcast_enable_status_email' ] ) : '';
|
1068 |
+
|
1069 |
+
$status_settings = get_option( $settings_data );
|
1070 |
+
$status_settings[ $post_id ] = $wcast_enable_status_email;
|
1071 |
+
|
1072 |
+
update_option( $settings_data, $status_settings );
|
1073 |
exit;
|
1074 |
}
|
1075 |
|
1077 |
* update late shipment email status
|
1078 |
*/
|
1079 |
public function update_enable_late_shipments_email_fun() {
|
1080 |
+
check_ajax_referer( 'ts_late_shipments_email_form', 'security' );
|
1081 |
+
$wcast_enable_late_shipments_email = isset( $_POST[ 'wcast_enable_late_shipments_email' ] ) ? wc_clean( $_POST[ 'wcast_enable_late_shipments_email' ] ) : '';
|
1082 |
+
$post_id = isset( $_POST[ 'id' ] ) ? wc_clean( $_POST[ 'id' ] ) : '';
|
1083 |
+
$settings_data = isset( $_POST[ 'settings_data' ] ) ? wc_clean( $_POST[ 'settings_data' ] ) : '';
|
1084 |
+
$status_settings[ $post_id ] = $wcast_enable_late_shipments_email;
|
1085 |
+
update_option( $settings_data, $status_settings );
|
1086 |
exit;
|
1087 |
}
|
1088 |
|
1104 |
|
1105 |
if ( 1 == $wc_ast_status_shipped ) {
|
1106 |
$completed_order_label = '<span class="shipped_label">shipped</span>';
|
1107 |
+
} else {
|
1108 |
$completed_order_label = '<span class="shipped_label">completed</span>';
|
1109 |
}
|
1110 |
|
1111 |
$form_data = array(
|
1112 |
'wc_ast_bulk_shipment_status' => array(
|
1113 |
'type' => 'button',
|
1114 |
+
/* translators: %1$s: replace with completed_order_with_tracking, %2$s: replace with completed_order_label */
|
1115 |
+
'title' => sprintf( __( 'You got %1$s %2$s orders with tracking info that were not sent to track on TrackShip', 'woo-advanced-shipment-tracking' ), $completed_order_with_tracking , $completed_order_label ),
|
1116 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1117 |
'show' => true,
|
1118 |
'disable' => $disable_bulk_sync,
|
1121 |
),
|
1122 |
'wc_ast_bulk_shipment_status_for_zero_tracker_balace' => array(
|
1123 |
'type' => 'button',
|
1124 |
+
/* translators: %1$s: replace with completed_order_with_zero_balance, %2$s: replace with completed_order_label */
|
1125 |
+
'title' => sprintf( __( 'You got %1$s %2$s orders with shipment status “TrackShip balance is 0”', 'woo-advanced-shipment-tracking' ), $completed_order_with_zero_balance , $completed_order_label ),
|
1126 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1127 |
'show' => true,
|
1128 |
'disable' => $disable_bulk_sync_zero_balance,
|
1131 |
),
|
1132 |
'wc_ast_bulk_shipment_status_for_trackship_connection_issue' => array(
|
1133 |
'type' => 'button',
|
1134 |
+
/* translators: %1$s: replace with completed_order_with_do_connection, %2$s: replace with completed_order_label */
|
1135 |
+
'title' => sprintf( __( 'You got %1$s %2$s orders with shipment status “TrackShip connection issue”', 'woo-advanced-shipment-tracking' ), $completed_order_with_do_connection , $completed_order_label ),
|
1136 |
'label' => __( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ),
|
1137 |
'show' => true,
|
1138 |
'disable' => $disable_bulk_sync_do_connection,
|
1163 |
foreach ( $orders as $order ) {
|
1164 |
$order_id = $order->get_id();
|
1165 |
|
1166 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1167 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1168 |
|
1169 |
if ( $tracking_items ) {
|
1170 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
1171 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
1172 |
+
if ( !isset( $shipment_status[ $key ] ) ) {
|
1173 |
$completed_order_with_tracking++;
|
1174 |
}
|
1175 |
}
|
1198 |
foreach ( $orders as $order ) {
|
1199 |
$order_id = $order->get_id();
|
1200 |
|
1201 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1202 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1203 |
|
1204 |
if ( $tracking_items ) {
|
1233 |
foreach ( $orders as $order ) {
|
1234 |
$order_id = $order->get_id();
|
1235 |
|
1236 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1237 |
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1238 |
|
1239 |
if ( $tracking_items ) {
|
1258 |
|
1259 |
$tracking_id = $item['tracking_id'];
|
1260 |
|
1261 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1262 |
$tracking_items = $ast->get_tracking_items( $order_id );
|
1263 |
|
1264 |
$wp_date_format = get_option( 'date_format' );
|
1266 |
|
1267 |
if ( count( $tracking_items ) > 0 ) {
|
1268 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
1269 |
+
if ( $tracking_id == $tracking_item['tracking_id'] ) {
|
1270 |
if ( isset( $shipment_status[$key] ) ) {
|
1271 |
$has_est_delivery = false;
|
1272 |
|
1274 |
$status_date = $shipment_status[$key]['status_date'];
|
1275 |
$est_delivery_date = isset( $shipment_status[$key]['est_delivery_date'] ) ? $shipment_status[$key]['est_delivery_date'] : '';
|
1276 |
|
1277 |
+
if ( 'delivered' != $status && 'return_to_sender' != $status && !empty( $est_delivery_date ) ) {
|
1278 |
$has_est_delivery = true;
|
1279 |
+
}
|
1280 |
+
?>
|
1281 |
<div class="ast-shipment-status-div">
|
1282 |
+
<span class="open_tracking_details ast-shipment-status shipment-<?php echo esc_html( $status ); ?>" data-orderid="<?php echo esc_html( $order_id ); ?>" data-tracking_id="<?php echo esc_html( $tracking_id ); ?>">
|
1283 |
+
<?php echo esc_html( apply_filters( 'trackship_status_icon_filter', '', $status ) ); ?> <strong><?php echo esc_html( apply_filters( 'trackship_status_filter', $status ) ); ?></strong>
|
1284 |
</span>
|
1285 |
<?php if ( '' != $status_date ) { ?>
|
1286 |
+
<span class="">on <?php echo esc_html( gmdate( $date_format, strtotime( $status_date ) ) ); ?></span>
|
1287 |
<?php } ?>
|
1288 |
<br>
|
1289 |
<?php if ( $has_est_delivery ) { ?>
|
1290 |
+
<span class="wcast-shipment-est-delivery ft11">Est. Delivery(<?php echo esc_html( gmdate( $date_format, strtotime( $est_delivery_date ) ) ); ?>)</span>
|
1291 |
<?php } ?>
|
1292 |
</div>
|
1293 |
+
<?php
|
1294 |
}
|
1295 |
}
|
1296 |
}
|
1303 |
public function delete_tracking_number_from_trackship( $tracking_items, $tracking_id, $order_id ) {
|
1304 |
|
1305 |
foreach ( $tracking_items as $tracking_item ) {
|
1306 |
+
if ( $tracking_item['tracking_id'] == $tracking_id ) {
|
1307 |
$tracking_number = $tracking_item['tracking_number'];
|
1308 |
$tracking_provider = $tracking_item['tracking_provider'];
|
1309 |
+
$api = new WC_Advanced_Shipment_Tracking_Api_Call();
|
1310 |
$array = $api->delete_tracking_number_from_trackship( $order_id, $tracking_number, $tracking_provider );
|
1311 |
}
|
1312 |
}
|
1315 |
/*
|
1316 |
* fix shipment tracking for deleted tracking
|
1317 |
*/
|
1318 |
+
public function func_fix_shipment_tracking_for_deleted_tracking( $order_id, $key, $item ) {
|
1319 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
1320 |
if ( isset( $shipment_status[ $key ] ) ) {
|
1321 |
unset($shipment_status[$key]);
|
1323 |
}
|
1324 |
|
1325 |
$ts_shipment_status = get_post_meta( $order_id, 'ts_shipment_status', true );
|
1326 |
+
if ( isset( $ts_shipment_status[ $key ] ) ) {
|
1327 |
unset( $ts_shipment_status[$key] );
|
1328 |
update_post_meta( $order_id, 'ts_shipment_status', $ts_shipment_status );
|
1329 |
}
|
1330 |
}
|
1331 |
|
1332 |
/**
|
1333 |
+
* Code for check if tracking number in order is delivered or not
|
1334 |
*/
|
1335 |
public function check_tracking_delivered( $order_id ) {
|
1336 |
|
1338 |
$shipment_status = get_post_meta( $order_id, 'shipment_status', true );
|
1339 |
$wc_ast_status_delivered = get_option( 'wc_ast_status_delivered' );
|
1340 |
|
1341 |
+
foreach ( (array) $shipment_status as $shipment ) {
|
1342 |
$status = $shipment['status'];
|
1343 |
+
if ( 'delivered' != $status ) {
|
1344 |
$delivered = false;
|
1345 |
}
|
1346 |
}
|
1347 |
|
1348 |
+
if ( count( $shipment_status ) > 0 && true == $delivered && $wc_ast_status_delivered ) {
|
1349 |
|
1350 |
$order = wc_get_order( $order_id );
|
1351 |
$order_status = $order->get_status();
|
1352 |
|
1353 |
$change_to_delivered = apply_filters( 'ts_change_order_to_delivered', false, $order_status );
|
1354 |
|
1355 |
+
if ( 'completed' == $order_status || 'updated-tracking' == $order_status || 'shipped' == $order_status ) {
|
1356 |
$change_to_delivered = true;
|
1357 |
}
|
1358 |
|
1363 |
}
|
1364 |
|
1365 |
/**
|
1366 |
+
* Code for trigger shipment status email
|
1367 |
*/
|
1368 |
public function trigger_tracking_email( $order_id, $old_status, $new_status, $tracking_item, $shipment_status ) {
|
1369 |
$order = wc_get_order( $order_id );
|
1370 |
require_once( 'email-manager.php' );
|
1371 |
|
1372 |
if ( $old_status != $new_status ) {
|
1373 |
+
if ( 'delivered' == $new_status ) {
|
1374 |
wc_trackship_email_manager()->delivered_shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status );
|
1375 |
+
} elseif ( 'exception' == $new_status || 'failure' == $new_status || 'in_transit' == $new_status || 'on_hold' == $new_status || 'out_for_delivery' == $new_status || 'available_for_pickup' == $new_status || 'return_to_sender' == $new_status ) {
|
1376 |
wc_trackship_email_manager()->shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status );
|
1377 |
}
|
1378 |
+
do_action( 'ast_trigger_ts_status_change', $order_id, $old_status, $new_status, $tracking_item, $shipment_status );
|
1379 |
}
|
1380 |
}
|
1381 |
|
1383 |
* Add a new dashboard widget.
|
1384 |
*/
|
1385 |
public function ast_add_dashboard_widgets() {
|
1386 |
+
wp_enqueue_style( 'trackship_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/trackship.css', array(), wc_advanced_shipment_tracking()->version );
|
1387 |
wp_add_dashboard_widget( 'trackship_dashboard_widget', 'TrackShip Analytics <small>(last 30 days)</small>', array( $this, 'dashboard_widget_function' ) );
|
1388 |
}
|
1389 |
|
1402 |
</div>
|
1403 |
<div class="ts-widget__section ts-widget-bborder">
|
1404 |
<h3><?php esc_html_e( 'Avg Shipment Length', 'woo-advanced-shipment-tracking' ); ?></h3>
|
1405 |
+
<span class="ts-widget-analytics-number"><?php esc_html_e( round( (int) $tracking_analytics['avg_shipment_length'] ) ); ?></span>
|
1406 |
<span><?php esc_html_e( 'days', 'woo-advanced-shipment-tracking' ); ?></span>
|
1407 |
</div>
|
1408 |
</div>
|
1417 |
</div>
|
1418 |
</div>
|
1419 |
<div class="ts-widget-footer">
|
1420 |
+
<a class="" href="https://trackship.info/my-account/analytics/" target="blank"><?php esc_html_e( 'View Tracking Analytics', 'woo-advanced-shipment-tracking' ); ?></a>
|
1421 |
+
<a class="ts_link" href="https://trackship.info" title="TrackShip" target="blank"><img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/trackship-logo.png"></a>
|
1422 |
</div>
|
1423 |
</div>
|
1424 |
<?php
|
1431 |
global $wpdb;
|
1432 |
$paid_order_statuses = array( 'completed', 'delivered', 'shipped' );
|
1433 |
|
1434 |
+
$end_date = gmdate( 'Y-m-d', strtotime( 'today - 30 days' ) );
|
1435 |
+
$start_date = gmdate( 'Y-m-d' );
|
1436 |
|
1437 |
global $wpdb;
|
1438 |
$paid_order_statuses = array('completed','delivered','shipped');
|
1453 |
AND shipment_tracking_items.meta_key IN ( '_wc_shipment_tracking_items')
|
1454 |
AND shipment_tracking_items.meta_key IS NOT NULL
|
1455 |
AND shipment_status.meta_key IN ( 'shipment_status')
|
1456 |
+
AND post_date < '" . $start_date . "'
|
1457 |
+
AND post_date > '" . $end_date . "'
|
1458 |
|
1459 |
ORDER BY
|
1460 |
posts.ID DESC
|
1499 |
$status = isset( $val['status'] ) ? $val['status'] : '';
|
1500 |
|
1501 |
if ( 'delivered' != $status ) {
|
1502 |
+
$last_date = gmdate( 'Y-m-d H:i:s' );
|
1503 |
}
|
1504 |
|
1505 |
+
$days = null;
|
1506 |
$days = $this->get_num_of_days( $first_date, $last_date );
|
1507 |
|
1508 |
$avg_shipment_days_array[] = $days;
|
1540 |
$date1 = strtotime($first_date);
|
1541 |
$date2 = strtotime($last_date);
|
1542 |
$diff = abs($date2 - $date1);
|
1543 |
+
return gmdate( 'd', $diff );
|
1544 |
}
|
1545 |
|
1546 |
public function get_average( $array ) {
|
1623 |
|
1624 |
foreach ( $custom_order_status as $key => $value ) {
|
1625 |
unset( $custom_order_status[ $key ] );
|
1626 |
+
$key = str_replace( 'wc-', '', $key );
|
1627 |
$custom_order_status[] = $key;
|
1628 |
}
|
1629 |
|
1630 |
+
if ( 'updated-tracking' == $order_status || 'completed' == $order_status || 'shipped' == $order_status || in_array( $order_status, $custom_order_status ) ) {
|
1631 |
return true;
|
1632 |
} else {
|
1633 |
return false;
|
1634 |
}
|
1635 |
return $value;
|
1636 |
}
|
1637 |
+
}
|
includes/class-wc-advanced-shipment-tracking.php
CHANGED
@@ -23,7 +23,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
23 |
if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
|
24 |
$main_blog_prefix = $wpdb->get_blog_prefix( BLOG_ID_CURRENT_SITE );
|
25 |
$this->table = $main_blog_prefix . 'woo_shippment_provider';
|
26 |
-
} else{
|
27 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
28 |
}
|
29 |
} else {
|
@@ -122,7 +122,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
122 |
*/
|
123 |
public function admin_styles() {
|
124 |
$plugin_url = wc_shipment_tracking()->plugin_url;
|
125 |
-
wp_enqueue_style( 'ast_styles', $plugin_url . '/assets/css/admin.css' );
|
126 |
}
|
127 |
|
128 |
/**
|
@@ -149,7 +149,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
149 |
public function render_shop_order_columns( $column ) {
|
150 |
global $post;
|
151 |
if ( 'woocommerce-advanced-shipment-tracking' === $column ) {
|
152 |
-
echo $this->get_shipment_tracking_column( $post->ID );
|
153 |
}
|
154 |
}
|
155 |
|
@@ -174,7 +174,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
174 |
global $wpdb;
|
175 |
|
176 |
$tracking_provider = isset( $tracking_item['tracking_provider'] ) ? $tracking_item['tracking_provider'] : $tracking_item['custom_tracking_provider'];
|
177 |
-
$tracking_provider = apply_filters('convert_provider_name_to_slug'
|
178 |
|
179 |
$results = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table WHERE ts_slug = %s", $tracking_provider ) );
|
180 |
|
@@ -182,9 +182,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
182 |
|
183 |
$formatted = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
184 |
|
185 |
-
if( $formatted['ast_tracking_link'] ) {
|
186 |
printf(
|
187 |
-
'<li id="tracking-item-%s" class="tracking-item-%s"><div><b>%s</b></div><a href="%s" target="_blank" class=ft11>%s</a><a class="inline_tracking_delete" rel="%s" data-order="%s"
|
188 |
esc_attr( $tracking_item['tracking_id'] ),
|
189 |
esc_attr( $tracking_item['tracking_id'] ),
|
190 |
esc_html( $provider_name ),
|
@@ -195,7 +195,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
195 |
);
|
196 |
} else {
|
197 |
printf(
|
198 |
-
'<li id="tracking-item-%s" class="tracking-item-%s"><div><b>%s</b></div>%s<a class="inline_tracking_delete" rel="%s" data-order="%s"
|
199 |
esc_attr( $tracking_item['tracking_id'] ),
|
200 |
esc_attr( $tracking_item['tracking_id'] ),
|
201 |
esc_html( $provider_name ),
|
@@ -224,36 +224,38 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
224 |
*/
|
225 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
<?php
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
<?php /* translators: 1: shipping date */ ?>
|
253 |
-
<?php echo esc_html( sprintf( __( 'Shipped on %s', 'woo-advanced-shipment-tracking' ), date_i18n( get_option( 'date_format' ), $item['date_shipped'] ) ) ); ?>
|
254 |
-
<a href="#" class="delete-tracking" rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
255 |
-
</p>
|
256 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
<?php
|
258 |
}
|
259 |
|
@@ -284,8 +286,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
284 |
if ( 1 == $wc_ast_default_mark_shipped ) {
|
285 |
if ( $wc_ast_status_partial_shipped ) {
|
286 |
$cbvalue = 'change_order_to_shipped';
|
287 |
-
} else
|
288 |
-
{
|
289 |
$cbvalue = 1;
|
290 |
}
|
291 |
}
|
@@ -301,11 +302,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
301 |
}
|
302 |
|
303 |
echo '<div id="tracking-items">';
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
}
|
308 |
}
|
|
|
309 |
echo '</div>';
|
310 |
|
311 |
do_action( 'ast_add_tracking_btn' );
|
@@ -313,28 +314,28 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
313 |
echo '<div id="advanced-shipment-tracking-form">';
|
314 |
?>
|
315 |
<p class="form-field tracking_number_field ">
|
316 |
-
<label for="tracking_number"><?php
|
317 |
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
|
318 |
</p>
|
319 |
<?php
|
320 |
-
echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' .
|
321 |
|
322 |
-
echo '<option value="">'.
|
323 |
|
324 |
-
foreach($shippment_countries as $s_c){
|
325 |
-
if($s_c->shipping_country
|
326 |
$country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
|
327 |
-
} else{
|
328 |
$country_name = 'Global';
|
329 |
}
|
330 |
-
echo '<optgroup label="' . $country_name . '">';
|
331 |
$country = $s_c->shipping_country;
|
332 |
$shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_country = '$country' AND display_in_order = 1" );
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
echo '</optgroup>';
|
339 |
}
|
340 |
|
@@ -375,23 +376,23 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
375 |
do_action( 'ast_after_tracking_field', $post->ID);
|
376 |
do_action( 'ast_tracking_form_between_form', $post->ID, 'single_order' );
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
|
386 |
-
echo '<p class="preview_tracking_link">' .
|
387 |
|
388 |
echo '</div>';
|
389 |
|
390 |
$provider_array = array();
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
|
396 |
$js = "
|
397 |
jQuery( 'p.custom_tracking_link_field, p.custom_tracking_provider_field ').hide();
|
@@ -434,15 +435,15 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
434 |
|
435 |
} ).change();";
|
436 |
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
|
443 |
-
wp_enqueue_style( 'ast_styles',
|
444 |
-
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js' );
|
445 |
-
|
446 |
<script>
|
447 |
jQuery(document).on("change", "#tracking_provider", function(){
|
448 |
var selected_provider = jQuery(this).val();
|
@@ -492,17 +493,18 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
492 |
<ul class="wc-radios">
|
493 |
<?php
|
494 |
foreach ( $order_status_array as $value => $data ) {
|
495 |
-
if ( isset( $data['show'] ) && $data['show']
|
|
|
496 |
?>
|
497 |
<li>
|
498 |
<label>
|
499 |
-
<input name="<?php esc_html_e( $data['name'] ); ?>" value="<?php esc_html_e( $value ); ?>" type="checkbox" class="select short mark_shipped_checkbox" <?php
|
500 |
</label>
|
501 |
</li>
|
502 |
<?php
|
503 |
}
|
504 |
-
}
|
505 |
-
?>
|
506 |
</ul>
|
507 |
</fieldset>
|
508 |
<?php
|
@@ -512,7 +514,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
512 |
* Function for add tracking button in order details page
|
513 |
*/
|
514 |
public function ast_add_tracking_btn() {
|
515 |
-
echo '<button class="button button-primary btn_ast2 btn_full button-show-tracking-form" type="button">' .
|
516 |
}
|
517 |
|
518 |
/**
|
@@ -524,7 +526,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
524 |
|
525 |
check_ajax_referer( 'get-tracking-item', 'security', true );
|
526 |
|
527 |
-
$order_id = wc_clean( $_POST['order_id'] );
|
528 |
$tracking_items = $this->get_tracking_items( $order_id );
|
529 |
|
530 |
foreach ( $tracking_items as $tracking_item ) {
|
@@ -558,15 +560,15 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
558 |
|
559 |
$custom_thumb_id = $results->custom_thumb_id;
|
560 |
|
561 |
-
if (
|
562 |
-
$src = $ast_directory . '' . sanitize_title( $results->provider_name ) . '.png?v=' . wc_advanced_shipment_tracking()->version;
|
563 |
-
} else {
|
564 |
-
$image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
|
565 |
if ( $image_attributes[0] ) {
|
566 |
-
$src = $image_attributes[0];
|
567 |
-
} else {
|
568 |
-
$src = wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/images/icon-default.png';
|
569 |
}
|
|
|
|
|
570 |
}
|
571 |
} else {
|
572 |
$src = wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/images/icon-default.png';
|
@@ -580,16 +582,28 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
580 |
* Function for saving tracking items
|
581 |
*/
|
582 |
public function save_meta_box( $post_id, $post ) {
|
583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
$tracking_product_code = isset( $_POST['tracking_product_code'] ) ? $_POST['tracking_product_code'] : '';
|
|
|
|
|
|
|
586 |
$order = new WC_Order($post_id);
|
587 |
|
588 |
$args = array(
|
589 |
-
'tracking_provider' =>
|
590 |
-
'tracking_number' =>
|
591 |
-
'tracking_product_code' =>
|
592 |
-
'date_shipped' =>
|
593 |
);
|
594 |
|
595 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $post_id );
|
@@ -603,6 +617,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
603 |
} else {
|
604 |
$args['status_shipped'] = 0;
|
605 |
}
|
|
|
606 |
$this->add_tracking_item( $post_id, $args );
|
607 |
}
|
608 |
}
|
@@ -616,26 +631,31 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
616 |
|
617 |
check_ajax_referer( 'create-tracking-item', 'security', true );
|
618 |
|
619 |
-
$
|
|
|
|
|
620 |
|
621 |
-
if (
|
622 |
|
623 |
-
$order_id = wc_clean( $_POST['order_id'] );
|
624 |
$order = new WC_Order( $order_id );
|
625 |
-
$tracking_product_code = isset( $_POST['tracking_product_code'] ) ? $_POST['tracking_product_code'] : '';
|
|
|
626 |
|
627 |
$args = array(
|
628 |
-
'tracking_provider' =>
|
629 |
-
'tracking_number' =>
|
630 |
-
'tracking_product_code' =>
|
631 |
-
'date_shipped' =>
|
632 |
);
|
633 |
|
634 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $order_id );
|
635 |
|
636 |
-
|
|
|
|
|
637 |
$args['status_shipped'] = 1;
|
638 |
-
} elseif ( 'change_order_to_partial_shipped' == $
|
639 |
$args['status_shipped'] = 2;
|
640 |
}
|
641 |
|
@@ -643,7 +663,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
643 |
|
644 |
do_action( 'ast_save_tracking_details_end', $order_id, $_POST );
|
645 |
|
646 |
-
if( isset( $_POST['productlist'] ) && !empty( $_POST['productlist'] ) && $_POST['productlist']
|
647 |
echo 'reload';
|
648 |
die();
|
649 |
}
|
@@ -663,22 +683,25 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
663 |
|
664 |
check_ajax_referer( 'wc_ast_inline_tracking_form', 'wc_ast_inline_tracking_form_nonce' );
|
665 |
|
666 |
-
|
667 |
-
|
668 |
-
|
|
|
669 |
|
670 |
-
$
|
|
|
|
|
671 |
|
672 |
$args = array(
|
673 |
-
'tracking_provider' =>
|
674 |
-
'tracking_number' =>
|
675 |
-
'tracking_product_code' =>
|
676 |
-
'date_shipped' =>
|
677 |
);
|
678 |
|
679 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $order_id );
|
680 |
|
681 |
-
$change_order_to_shipped = isset( $_POST[ 'change_order_to_shipped' ] ) ? $_POST[ 'change_order_to_shipped' ] : '';
|
682 |
|
683 |
if ( 'change_order_to_shipped' == $change_order_to_shipped || 'yes' == $change_order_to_shipped ) {
|
684 |
$args['status_shipped'] = 1;
|
@@ -700,20 +723,22 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
700 |
|
701 |
check_ajax_referer( 'delete-tracking-item', 'security' );
|
702 |
|
703 |
-
$order_id = wc_clean( $_POST['order_id'] );
|
704 |
-
$tracking_id = wc_clean( $_POST['tracking_id'] );
|
705 |
$tracking_items = $this->get_tracking_items( $order_id, true );
|
706 |
|
707 |
do_action( 'delete_tracking_number_from_trackship', $tracking_items, $tracking_id, $order_id );
|
708 |
|
709 |
foreach ( $tracking_items as $tracking_item ) {
|
710 |
-
if ( $tracking_item['tracking_id'] == $
|
|
|
711 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
712 |
$tracking_number = $tracking_item['tracking_number'];
|
713 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
714 |
$order = wc_get_order( $order_id );
|
715 |
-
|
716 |
-
|
|
|
717 |
|
718 |
// Add the note
|
719 |
$order->add_order_note( $note );
|
@@ -732,7 +757,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
732 |
wp_enqueue_script( 'jquery-blockui' );
|
733 |
wp_enqueue_script( 'front-js' );
|
734 |
|
735 |
-
$local_template = get_stylesheet_directory().'/woocommerce/myaccount/tracking-info.php';
|
736 |
|
737 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
738 |
wc_get_template( 'myaccount/tracking-info.php', array( 'tracking_items' => $this->get_tracking_items( $order_id, true ), 'order_id' => $order_id ), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
@@ -797,7 +822,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
797 |
}
|
798 |
|
799 |
if ( 1 == $open_track_in_new_tab ) {
|
800 |
-
|
801 |
<script>
|
802 |
jQuery( document ).ready(function() {
|
803 |
jQuery('.ast_track').attr("target","_blank");
|
@@ -845,11 +870,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
845 |
'tracking_provider' => 'usps',
|
846 |
'custom_tracking_provider' => '',
|
847 |
'formatted_tracking_provider' => 'USPS',
|
848 |
-
'tracking_provider_image' => $ast_directory.'usps.png',
|
849 |
'formatted_tracking_link' => 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=112123113',
|
850 |
'ast_tracking_link' => 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=112123113',
|
851 |
'tracking_number' => '112123113',
|
852 |
-
'date_shipped' => strtotime(
|
853 |
);
|
854 |
|
855 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
@@ -959,13 +984,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
959 |
}
|
960 |
|
961 |
if ( $link_format ) {
|
962 |
-
$searchVal = array(
|
963 |
$tracking_number = str_replace( ' ', '', $tracking_item['tracking_number'] );
|
964 |
$replaceVal = array( $tracking_number, urlencode( $postcode ) );
|
965 |
$link_format = str_replace( $searchVal, $replaceVal, $link_format );
|
966 |
|
967 |
if ( isset( $tracking_item[ 'tracking_product_code' ] ) ) {
|
968 |
-
$searchnumber2 = array(
|
969 |
$tracking_product_code = str_replace(' ', '', $tracking_item['tracking_product_code']);
|
970 |
$link_format = str_replace( $searchnumber2, $tracking_product_code, $link_format );
|
971 |
}
|
@@ -1124,11 +1149,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1124 |
$tracking_item['tracking_product_code'] = isset( $args['tracking_product_code'] ) ? wc_clean( $args['tracking_product_code'] ) : '';
|
1125 |
|
1126 |
if ( isset( $args['date_shipped'] ) ) {
|
1127 |
-
$date = str_replace(
|
1128 |
$date = date_create( $date );
|
1129 |
|
1130 |
if ( isset($args['source']) && 'REST_API' == $args['source'] ) {
|
1131 |
-
$wc_ast_api_date_format = get_option( 'wc_ast_api_date_format','d-m-Y' );
|
1132 |
$date = date_format( $date, $wc_ast_api_date_format );
|
1133 |
} else {
|
1134 |
$date = date_format( $date, 'd-m-Y' );
|
@@ -1168,8 +1193,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1168 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1169 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1170 |
|
1171 |
-
|
1172 |
-
$note = sprintf( __(
|
1173 |
|
1174 |
// Add the note
|
1175 |
$order->add_order_note( $note );
|
@@ -1212,9 +1237,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1212 |
}
|
1213 |
|
1214 |
if ( $args['date_shipped'] ) {
|
1215 |
-
$date = str_replace(
|
1216 |
$date = date_create($date);
|
1217 |
-
$date = date_format($date,
|
1218 |
|
1219 |
$tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
|
1220 |
}
|
@@ -1235,7 +1260,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1235 |
if ( $tracking_item['tracking_provider'] ) {
|
1236 |
$this->save_tracking_items( $order_id, $tracking_items );
|
1237 |
|
1238 |
-
$status_shipped = ( isset( $tracking_item['status_shipped'] ) ? $tracking_item['status_shipped'] :
|
1239 |
|
1240 |
$order = new WC_Order( $order_id );
|
1241 |
|
@@ -1244,8 +1269,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1244 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1245 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1246 |
|
1247 |
-
|
1248 |
-
$note = sprintf( __( 'Order was shipped with %s and tracking number is: %s', 'woo-advanced-shipment-tracking' ), $tracking_provider, $tracking_item['tracking_number'] );
|
1249 |
|
1250 |
// Add the note
|
1251 |
$order->add_order_note( $note );
|
@@ -1346,9 +1371,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1346 |
}
|
1347 |
|
1348 |
/**
|
1349 |
-
*
|
1350 |
*/
|
1351 |
-
public function custom_validation_js(){
|
1352 |
?>
|
1353 |
<script>
|
1354 |
jQuery(document).on("click",".button-save-form",function(e){
|
@@ -1380,7 +1405,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1380 |
}
|
1381 |
});
|
1382 |
</script>
|
1383 |
-
<?php
|
|
|
1384 |
|
1385 |
/*
|
1386 |
* Get formated order id
|
@@ -1442,7 +1468,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1442 |
);
|
1443 |
|
1444 |
$posts = get_posts( $query_args );
|
1445 |
-
if( !empty( $posts ) ) {
|
1446 |
list( $order_id ) = $posts;
|
1447 |
}
|
1448 |
}
|
@@ -1556,7 +1582,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1556 |
);
|
1557 |
|
1558 |
$posts = get_posts( $query_args );
|
1559 |
-
if( !empty( $posts ) ) {
|
1560 |
list( $order_id ) = $posts;
|
1561 |
}
|
1562 |
}
|
@@ -1567,7 +1593,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1567 |
/*
|
1568 |
* Return option value for customizer
|
1569 |
*/
|
1570 |
-
public function get_option_value_from_array( $array, $key, $default_value ){
|
1571 |
|
1572 |
$array_data = get_option( $array );
|
1573 |
$value = '';
|
@@ -1611,7 +1637,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1611 |
*/
|
1612 |
public function tracking_info_template( $order_id, $tracking_items, $shipment_status = '' ) {
|
1613 |
|
1614 |
-
$local_template = get_stylesheet_directory().'/woocommerce/emails/tracking-info.php';
|
1615 |
|
1616 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
1617 |
return wc_get_template_html( 'emails/tracking-info.php', array(
|
@@ -1665,4 +1691,4 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1665 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
1666 |
);
|
1667 |
}
|
1668 |
-
}
|
23 |
if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
|
24 |
$main_blog_prefix = $wpdb->get_blog_prefix( BLOG_ID_CURRENT_SITE );
|
25 |
$this->table = $main_blog_prefix . 'woo_shippment_provider';
|
26 |
+
} else {
|
27 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
28 |
}
|
29 |
} else {
|
122 |
*/
|
123 |
public function admin_styles() {
|
124 |
$plugin_url = wc_shipment_tracking()->plugin_url;
|
125 |
+
wp_enqueue_style( 'ast_styles', $plugin_url . '/assets/css/admin.css', array(), wc_shipment_tracking()->version );
|
126 |
}
|
127 |
|
128 |
/**
|
149 |
public function render_shop_order_columns( $column ) {
|
150 |
global $post;
|
151 |
if ( 'woocommerce-advanced-shipment-tracking' === $column ) {
|
152 |
+
echo wp_kses_post( $this->get_shipment_tracking_column( $post->ID ) );
|
153 |
}
|
154 |
}
|
155 |
|
174 |
global $wpdb;
|
175 |
|
176 |
$tracking_provider = isset( $tracking_item['tracking_provider'] ) ? $tracking_item['tracking_provider'] : $tracking_item['custom_tracking_provider'];
|
177 |
+
$tracking_provider = apply_filters( 'convert_provider_name_to_slug', $tracking_provider );
|
178 |
|
179 |
$results = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table WHERE ts_slug = %s", $tracking_provider ) );
|
180 |
|
182 |
|
183 |
$formatted = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
184 |
|
185 |
+
if ( $formatted['ast_tracking_link'] ) {
|
186 |
printf(
|
187 |
+
'<li id="tracking-item-%s" class="tracking-item-%s"><div><b>%s</b></div><a href="%s" target="_blank" class=ft11>%s</a><a class="inline_tracking_delete" rel="%s" data-order="%s" data-nonce="' . esc_html( wp_create_nonce( 'delete-tracking-item' ) ) . '"><span class="dashicons dashicons-trash"></span></a></li>',
|
188 |
esc_attr( $tracking_item['tracking_id'] ),
|
189 |
esc_attr( $tracking_item['tracking_id'] ),
|
190 |
esc_html( $provider_name ),
|
195 |
);
|
196 |
} else {
|
197 |
printf(
|
198 |
+
'<li id="tracking-item-%s" class="tracking-item-%s"><div><b>%s</b></div>%s<a class="inline_tracking_delete" rel="%s" data-order="%s" data-nonce="' . esc_html( wp_create_nonce( 'delete-tracking-item' ) ) . '"><span class="dashicons dashicons-trash"></span></a></li>',
|
199 |
esc_attr( $tracking_item['tracking_id'] ),
|
200 |
esc_attr( $tracking_item['tracking_id'] ),
|
201 |
esc_html( $provider_name ),
|
224 |
*/
|
225 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
226 |
|
227 |
+
global $wpdb;
|
228 |
+
|
229 |
+
$formatted = $this->get_formatted_tracking_item( $order_id, $item );
|
230 |
+
$tracking_provider = isset( $item['tracking_provider'] ) ? $item['tracking_provider'] : $item['custom_tracking_provider'];
|
231 |
+
$tracking_provider = apply_filters( 'convert_provider_name_to_slug', $tracking_provider );
|
232 |
+
$results = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table WHERE ts_slug = %s", $tracking_provider ) );
|
233 |
+
$provider_name = apply_filters( 'get_ast_provider_name', $tracking_provider, $results );
|
234 |
+
?>
|
235 |
+
<div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
|
236 |
+
<div class="tracking-content">
|
237 |
+
<div class="tracking-content-div">
|
238 |
+
<strong><?php echo esc_html( $provider_name ); ?></strong>
|
239 |
+
<?php if ( strlen( $formatted['ast_tracking_link'] ) > 0 ) { ?>
|
240 |
+
-
|
241 |
+
<?php
|
242 |
+
echo sprintf( '<a href="%s" target="_blank" title="' . esc_attr( __( 'Track Shipment', 'woo-advanced-shipment-tracking' ) ) . '">' . esc_html( $item['tracking_number'] ) . '</a>', esc_url( $formatted['ast_tracking_link'] ) );
|
243 |
+
?>
|
244 |
+
<?php } else { ?>
|
245 |
+
<span> - <?php echo esc_html( $item['tracking_number'] ); ?></span>
|
246 |
+
<?php } ?>
|
247 |
+
</div>
|
248 |
+
<?php
|
249 |
+
do_action( 'ast_after_tracking_number', $order_id, $item['tracking_id'] );
|
250 |
+
do_action( 'ast_shipment_tracking_end', $order_id, $item );
|
251 |
+
?>
|
|
|
|
|
|
|
|
|
252 |
</div>
|
253 |
+
<p class="meta">
|
254 |
+
<?php /* translators: 1: shipping date */ ?>
|
255 |
+
<?php echo esc_html( sprintf( __( 'Shipped on %s', 'woo-advanced-shipment-tracking' ), date_i18n( get_option( 'date_format' ), $item['date_shipped'] ) ) ); ?>
|
256 |
+
<a href="#" class="delete-tracking" rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
257 |
+
</p>
|
258 |
+
</div>
|
259 |
<?php
|
260 |
}
|
261 |
|
286 |
if ( 1 == $wc_ast_default_mark_shipped ) {
|
287 |
if ( $wc_ast_status_partial_shipped ) {
|
288 |
$cbvalue = 'change_order_to_shipped';
|
289 |
+
} else {
|
|
|
290 |
$cbvalue = 1;
|
291 |
}
|
292 |
}
|
302 |
}
|
303 |
|
304 |
echo '<div id="tracking-items">';
|
305 |
+
if ( count( $tracking_items ) > 0 ) {
|
306 |
+
foreach ( $tracking_items as $tracking_item ) {
|
307 |
+
$this->display_html_tracking_item_for_meta_box( $post->ID, $tracking_item );
|
|
|
308 |
}
|
309 |
+
}
|
310 |
echo '</div>';
|
311 |
|
312 |
do_action( 'ast_add_tracking_btn' );
|
314 |
echo '<div id="advanced-shipment-tracking-form">';
|
315 |
?>
|
316 |
<p class="form-field tracking_number_field ">
|
317 |
+
<label for="tracking_number"><?php esc_html_e( 'Tracking number:', 'woo-advanced-shipment-tracking' ); ?></label>
|
318 |
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
|
319 |
</p>
|
320 |
<?php
|
321 |
+
echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' . esc_html__( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ) . '</label><br/><select id="tracking_provider" name="tracking_provider" class="chosen_select tracking_provider_dropdown" style="width:100%;">';
|
322 |
|
323 |
+
echo '<option value="">' . esc_html__( 'Select Provider', 'woo-advanced-shipment-tracking' ) . '</option>';
|
324 |
|
325 |
+
foreach ( $shippment_countries as $s_c ) {
|
326 |
+
if ( 'Global' != $s_c->shipping_country ) {
|
327 |
$country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
|
328 |
+
} else {
|
329 |
$country_name = 'Global';
|
330 |
}
|
331 |
+
echo '<optgroup label="' . esc_html( $country_name ) . '">';
|
332 |
$country = $s_c->shipping_country;
|
333 |
$shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_country = '$country' AND display_in_order = 1" );
|
334 |
+
foreach ( $shippment_providers_by_country as $providers ) {
|
335 |
+
$providers->ts_slug;
|
336 |
+
$selected = ( esc_attr( $providers->provider_name ) == $default_provider ) ? 'selected' : '';
|
337 |
+
echo '<option value="' . esc_attr( $providers->ts_slug ) . '" ' . esc_html( $selected ) . '>' . esc_html( $providers->provider_name ) . '</option>';
|
338 |
+
}
|
339 |
echo '</optgroup>';
|
340 |
}
|
341 |
|
376 |
do_action( 'ast_after_tracking_field', $post->ID);
|
377 |
do_action( 'ast_tracking_form_between_form', $post->ID, 'single_order' );
|
378 |
|
379 |
+
if ( 'auto-draft' != $order_status ) {
|
380 |
+
wc_advanced_shipment_tracking()->actions->mark_order_as_fields_html();
|
381 |
+
}
|
382 |
|
383 |
+
if ( 'auto-draft' != $order_status ) {
|
384 |
+
echo '<button class="button button-primary btn_ast2 button-save-form">' . esc_html__( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
|
385 |
+
}
|
386 |
|
387 |
+
echo '<p class="preview_tracking_link">' . esc_html__( 'Preview:', 'woo-advanced-shipment-tracking' ) . ' <a href="" target="_blank">' . esc_html__( 'Track Shipment', 'woo-advanced-shipment-tracking' ) . '</a></p>';
|
388 |
|
389 |
echo '</div>';
|
390 |
|
391 |
$provider_array = array();
|
392 |
|
393 |
+
foreach ( $shippment_providers as $provider ) {
|
394 |
+
$provider_array[ sanitize_title( $provider->provider_name ) ] = urlencode( $provider->provider_url );
|
395 |
+
}
|
396 |
|
397 |
$js = "
|
398 |
jQuery( 'p.custom_tracking_link_field, p.custom_tracking_provider_field ').hide();
|
435 |
|
436 |
} ).change();";
|
437 |
|
438 |
+
if ( function_exists( 'wc_enqueue_js' ) ) {
|
439 |
+
wc_enqueue_js( $js );
|
440 |
+
} else {
|
441 |
+
WC()->add_inline_js( $js );
|
442 |
+
}
|
443 |
|
444 |
+
wp_enqueue_style( 'ast_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/admin.css', array(), wc_advanced_shipment_tracking()->version );
|
445 |
+
wp_enqueue_script( 'woocommerce-advanced-shipment-tracking-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/admin.js', array( 'jquery' ), wc_advanced_shipment_tracking()->version, true );
|
446 |
+
?>
|
447 |
<script>
|
448 |
jQuery(document).on("change", "#tracking_provider", function(){
|
449 |
var selected_provider = jQuery(this).val();
|
493 |
<ul class="wc-radios">
|
494 |
<?php
|
495 |
foreach ( $order_status_array as $value => $data ) {
|
496 |
+
if ( isset( $data['show'] ) && true == $data['show'] ) {
|
497 |
+
$checked = $data['checked'] ? 'checked' : '';
|
498 |
?>
|
499 |
<li>
|
500 |
<label>
|
501 |
+
<input name="<?php esc_html_e( $data['name'] ); ?>" value="<?php esc_html_e( $value ); ?>" type="checkbox" class="select short mark_shipped_checkbox" <?php esc_html_e( $checked ); ?>><?php esc_html_e( $data['label'] ); ?>
|
502 |
</label>
|
503 |
</li>
|
504 |
<?php
|
505 |
}
|
506 |
+
}
|
507 |
+
?>
|
508 |
</ul>
|
509 |
</fieldset>
|
510 |
<?php
|
514 |
* Function for add tracking button in order details page
|
515 |
*/
|
516 |
public function ast_add_tracking_btn() {
|
517 |
+
echo '<button class="button button-primary btn_ast2 btn_full button-show-tracking-form" type="button">' . esc_html__( 'Add Tracking Info', 'woo-advanced-shipment-tracking' ) . '</button>';
|
518 |
}
|
519 |
|
520 |
/**
|
526 |
|
527 |
check_ajax_referer( 'get-tracking-item', 'security', true );
|
528 |
|
529 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
530 |
$tracking_items = $this->get_tracking_items( $order_id );
|
531 |
|
532 |
foreach ( $tracking_items as $tracking_item ) {
|
560 |
|
561 |
$custom_thumb_id = $results->custom_thumb_id;
|
562 |
|
563 |
+
if ( 0 == (int) $custom_thumb_id && 1 == (int) $results->shipping_default ) {
|
564 |
+
$src = $ast_directory . '' . sanitize_title( $results->provider_name ) . '.png?v=' . wc_advanced_shipment_tracking()->version;
|
565 |
+
} else if ( 0 != (int) $custom_thumb_id ) {
|
566 |
+
$image_attributes = wp_get_attachment_image_src( (int) $custom_thumb_id , array( '60', '60' ) );
|
567 |
if ( $image_attributes[0] ) {
|
568 |
+
$src = $image_attributes[0];
|
|
|
|
|
569 |
}
|
570 |
+
} else {
|
571 |
+
$src = wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/images/icon-default.png';
|
572 |
}
|
573 |
} else {
|
574 |
$src = wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/images/icon-default.png';
|
582 |
* Function for saving tracking items
|
583 |
*/
|
584 |
public function save_meta_box( $post_id, $post ) {
|
585 |
+
|
586 |
+
// Check the nonce.
|
587 |
+
if ( empty( $_POST['woocommerce_meta_nonce'] ) || ! wp_verify_nonce( wp_unslash( wc_clean( $_POST['woocommerce_meta_nonce'] ) ), 'woocommerce_save_data' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
588 |
+
return;
|
589 |
+
}
|
590 |
+
|
591 |
+
$tracking_provider = isset( $_POST['tracking_provider'] ) ? wc_clean( $_POST['tracking_provider'] ) : '';
|
592 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
593 |
+
|
594 |
+
if ( strlen( $tracking_number ) > 0 && '' != $tracking_provider ) {
|
595 |
|
596 |
+
$tracking_product_code = isset( $_POST['tracking_product_code'] ) ? wc_clean( $_POST['tracking_product_code'] ) : '';
|
597 |
+
$date_shipped = isset( $_POST['date_shipped'] ) ? wc_clean( $_POST['date_shipped'] ) : '';
|
598 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
599 |
+
$tracking_provider = isset( $_POST['tracking_provider'] ) ? wc_clean( $_POST['tracking_provider'] ) : '';
|
600 |
$order = new WC_Order($post_id);
|
601 |
|
602 |
$args = array(
|
603 |
+
'tracking_provider' => $tracking_provider,
|
604 |
+
'tracking_number' => $tracking_number,
|
605 |
+
'tracking_product_code' => $tracking_product_code,
|
606 |
+
'date_shipped' => $date_shipped,
|
607 |
);
|
608 |
|
609 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $post_id );
|
617 |
} else {
|
618 |
$args['status_shipped'] = 0;
|
619 |
}
|
620 |
+
|
621 |
$this->add_tracking_item( $post_id, $args );
|
622 |
}
|
623 |
}
|
631 |
|
632 |
check_ajax_referer( 'create-tracking-item', 'security', true );
|
633 |
|
634 |
+
$tracking_provider = isset( $_POST['tracking_provider'] ) ? wc_clean( $_POST['tracking_provider'] ) : '';
|
635 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
636 |
+
$tracking_number = str_replace( ' ', '', $tracking_number );
|
637 |
|
638 |
+
if ( strlen( $tracking_number ) > 0 && '' != $tracking_provider ) {
|
639 |
|
640 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
641 |
$order = new WC_Order( $order_id );
|
642 |
+
$tracking_product_code = isset( $_POST['tracking_product_code'] ) ? wc_clean( $_POST['tracking_product_code'] ) : '';
|
643 |
+
$date_shipped = isset( $_POST['date_shipped'] ) ? wc_clean( $_POST['date_shipped'] ) : '';
|
644 |
|
645 |
$args = array(
|
646 |
+
'tracking_provider' => $tracking_provider,
|
647 |
+
'tracking_number' => $tracking_number,
|
648 |
+
'tracking_product_code' => $tracking_product_code,
|
649 |
+
'date_shipped' => $date_shipped,
|
650 |
);
|
651 |
|
652 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $order_id );
|
653 |
|
654 |
+
$change_order_to_shipped = isset( $_POST[ 'change_order_to_shipped' ] ) ? wc_clean( $_POST[ 'change_order_to_shipped' ] ) : '';
|
655 |
+
|
656 |
+
if ( 'change_order_to_shipped' == $change_order_to_shipped ) {
|
657 |
$args['status_shipped'] = 1;
|
658 |
+
} elseif ( 'change_order_to_partial_shipped' == $change_order_to_shipped ) {
|
659 |
$args['status_shipped'] = 2;
|
660 |
}
|
661 |
|
663 |
|
664 |
do_action( 'ast_save_tracking_details_end', $order_id, $_POST );
|
665 |
|
666 |
+
if ( isset( $_POST['productlist'] ) && !empty( $_POST['productlist'] ) && '[]' != $_POST['productlist'] ) {
|
667 |
echo 'reload';
|
668 |
die();
|
669 |
}
|
683 |
|
684 |
check_ajax_referer( 'wc_ast_inline_tracking_form', 'wc_ast_inline_tracking_form_nonce' );
|
685 |
|
686 |
+
$tracking_provider = isset( $_POST['tracking_provider'] ) ? wc_clean( $_POST['tracking_provider'] ) : '';
|
687 |
+
$tracking_number = isset( $_POST['tracking_number'] ) ? wc_clean( $_POST['tracking_number'] ) : '';
|
688 |
+
|
689 |
+
if ( strlen( $tracking_number ) > 0 && '' != $tracking_provider ) {
|
690 |
|
691 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
692 |
+
$tracking_product_code = isset( $_POST['tracking_product_code'] ) ? wc_clean( $_POST['tracking_product_code'] ) : '';
|
693 |
+
$date_shipped = isset( $_POST['date_shipped'] ) ? wc_clean( $_POST['date_shipped'] ) : '';
|
694 |
|
695 |
$args = array(
|
696 |
+
'tracking_provider' => $tracking_provider,
|
697 |
+
'tracking_number' => $tracking_number,
|
698 |
+
'tracking_product_code' => $tracking_product_code,
|
699 |
+
'date_shipped' => $date_shipped,
|
700 |
);
|
701 |
|
702 |
$args = apply_filters( 'tracking_info_args', $args, $_POST, $order_id );
|
703 |
|
704 |
+
$change_order_to_shipped = isset( $_POST[ 'change_order_to_shipped' ] ) ? wc_clean( $_POST[ 'change_order_to_shipped' ] ) : '';
|
705 |
|
706 |
if ( 'change_order_to_shipped' == $change_order_to_shipped || 'yes' == $change_order_to_shipped ) {
|
707 |
$args['status_shipped'] = 1;
|
723 |
|
724 |
check_ajax_referer( 'delete-tracking-item', 'security' );
|
725 |
|
726 |
+
$order_id = isset( $_POST['order_id'] ) ? wc_clean( $_POST['order_id'] ) : '';
|
727 |
+
$tracking_id = isset( $_POST['tracking_id'] ) ? wc_clean( $_POST['tracking_id'] ) : '';
|
728 |
$tracking_items = $this->get_tracking_items( $order_id, true );
|
729 |
|
730 |
do_action( 'delete_tracking_number_from_trackship', $tracking_items, $tracking_id, $order_id );
|
731 |
|
732 |
foreach ( $tracking_items as $tracking_item ) {
|
733 |
+
if ( $tracking_item['tracking_id'] == $tracking_id ) {
|
734 |
+
|
735 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
736 |
$tracking_number = $tracking_item['tracking_number'];
|
737 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
738 |
$order = wc_get_order( $order_id );
|
739 |
+
|
740 |
+
/* translators: %1$s: Reaplce with tracking provider, %2$s: Reaplce with tracking number */
|
741 |
+
$note = sprintf( __( 'Tracking info was deleted for tracking provider %1$s with tracking number %2$s', 'woo-advanced-shipment-tracking' ), $tracking_provider, $tracking_number );
|
742 |
|
743 |
// Add the note
|
744 |
$order->add_order_note( $note );
|
757 |
wp_enqueue_script( 'jquery-blockui' );
|
758 |
wp_enqueue_script( 'front-js' );
|
759 |
|
760 |
+
$local_template = get_stylesheet_directory() . '/woocommerce/myaccount/tracking-info.php';
|
761 |
|
762 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
763 |
wc_get_template( 'myaccount/tracking-info.php', array( 'tracking_items' => $this->get_tracking_items( $order_id, true ), 'order_id' => $order_id ), 'woocommerce-advanced-shipment-tracking/', get_stylesheet_directory() . '/woocommerce/' );
|
822 |
}
|
823 |
|
824 |
if ( 1 == $open_track_in_new_tab ) {
|
825 |
+
?>
|
826 |
<script>
|
827 |
jQuery( document ).ready(function() {
|
828 |
jQuery('.ast_track').attr("target","_blank");
|
870 |
'tracking_provider' => 'usps',
|
871 |
'custom_tracking_provider' => '',
|
872 |
'formatted_tracking_provider' => 'USPS',
|
873 |
+
'tracking_provider_image' => $ast_directory . 'usps.png',
|
874 |
'formatted_tracking_link' => 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=112123113',
|
875 |
'ast_tracking_link' => 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=112123113',
|
876 |
'tracking_number' => '112123113',
|
877 |
+
'date_shipped' => strtotime( gmdate( 'Y-m-d' ) ),
|
878 |
);
|
879 |
|
880 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
984 |
}
|
985 |
|
986 |
if ( $link_format ) {
|
987 |
+
$searchVal = array( '%number%', str_replace( ' ', '', '%2 $ s' ) );
|
988 |
$tracking_number = str_replace( ' ', '', $tracking_item['tracking_number'] );
|
989 |
$replaceVal = array( $tracking_number, urlencode( $postcode ) );
|
990 |
$link_format = str_replace( $searchVal, $replaceVal, $link_format );
|
991 |
|
992 |
if ( isset( $tracking_item[ 'tracking_product_code' ] ) ) {
|
993 |
+
$searchnumber2 = array( '%number2%', str_replace(' ', '', '%2 $ s') );
|
994 |
$tracking_product_code = str_replace(' ', '', $tracking_item['tracking_product_code']);
|
995 |
$link_format = str_replace( $searchnumber2, $tracking_product_code, $link_format );
|
996 |
}
|
1149 |
$tracking_item['tracking_product_code'] = isset( $args['tracking_product_code'] ) ? wc_clean( $args['tracking_product_code'] ) : '';
|
1150 |
|
1151 |
if ( isset( $args['date_shipped'] ) ) {
|
1152 |
+
$date = str_replace( '/', '-', $args['date_shipped'] );
|
1153 |
$date = date_create( $date );
|
1154 |
|
1155 |
if ( isset($args['source']) && 'REST_API' == $args['source'] ) {
|
1156 |
+
$wc_ast_api_date_format = get_option( 'wc_ast_api_date_format', 'd-m-Y' );
|
1157 |
$date = date_format( $date, $wc_ast_api_date_format );
|
1158 |
} else {
|
1159 |
$date = date_format( $date, 'd-m-Y' );
|
1193 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1194 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1195 |
|
1196 |
+
/* translators: %1$s: Reaplce with tracking provider, %2$s: Reaplce with tracking number */
|
1197 |
+
$note = sprintf( __( 'Order was shipped with %1$s and tracking number is: %2$s', 'woo-advanced-shipment-tracking' ), $tracking_provider, $tracking_item['tracking_number'] );
|
1198 |
|
1199 |
// Add the note
|
1200 |
$order->add_order_note( $note );
|
1237 |
}
|
1238 |
|
1239 |
if ( $args['date_shipped'] ) {
|
1240 |
+
$date = str_replace( '/', '-', $args['date_shipped'] );
|
1241 |
$date = date_create($date);
|
1242 |
+
$date = date_format( $date, 'd-m-Y' );
|
1243 |
|
1244 |
$tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
|
1245 |
}
|
1260 |
if ( $tracking_item['tracking_provider'] ) {
|
1261 |
$this->save_tracking_items( $order_id, $tracking_items );
|
1262 |
|
1263 |
+
$status_shipped = ( isset( $tracking_item['status_shipped'] ) ? $tracking_item['status_shipped'] : '' );
|
1264 |
|
1265 |
$order = new WC_Order( $order_id );
|
1266 |
|
1269 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1270 |
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1271 |
|
1272 |
+
/* translators: %1$s: Reaplce with tracking provider, %2$s: Reaplce with tracking number */
|
1273 |
+
$note = sprintf( __( 'Order was shipped with %1$s and tracking number is: %2$s', 'woo-advanced-shipment-tracking' ), $tracking_provider, $tracking_item['tracking_number'] );
|
1274 |
|
1275 |
// Add the note
|
1276 |
$order->add_order_note( $note );
|
1371 |
}
|
1372 |
|
1373 |
/**
|
1374 |
+
* Validation code add tracking info form
|
1375 |
*/
|
1376 |
+
public function custom_validation_js() {
|
1377 |
?>
|
1378 |
<script>
|
1379 |
jQuery(document).on("click",".button-save-form",function(e){
|
1405 |
}
|
1406 |
});
|
1407 |
</script>
|
1408 |
+
<?php
|
1409 |
+
}
|
1410 |
|
1411 |
/*
|
1412 |
* Get formated order id
|
1468 |
);
|
1469 |
|
1470 |
$posts = get_posts( $query_args );
|
1471 |
+
if ( !empty( $posts ) ) {
|
1472 |
list( $order_id ) = $posts;
|
1473 |
}
|
1474 |
}
|
1582 |
);
|
1583 |
|
1584 |
$posts = get_posts( $query_args );
|
1585 |
+
if ( !empty( $posts ) ) {
|
1586 |
list( $order_id ) = $posts;
|
1587 |
}
|
1588 |
}
|
1593 |
/*
|
1594 |
* Return option value for customizer
|
1595 |
*/
|
1596 |
+
public function get_option_value_from_array( $array, $key, $default_value ) {
|
1597 |
|
1598 |
$array_data = get_option( $array );
|
1599 |
$value = '';
|
1637 |
*/
|
1638 |
public function tracking_info_template( $order_id, $tracking_items, $shipment_status = '' ) {
|
1639 |
|
1640 |
+
$local_template = get_stylesheet_directory() . '/woocommerce/emails/tracking-info.php';
|
1641 |
|
1642 |
if ( file_exists( $local_template ) && is_writable( $local_template ) ) {
|
1643 |
return wc_get_template_html( 'emails/tracking-info.php', array(
|
1691 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
1692 |
);
|
1693 |
}
|
1694 |
+
}
|
includes/customizer/class-trackship-customizer.php
CHANGED
@@ -15,8 +15,8 @@ class WC_TrackShip_Customizer {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
-
|
20 |
|
21 |
/**
|
22 |
* Register the Customizer sections
|
@@ -29,20 +29,20 @@ class WC_TrackShip_Customizer {
|
|
29 |
$wp_customize->add_section( 'ast_tracking_page_section',
|
30 |
array(
|
31 |
'title' => __( 'Tracking Page Widget', 'woo-advanced-shipment-tracking' ),
|
32 |
-
'description' =>
|
33 |
)
|
34 |
);
|
35 |
|
36 |
$wp_customize->add_section( 'trackship_shipment_status_email',
|
37 |
array(
|
38 |
'title' => __( 'Shipping and Delivery Emails', 'woo-advanced-shipment-tracking' ),
|
39 |
-
'description' =>
|
40 |
)
|
41 |
);
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
-
*
|
46 |
*/
|
47 |
public function enqueue_preview_scripts() {
|
48 |
|
@@ -64,19 +64,21 @@ class WC_TrackShip_Customizer {
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
*
|
68 |
*/
|
69 |
-
public function enqueue_customizer_scripts(){
|
70 |
|
71 |
-
if(isset( $_REQUEST['trackship-customizer'] ) && '1' === $_REQUEST['trackship-customizer']){
|
72 |
wp_enqueue_style( 'wp-color-picker' );
|
73 |
wp_enqueue_style('wcast-customizer-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer-styles.css', array(), wc_advanced_shipment_tracking()->version );
|
74 |
wp_enqueue_script('wcast-customizer-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer-scripts.js', array('jquery', 'customize-controls','wp-color-picker'), wc_advanced_shipment_tracking()->version, true);
|
75 |
|
76 |
-
$shipment_status = ( isset($_REQUEST['shipment_status']) ) ? $_REQUEST['shipment_status'] : 'in_transit';
|
|
|
77 |
|
78 |
// Send variables to Javascript
|
79 |
wp_localize_script('wcast-customizer-scripts', 'wcast_customizer', array(
|
|
|
80 |
'ajax_url' => admin_url('admin-ajax.php'),
|
81 |
'shipment_status' => $shipment_status,
|
82 |
'tracking_preview_url' => $this->get_tracking_preview_url(),
|
@@ -89,7 +91,7 @@ class WC_TrackShip_Customizer {
|
|
89 |
'customer_delivered_preview_url' => $this->get_customer_delivered_preview_url(),
|
90 |
'customer_returntosender_preview_url' => $this->get_customer_returntosender_preview_url(),
|
91 |
'customer_availableforpickup_preview_url' => $this->get_customer_availableforpickup_preview_url(),
|
92 |
-
'trigger_click' => '#accordion-section-'
|
93 |
'customizer_title' => 'TrackShip',
|
94 |
));
|
95 |
|
@@ -138,7 +140,7 @@ class WC_TrackShip_Customizer {
|
|
138 |
* Get Exception Shipment status preview URL
|
139 |
*
|
140 |
*/
|
141 |
-
public function get_customer_exception_preview_url(){
|
142 |
return add_query_arg( array(
|
143 |
'wcast-exception-email-customizer-preview' => '1',
|
144 |
), home_url( '' ) );
|
@@ -205,48 +207,45 @@ class WC_TrackShip_Customizer {
|
|
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 |
-
* Remove unrelated sections
|
230 |
-
*
|
231 |
-
* @access public
|
232 |
-
* @param bool $active
|
233 |
-
* @param object $section
|
234 |
-
* @return bool
|
235 |
-
*/
|
236 |
-
public function remove_unrelated_sections( $active, $section ) {
|
237 |
-
// Check if current section is own section
|
238 |
-
if ( ! $this->is_own_section( $section->id ) ) {
|
239 |
-
return false;
|
240 |
-
}
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
/**
|
247 |
* Check if current component is own component
|
248 |
-
*
|
249 |
-
* @access public
|
250 |
* @param string $component
|
251 |
* @return bool
|
252 |
*/
|
@@ -256,14 +255,13 @@ class WC_TrackShip_Customizer {
|
|
256 |
|
257 |
/**
|
258 |
* Check if current section is own section
|
259 |
-
*
|
260 |
-
* @access public
|
261 |
* @param string $key
|
262 |
* @return bool
|
263 |
*/
|
264 |
public function is_own_section( $key ) {
|
265 |
|
266 |
-
if (
|
267 |
return true;
|
268 |
}
|
269 |
|
@@ -312,4 +310,4 @@ function ts_customizer() {
|
|
312 |
*
|
313 |
* Backward compatibility.
|
314 |
*/
|
315 |
-
ts_customizer();
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
+
}
|
20 |
|
21 |
/**
|
22 |
* Register the Customizer sections
|
29 |
$wp_customize->add_section( 'ast_tracking_page_section',
|
30 |
array(
|
31 |
'title' => __( 'Tracking Page Widget', 'woo-advanced-shipment-tracking' ),
|
32 |
+
'description' => '',
|
33 |
)
|
34 |
);
|
35 |
|
36 |
$wp_customize->add_section( 'trackship_shipment_status_email',
|
37 |
array(
|
38 |
'title' => __( 'Shipping and Delivery Emails', 'woo-advanced-shipment-tracking' ),
|
39 |
+
'description' => '',
|
40 |
)
|
41 |
);
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* Add css and js for preview
|
46 |
*/
|
47 |
public function enqueue_preview_scripts() {
|
48 |
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* Add css and js for customizer
|
68 |
*/
|
69 |
+
public function enqueue_customizer_scripts() {
|
70 |
|
71 |
+
if ( isset( $_REQUEST['trackship-customizer'] ) && '1' === $_REQUEST['trackship-customizer'] ) {
|
72 |
wp_enqueue_style( 'wp-color-picker' );
|
73 |
wp_enqueue_style('wcast-customizer-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer-styles.css', array(), wc_advanced_shipment_tracking()->version );
|
74 |
wp_enqueue_script('wcast-customizer-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer-scripts.js', array('jquery', 'customize-controls','wp-color-picker'), wc_advanced_shipment_tracking()->version, true);
|
75 |
|
76 |
+
$shipment_status = ( isset($_REQUEST['shipment_status']) ) ? wc_clean( $_REQUEST['shipment_status'] ) : 'in_transit';
|
77 |
+
$email = ( isset( $_REQUEST['email'] ) ) ? wc_clean( $_REQUEST['email'] ) : '';
|
78 |
|
79 |
// Send variables to Javascript
|
80 |
wp_localize_script('wcast-customizer-scripts', 'wcast_customizer', array(
|
81 |
+
'customizer_nonce' => wp_create_nonce( 'ast_customizer' ),
|
82 |
'ajax_url' => admin_url('admin-ajax.php'),
|
83 |
'shipment_status' => $shipment_status,
|
84 |
'tracking_preview_url' => $this->get_tracking_preview_url(),
|
91 |
'customer_delivered_preview_url' => $this->get_customer_delivered_preview_url(),
|
92 |
'customer_returntosender_preview_url' => $this->get_customer_returntosender_preview_url(),
|
93 |
'customer_availableforpickup_preview_url' => $this->get_customer_availableforpickup_preview_url(),
|
94 |
+
'trigger_click' => '#accordion-section-' . $email . ' h3',
|
95 |
'customizer_title' => 'TrackShip',
|
96 |
));
|
97 |
|
140 |
* Get Exception Shipment status preview URL
|
141 |
*
|
142 |
*/
|
143 |
+
public function get_customer_exception_preview_url() {
|
144 |
return add_query_arg( array(
|
145 |
'wcast-exception-email-customizer-preview' => '1',
|
146 |
), home_url( '' ) );
|
207 |
}
|
208 |
|
209 |
/**
|
210 |
+
* Remove unrelated components
|
211 |
+
*
|
212 |
+
* @param array $components
|
213 |
+
* @param object $wp_customize
|
214 |
+
* @return array
|
215 |
+
*/
|
216 |
+
public function remove_unrelated_components( $components, $wp_customize ) {
|
217 |
+
// Iterate over components
|
218 |
+
foreach ($components as $component_key => $component) {
|
219 |
+
// Check if current component is own component
|
220 |
+
if ( ! $this->is_own_component( $component ) ) {
|
221 |
+
unset($components[$component_key]);
|
222 |
+
}
|
223 |
+
}
|
|
|
224 |
|
225 |
+
// Return remaining components
|
226 |
+
return $components;
|
227 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
+
/**
|
230 |
+
* Remove unrelated sections
|
231 |
+
*
|
232 |
+
* @param bool $active
|
233 |
+
* @param object $section
|
234 |
+
* @return bool
|
235 |
+
*/
|
236 |
+
public function remove_unrelated_sections( $active, $section ) {
|
237 |
+
// Check if current section is own section
|
238 |
+
if ( ! $this->is_own_section( $section->id ) ) {
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
// We can override $active completely since this runs only on own Customizer requests
|
243 |
+
return true;
|
244 |
+
}
|
245 |
|
246 |
/**
|
247 |
* Check if current component is own component
|
248 |
+
*
|
|
|
249 |
* @param string $component
|
250 |
* @return bool
|
251 |
*/
|
255 |
|
256 |
/**
|
257 |
* Check if current section is own section
|
258 |
+
*
|
|
|
259 |
* @param string $key
|
260 |
* @return bool
|
261 |
*/
|
262 |
public function is_own_section( $key ) {
|
263 |
|
264 |
+
if ( 'trackship_shipment_status_email' === $key || 'ast_tracking_page_section' === $key ) {
|
265 |
return true;
|
266 |
}
|
267 |
|
310 |
*
|
311 |
* Backward compatibility.
|
312 |
*/
|
313 |
+
ts_customizer();
|
includes/customizer/class-wc-availableforpickup-email-customizer.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
/**
|
7 |
* Adds the individual sections, settings, and controls to the theme customizer
|
8 |
*/
|
9 |
-
class
|
10 |
// Get our default values
|
11 |
public function __construct() {
|
12 |
|
@@ -14,13 +14,17 @@ class wcast_availableforpickup_customizer_email {
|
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -47,8 +51,7 @@ class wcast_availableforpickup_customizer_email {
|
|
47 |
|
48 |
/**
|
49 |
* Checks to see if we are opening our custom customizer preview
|
50 |
-
*
|
51 |
-
* @access public
|
52 |
* @return bool
|
53 |
*/
|
54 |
public function is_own_preview_request() {
|
@@ -57,16 +60,15 @@ class wcast_availableforpickup_customizer_email {
|
|
57 |
|
58 |
/**
|
59 |
* Checks to see if we are opening our custom customizer controls
|
60 |
-
*
|
61 |
-
* @access public
|
62 |
* @return bool
|
63 |
*/
|
64 |
public function is_own_customizer_request() {
|
65 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
-
*
|
70 |
*/
|
71 |
public function wcast_generate_defaults() {
|
72 |
$customizer_defaults = array(
|
@@ -107,7 +109,7 @@ class wcast_availableforpickup_customizer_email {
|
|
107 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_enable_availableforpickup_email]',
|
108 |
array(
|
109 |
'label' => __( 'Enable Available For Pickup email', 'woo-advanced-shipment-tracking' ),
|
110 |
-
'description' =>
|
111 |
'section' => 'trackship_shipment_status_email',
|
112 |
'type' => 'checkbox',
|
113 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -198,7 +200,7 @@ class wcast_availableforpickup_customizer_email {
|
|
198 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_availableforpickup_email_settings[wcast_availableforpickup_email_content]',
|
199 |
array(
|
200 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
201 |
-
'description' =>
|
202 |
'section' => 'trackship_shipment_status_email',
|
203 |
'input_attrs' => array(
|
204 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -238,7 +240,7 @@ class wcast_availableforpickup_customizer_email {
|
|
238 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_show_order_details]',
|
239 |
array(
|
240 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
241 |
-
'description' =>
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -257,7 +259,7 @@ class wcast_availableforpickup_customizer_email {
|
|
257 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_hide_shipping_item_price]',
|
258 |
array(
|
259 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
260 |
-
'description' =>
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -276,7 +278,7 @@ class wcast_availableforpickup_customizer_email {
|
|
276 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_show_shipping_address]',
|
277 |
array(
|
278 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
279 |
-
'description' =>
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -300,60 +302,66 @@ class wcast_availableforpickup_customizer_email {
|
|
300 |
'input_attrs' => array(
|
301 |
'class' => '',
|
302 |
'style' => '',
|
303 |
-
'placeholder' =>
|
304 |
),
|
305 |
'active_callback' => array( $this, 'active_callback' ),
|
306 |
)
|
307 |
);
|
308 |
}
|
309 |
|
310 |
-
public function active_callback(){
|
311 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
312 |
}
|
313 |
|
314 |
-
public function active_callback_only_show_order_details(){
|
315 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
316 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_show_order_details'
|
317 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
318 |
}
|
319 |
|
320 |
/**
|
321 |
* Set up preview
|
322 |
-
*
|
323 |
-
* @access public
|
324 |
* @return void
|
325 |
*/
|
326 |
public function set_up_preview() {
|
327 |
// Make sure this is own preview request.
|
328 |
-
if ( ! $this->is_own_preview_request() )
|
329 |
-
|
|
|
|
|
|
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
-
*
|
334 |
*/
|
335 |
-
public function preview_availableforpickup_email(){
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
$
|
338 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
339 |
|
340 |
-
$
|
341 |
-
$email_content = $ast->get_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_email_content',$this->defaults['wcast_availableforpickup_email_content']);
|
342 |
-
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_show_order_details',$this->defaults['wcast_availableforpickup_show_order_details']);
|
343 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_hide_shipping_item_price',$this->defaults['wcast_availableforpickup_hide_shipping_item_price']);
|
344 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_show_shipping_address',$this->defaults['wcast_availableforpickup_show_shipping_address']);
|
345 |
|
346 |
-
|
|
|
|
|
|
|
|
|
347 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
348 |
-
echo $content;
|
349 |
return;
|
350 |
}
|
351 |
|
352 |
$order = wc_get_order( $preview_id );
|
353 |
|
354 |
-
if( !$order ){
|
355 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
356 |
-
echo $content;
|
357 |
return;
|
358 |
}
|
359 |
|
@@ -361,41 +369,48 @@ class wcast_availableforpickup_customizer_email {
|
|
361 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
362 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
363 |
|
364 |
-
$wcast_availableforpickup_analytics_link = $ast->get_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_analytics_link','');
|
365 |
-
|
|
|
366 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
367 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
368 |
}
|
369 |
|
370 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
371 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'available_for_pickup' );
|
372 |
-
|
373 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
$mailer = WC()->mailer();
|
376 |
// create a new email
|
377 |
$email = new WC_Email();
|
378 |
|
379 |
// wrap the content with the email template and then add styles
|
380 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
381 |
}
|
382 |
|
383 |
/**
|
384 |
-
*
|
385 |
*/
|
386 |
-
public function _appendCampaignToString($match){
|
387 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
388 |
-
$wcast_availableforpickup_analytics_link = $ast->get_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_analytics_link','');
|
389 |
|
390 |
$url = $match[2];
|
391 |
if (strpos($url, '?') === false) {
|
392 |
$url .= '?';
|
393 |
}
|
394 |
$url .= $wcast_availableforpickup_analytics_link;
|
395 |
-
return $match[1]
|
396 |
}
|
397 |
}
|
398 |
/**
|
399 |
* Initialise our Customizer settings
|
400 |
*/
|
401 |
-
new
|
6 |
/**
|
7 |
* Adds the individual sections, settings, and controls to the theme customizer
|
8 |
*/
|
9 |
+
class Wcast_Availableforpickup_Customizer_Email {
|
10 |
// Get our default values
|
11 |
public function __construct() {
|
12 |
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
51 |
|
52 |
/**
|
53 |
* Checks to see if we are opening our custom customizer preview
|
54 |
+
*
|
|
|
55 |
* @return bool
|
56 |
*/
|
57 |
public function is_own_preview_request() {
|
60 |
|
61 |
/**
|
62 |
* Checks to see if we are opening our custom customizer controls
|
63 |
+
*
|
|
|
64 |
* @return bool
|
65 |
*/
|
66 |
public function is_own_customizer_request() {
|
67 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
+
* Code for initialize default value for customizer
|
72 |
*/
|
73 |
public function wcast_generate_defaults() {
|
74 |
$customizer_defaults = array(
|
109 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_enable_availableforpickup_email]',
|
110 |
array(
|
111 |
'label' => __( 'Enable Available For Pickup email', 'woo-advanced-shipment-tracking' ),
|
112 |
+
'description' => '',
|
113 |
'section' => 'trackship_shipment_status_email',
|
114 |
'type' => 'checkbox',
|
115 |
'active_callback' => array( $this, 'active_callback' ),
|
200 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_availableforpickup_email_settings[wcast_availableforpickup_email_content]',
|
201 |
array(
|
202 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
203 |
+
'description' => '',
|
204 |
'section' => 'trackship_shipment_status_email',
|
205 |
'input_attrs' => array(
|
206 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
240 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_show_order_details]',
|
241 |
array(
|
242 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
243 |
+
'description' => '',
|
244 |
'section' => 'trackship_shipment_status_email',
|
245 |
'type' => 'checkbox',
|
246 |
'active_callback' => array( $this, 'active_callback' ),
|
259 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_hide_shipping_item_price]',
|
260 |
array(
|
261 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
262 |
+
'description' => '',
|
263 |
'section' => 'trackship_shipment_status_email',
|
264 |
'type' => 'checkbox',
|
265 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
278 |
$wp_customize->add_control( 'wcast_availableforpickup_email_settings[wcast_availableforpickup_show_shipping_address]',
|
279 |
array(
|
280 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
281 |
+
'description' => '',
|
282 |
'section' => 'trackship_shipment_status_email',
|
283 |
'type' => 'checkbox',
|
284 |
'active_callback' => array( $this, 'active_callback' ),
|
302 |
'input_attrs' => array(
|
303 |
'class' => '',
|
304 |
'style' => '',
|
305 |
+
'placeholder' => '',
|
306 |
),
|
307 |
'active_callback' => array( $this, 'active_callback' ),
|
308 |
)
|
309 |
);
|
310 |
}
|
311 |
|
312 |
+
public function active_callback() {
|
313 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
314 |
}
|
315 |
|
316 |
+
public function active_callback_only_show_order_details() {
|
317 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
318 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_show_order_details', $this->defaults['wcast_availableforpickup_show_order_details'] );
|
319 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
* Set up preview
|
324 |
+
*
|
|
|
325 |
* @return void
|
326 |
*/
|
327 |
public function set_up_preview() {
|
328 |
// Make sure this is own preview request.
|
329 |
+
if ( ! $this->is_own_preview_request() ) {
|
330 |
+
return;
|
331 |
+
}
|
332 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/availableforpickup_preview.php';
|
333 |
+
exit;
|
334 |
}
|
335 |
|
336 |
/**
|
337 |
+
* Code for preview of available for pickup email
|
338 |
*/
|
339 |
+
public function preview_availableforpickup_email() {
|
340 |
+
|
341 |
+
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
342 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
343 |
+
|
344 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_email_heading', $this->defaults['wcast_availableforpickup_email_heading'] );
|
345 |
|
346 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_email_content', $this->defaults['wcast_availableforpickup_email_content'] );
|
|
|
347 |
|
348 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_show_order_details', $this->defaults['wcast_availableforpickup_show_order_details'] );
|
|
|
|
|
|
|
|
|
349 |
|
350 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_hide_shipping_item_price', $this->defaults['wcast_availableforpickup_hide_shipping_item_price'] );
|
351 |
+
|
352 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_show_shipping_address', $this->defaults['wcast_availableforpickup_show_shipping_address'] );
|
353 |
+
|
354 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
355 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
356 |
+
echo wp_kses_post( $content );
|
357 |
return;
|
358 |
}
|
359 |
|
360 |
$order = wc_get_order( $preview_id );
|
361 |
|
362 |
+
if ( !$order ) {
|
363 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
364 |
+
echo wp_kses_post( $content );
|
365 |
return;
|
366 |
}
|
367 |
|
369 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
370 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
371 |
|
372 |
+
$wcast_availableforpickup_analytics_link = $ast->get_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_analytics_link', '' );
|
373 |
+
|
374 |
+
if ( $wcast_availableforpickup_analytics_link ) {
|
375 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
376 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
377 |
}
|
378 |
|
379 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
380 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'available_for_pickup' );
|
381 |
+
|
382 |
+
if ( $wcast_show_order_details ) {
|
383 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
384 |
+
}
|
385 |
+
|
386 |
+
if ( $wcast_show_shipping_address ) {
|
387 |
+
$message .= $ast->order_shipping_details_template( $order );
|
388 |
+
}
|
389 |
|
390 |
$mailer = WC()->mailer();
|
391 |
// create a new email
|
392 |
$email = new WC_Email();
|
393 |
|
394 |
// wrap the content with the email template and then add styles
|
395 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
396 |
}
|
397 |
|
398 |
/**
|
399 |
+
* Code for append analytics link in email content
|
400 |
*/
|
401 |
+
public function _appendCampaignToString( $match ) {
|
402 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
403 |
+
$wcast_availableforpickup_analytics_link = $ast->get_option_value_from_array( 'wcast_availableforpickup_email_settings', 'wcast_availableforpickup_analytics_link', '' );
|
404 |
|
405 |
$url = $match[2];
|
406 |
if (strpos($url, '?') === false) {
|
407 |
$url .= '?';
|
408 |
}
|
409 |
$url .= $wcast_availableforpickup_analytics_link;
|
410 |
+
return $match[1] . $url . $match[3];
|
411 |
}
|
412 |
}
|
413 |
/**
|
414 |
* Initialise our Customizer settings
|
415 |
*/
|
416 |
+
new Wcast_Availableforpickup_Customizer_Email();
|
includes/customizer/class-wc-delivered-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -48,7 +52,6 @@ class wcast_delivered_customizer_email {
|
|
48 |
/**
|
49 |
* Checks to see if we are opening our custom customizer preview
|
50 |
*
|
51 |
-
* @access public
|
52 |
* @return bool
|
53 |
*/
|
54 |
public function is_own_preview_request() {
|
@@ -57,16 +60,15 @@ class wcast_delivered_customizer_email {
|
|
57 |
|
58 |
/**
|
59 |
* Checks to see if we are opening our custom customizer controls
|
60 |
-
*
|
61 |
-
* @access public
|
62 |
* @return bool
|
63 |
*/
|
64 |
public function is_own_customizer_request() {
|
65 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
-
*
|
70 |
*/
|
71 |
public function wcast_generate_defaults() {
|
72 |
$customizer_defaults = array(
|
@@ -105,7 +107,7 @@ class wcast_delivered_customizer_email {
|
|
105 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_enable_delivered_status_email]',
|
106 |
array(
|
107 |
'label' => __( 'Enable Delivered email', 'woo-advanced-shipment-tracking' ),
|
108 |
-
'description' =>
|
109 |
'section' => 'trackship_shipment_status_email',
|
110 |
'type' => 'checkbox',
|
111 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -148,7 +150,7 @@ class wcast_delivered_customizer_email {
|
|
148 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_email_subject]',
|
149 |
array(
|
150 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
151 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
152 |
'section' => 'trackship_shipment_status_email',
|
153 |
'type' => 'text',
|
154 |
'input_attrs' => array(
|
@@ -172,7 +174,7 @@ class wcast_delivered_customizer_email {
|
|
172 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_email_heading]',
|
173 |
array(
|
174 |
'label' => __( 'Email heading', 'woocommerce' ),
|
175 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
176 |
'section' => 'trackship_shipment_status_email',
|
177 |
'type' => 'text',
|
178 |
'input_attrs' => array(
|
@@ -196,7 +198,7 @@ class wcast_delivered_customizer_email {
|
|
196 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_delivered_email_settings[wcast_delivered_status_email_content]',
|
197 |
array(
|
198 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
199 |
-
'description' =>
|
200 |
'section' => 'trackship_shipment_status_email',
|
201 |
'input_attrs' => array(
|
202 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -236,7 +238,7 @@ class wcast_delivered_customizer_email {
|
|
236 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_tracking_details]',
|
237 |
array(
|
238 |
'label' => __( 'Show tracking details', 'woo-advanced-shipment-tracking' ),
|
239 |
-
'description' =>
|
240 |
'section' => 'trackship_shipment_status_email',
|
241 |
'type' => 'checkbox',
|
242 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -255,7 +257,7 @@ class wcast_delivered_customizer_email {
|
|
255 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_order_details]',
|
256 |
array(
|
257 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' =>
|
259 |
'section' => 'trackship_shipment_status_email',
|
260 |
'type' => 'checkbox',
|
261 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -274,7 +276,7 @@ class wcast_delivered_customizer_email {
|
|
274 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_hide_shipping_item_price]',
|
275 |
array(
|
276 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
277 |
-
'description' =>
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'type' => 'checkbox',
|
280 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -293,7 +295,7 @@ class wcast_delivered_customizer_email {
|
|
293 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_shipping_address]',
|
294 |
array(
|
295 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
296 |
-
'description' =>
|
297 |
'section' => 'trackship_shipment_status_email',
|
298 |
'type' => 'checkbox',
|
299 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -317,64 +319,66 @@ class wcast_delivered_customizer_email {
|
|
317 |
'input_attrs' => array(
|
318 |
'class' => '',
|
319 |
'style' => '',
|
320 |
-
'placeholder' =>
|
321 |
),
|
322 |
'active_callback' => array( $this, 'active_callback' ),
|
323 |
)
|
324 |
);
|
325 |
}
|
326 |
|
327 |
-
public function active_callback(){
|
328 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
329 |
}
|
330 |
|
331 |
-
public function active_callback_only_show_order_details(){
|
332 |
|
333 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
334 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_order_details'
|
335 |
|
336 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
337 |
}
|
338 |
|
339 |
/**
|
340 |
* Set up preview
|
341 |
-
*
|
342 |
-
* @access public
|
343 |
* @return void
|
344 |
*/
|
345 |
public function set_up_preview() {
|
346 |
|
347 |
// Make sure this is own preview request.
|
348 |
-
if ( ! $this->is_own_preview_request() )
|
349 |
-
|
|
|
|
|
|
|
350 |
}
|
351 |
|
352 |
/**
|
353 |
-
*
|
354 |
*/
|
355 |
-
public function preview_delivered_email(){
|
356 |
|
357 |
-
$preview_id
|
358 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
359 |
|
360 |
-
$email_heading = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_email_heading'
|
361 |
-
$email_content = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_email_content'
|
362 |
-
$wcast_show_tracking_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_tracking_details'
|
363 |
-
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_order_details'
|
364 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_hide_shipping_item_price'
|
365 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_shipping_address'
|
366 |
|
367 |
-
if(
|
368 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
369 |
-
echo $content;
|
370 |
return;
|
371 |
}
|
372 |
|
373 |
$order = wc_get_order( $preview_id );
|
374 |
|
375 |
-
if(!$order){
|
376 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
377 |
-
echo $content;
|
378 |
return;
|
379 |
}
|
380 |
|
@@ -382,42 +386,52 @@ class wcast_delivered_customizer_email {
|
|
382 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
383 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
384 |
|
385 |
-
$wcast_delivered_status_analytics_link = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_analytics_link','');
|
386 |
-
|
|
|
387 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
388 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
389 |
}
|
390 |
|
391 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
392 |
-
|
393 |
-
if( $
|
394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
396 |
$mailer = WC()->mailer();
|
397 |
// create a new email
|
398 |
$email = new WC_Email();
|
399 |
|
400 |
// wrap the content with the email template and then add styles
|
401 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
402 |
}
|
403 |
|
404 |
/**
|
405 |
-
*
|
406 |
*/
|
407 |
-
public function _appendCampaignToString($match){
|
408 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
409 |
-
$wcast_delivered_status_analytics_link = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_analytics_link','');
|
410 |
|
411 |
$url = $match[2];
|
412 |
if (strpos($url, '?') === false) {
|
413 |
$url .= '?';
|
414 |
}
|
415 |
$url .= $wcast_delivered_status_analytics_link;
|
416 |
-
return $match[1]
|
417 |
}
|
418 |
}
|
419 |
/**
|
420 |
* Initialise our Customizer settings
|
421 |
*/
|
422 |
|
423 |
-
$wcast_delivered_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Delivered_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
52 |
/**
|
53 |
* Checks to see if we are opening our custom customizer preview
|
54 |
*
|
|
|
55 |
* @return bool
|
56 |
*/
|
57 |
public function is_own_preview_request() {
|
60 |
|
61 |
/**
|
62 |
* Checks to see if we are opening our custom customizer controls
|
63 |
+
*
|
|
|
64 |
* @return bool
|
65 |
*/
|
66 |
public function is_own_customizer_request() {
|
67 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
+
* Code for initialize default value for customizer
|
72 |
*/
|
73 |
public function wcast_generate_defaults() {
|
74 |
$customizer_defaults = array(
|
107 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_enable_delivered_status_email]',
|
108 |
array(
|
109 |
'label' => __( 'Enable Delivered email', 'woo-advanced-shipment-tracking' ),
|
110 |
+
'description' => '',
|
111 |
'section' => 'trackship_shipment_status_email',
|
112 |
'type' => 'checkbox',
|
113 |
'active_callback' => array( $this, 'active_callback' ),
|
150 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_email_subject]',
|
151 |
array(
|
152 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
153 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
154 |
'section' => 'trackship_shipment_status_email',
|
155 |
'type' => 'text',
|
156 |
'input_attrs' => array(
|
174 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_email_heading]',
|
175 |
array(
|
176 |
'label' => __( 'Email heading', 'woocommerce' ),
|
177 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
178 |
'section' => 'trackship_shipment_status_email',
|
179 |
'type' => 'text',
|
180 |
'input_attrs' => array(
|
198 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_delivered_email_settings[wcast_delivered_status_email_content]',
|
199 |
array(
|
200 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
201 |
+
'description' => '',
|
202 |
'section' => 'trackship_shipment_status_email',
|
203 |
'input_attrs' => array(
|
204 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
238 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_tracking_details]',
|
239 |
array(
|
240 |
'label' => __( 'Show tracking details', 'woo-advanced-shipment-tracking' ),
|
241 |
+
'description' => '',
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
257 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_order_details]',
|
258 |
array(
|
259 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
260 |
+
'description' => '',
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback' ),
|
276 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_hide_shipping_item_price]',
|
277 |
array(
|
278 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'description' => '',
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
295 |
$wp_customize->add_control( 'wcast_delivered_email_settings[wcast_delivered_status_show_shipping_address]',
|
296 |
array(
|
297 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
298 |
+
'description' => '',
|
299 |
'section' => 'trackship_shipment_status_email',
|
300 |
'type' => 'checkbox',
|
301 |
'active_callback' => array( $this, 'active_callback' ),
|
319 |
'input_attrs' => array(
|
320 |
'class' => '',
|
321 |
'style' => '',
|
322 |
+
'placeholder' => '',
|
323 |
),
|
324 |
'active_callback' => array( $this, 'active_callback' ),
|
325 |
)
|
326 |
);
|
327 |
}
|
328 |
|
329 |
+
public function active_callback() {
|
330 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
331 |
}
|
332 |
|
333 |
+
public function active_callback_only_show_order_details() {
|
334 |
|
335 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
336 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_show_order_details', $this->defaults['wcast_delivered_status_show_order_details'] );
|
337 |
|
338 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
339 |
}
|
340 |
|
341 |
/**
|
342 |
* Set up preview
|
343 |
+
*
|
|
|
344 |
* @return void
|
345 |
*/
|
346 |
public function set_up_preview() {
|
347 |
|
348 |
// Make sure this is own preview request.
|
349 |
+
if ( ! $this->is_own_preview_request() ) {
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/delivered_status_preview.php';
|
353 |
+
exit;
|
354 |
}
|
355 |
|
356 |
/**
|
357 |
+
* Code for preview of delivered email
|
358 |
*/
|
359 |
+
public function preview_delivered_email() {
|
360 |
|
361 |
+
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
362 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
363 |
|
364 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_heading', $this->defaults['wcast_delivered_status_email_heading'] );
|
365 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_content', $this->defaults['wcast_delivered_status_email_content'] );
|
366 |
+
$wcast_show_tracking_details = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_show_tracking_details', $this->defaults['wcast_delivered_status_show_tracking_details'] );
|
367 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_show_order_details', $this->defaults['wcast_delivered_status_show_order_details'] );
|
368 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_hide_shipping_item_price', $this->defaults['wcast_delivered_status_hide_shipping_item_price'] );
|
369 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_show_shipping_address', $this->defaults['wcast_delivered_status_show_shipping_address'] );
|
370 |
|
371 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
372 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
373 |
+
echo wp_kses_post( $content );
|
374 |
return;
|
375 |
}
|
376 |
|
377 |
$order = wc_get_order( $preview_id );
|
378 |
|
379 |
+
if ( !$order ) {
|
380 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
381 |
+
echo wp_kses_post( $content );
|
382 |
return;
|
383 |
}
|
384 |
|
386 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
387 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
388 |
|
389 |
+
$wcast_delivered_status_analytics_link = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_analytics_link', '' );
|
390 |
+
|
391 |
+
if ( $wcast_delivered_status_analytics_link ) {
|
392 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
393 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
394 |
}
|
395 |
|
396 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
397 |
+
|
398 |
+
if ( $wcast_show_tracking_details ) {
|
399 |
+
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'delivered' );
|
400 |
+
}
|
401 |
+
|
402 |
+
if ( $wcast_show_order_details ) {
|
403 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
404 |
+
}
|
405 |
+
|
406 |
+
if ( $wcast_show_shipping_address ) {
|
407 |
+
$message .= $ast->order_shipping_details_template( $order );
|
408 |
+
}
|
409 |
|
410 |
$mailer = WC()->mailer();
|
411 |
// create a new email
|
412 |
$email = new WC_Email();
|
413 |
|
414 |
// wrap the content with the email template and then add styles
|
415 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
416 |
}
|
417 |
|
418 |
/**
|
419 |
+
* Code for append analytics link in email content
|
420 |
*/
|
421 |
+
public function _appendCampaignToString( $match ) {
|
422 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
423 |
+
$wcast_delivered_status_analytics_link = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_analytics_link', '' );
|
424 |
|
425 |
$url = $match[2];
|
426 |
if (strpos($url, '?') === false) {
|
427 |
$url .= '?';
|
428 |
}
|
429 |
$url .= $wcast_delivered_status_analytics_link;
|
430 |
+
return $match[1] . $url . $match[3];
|
431 |
}
|
432 |
}
|
433 |
/**
|
434 |
* Initialise our Customizer settings
|
435 |
*/
|
436 |
|
437 |
+
$wcast_delivered_customizer_email = new Wcast_Delivered_Customizer_Email();
|
includes/customizer/class-wc-exception-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -46,8 +50,7 @@ class wcast_exception_customizer_email {
|
|
46 |
|
47 |
/**
|
48 |
* Checks to see if we are opening our custom customizer preview
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
* @return bool
|
52 |
*/
|
53 |
public function is_own_preview_request() {
|
@@ -56,16 +59,15 @@ class wcast_exception_customizer_email {
|
|
56 |
|
57 |
/**
|
58 |
* Checks to see if we are opening our custom customizer controls
|
59 |
-
*
|
60 |
-
* @access public
|
61 |
* @return bool
|
62 |
*/
|
63 |
public function is_own_customizer_request() {
|
64 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
*/
|
70 |
public function wcast_generate_defaults() {
|
71 |
$customizer_defaults = array(
|
@@ -105,7 +107,7 @@ class wcast_exception_customizer_email {
|
|
105 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_enable_exception_email]',
|
106 |
array(
|
107 |
'label' => __( 'Enable Exception email', 'woo-advanced-shipment-tracking' ),
|
108 |
-
'description' =>
|
109 |
'section' => 'trackship_shipment_status_email',
|
110 |
'type' => 'checkbox',
|
111 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -148,7 +150,7 @@ class wcast_exception_customizer_email {
|
|
148 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_email_subject]',
|
149 |
array(
|
150 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
151 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
152 |
'section' => 'trackship_shipment_status_email',
|
153 |
'type' => 'text',
|
154 |
'input_attrs' => array(
|
@@ -172,7 +174,7 @@ class wcast_exception_customizer_email {
|
|
172 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_email_heading]',
|
173 |
array(
|
174 |
'label' => __( 'Email heading', 'woocommerce' ),
|
175 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
176 |
'section' => 'trackship_shipment_status_email',
|
177 |
'type' => 'text',
|
178 |
'input_attrs' => array(
|
@@ -196,7 +198,7 @@ class wcast_exception_customizer_email {
|
|
196 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_exception_email_settings[wcast_exception_email_content]',
|
197 |
array(
|
198 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
199 |
-
'description' =>
|
200 |
'section' => 'trackship_shipment_status_email',
|
201 |
'input_attrs' => array(
|
202 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -236,7 +238,7 @@ class wcast_exception_customizer_email {
|
|
236 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_show_order_details]',
|
237 |
array(
|
238 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
239 |
-
'description' =>
|
240 |
'section' => 'trackship_shipment_status_email',
|
241 |
'type' => 'checkbox',
|
242 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -255,7 +257,7 @@ class wcast_exception_customizer_email {
|
|
255 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_hide_shipping_item_price]',
|
256 |
array(
|
257 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' =>
|
259 |
'section' => 'trackship_shipment_status_email',
|
260 |
'type' => 'checkbox',
|
261 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -274,7 +276,7 @@ class wcast_exception_customizer_email {
|
|
274 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_show_shipping_address]',
|
275 |
array(
|
276 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
277 |
-
'description' =>
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'type' => 'checkbox',
|
280 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -298,62 +300,64 @@ class wcast_exception_customizer_email {
|
|
298 |
'input_attrs' => array(
|
299 |
'class' => '',
|
300 |
'style' => '',
|
301 |
-
'placeholder' =>
|
302 |
),
|
303 |
'active_callback' => array( $this, 'active_callback' ),
|
304 |
)
|
305 |
);
|
306 |
}
|
307 |
|
308 |
-
public function active_callback(){
|
309 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
310 |
}
|
311 |
|
312 |
-
public function active_callback_only_show_order_details(){
|
313 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
314 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_exception_email_settings','wcast_exception_show_order_details'
|
315 |
|
316 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
317 |
}
|
318 |
|
319 |
/**
|
320 |
* Set up preview
|
321 |
-
*
|
322 |
-
* @access public
|
323 |
* @return void
|
324 |
*/
|
325 |
public function set_up_preview() {
|
326 |
|
327 |
// Make sure this is own preview request.
|
328 |
-
if ( ! $this->is_own_preview_request() )
|
329 |
-
|
|
|
|
|
|
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
-
*
|
334 |
*/
|
335 |
-
public function preview_exception_email(){
|
336 |
|
337 |
-
$preview_id
|
338 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
339 |
|
340 |
-
$email_heading = $ast->get_option_value_from_array('wcast_exception_email_settings','wcast_exception_email_heading'
|
341 |
-
$email_content = $ast->get_option_value_from_array('wcast_exception_email_settings','wcast_exception_email_content'
|
342 |
-
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_exception_email_settings','wcast_exception_show_order_details'
|
343 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_exception_email_settings','wcast_exception_hide_shipping_item_price'
|
344 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_exception_email_settings','wcast_exception_show_shipping_address'
|
345 |
|
346 |
-
if(
|
347 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
348 |
-
echo $content;
|
349 |
return;
|
350 |
}
|
351 |
|
352 |
$order = wc_get_order( $preview_id );
|
353 |
|
354 |
-
if(!$order){
|
355 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
356 |
-
echo $content;
|
357 |
return;
|
358 |
}
|
359 |
|
@@ -361,42 +365,48 @@ class wcast_exception_customizer_email {
|
|
361 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
362 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
363 |
|
364 |
-
$wcast_exception_analytics_link = $ast->get_option_value_from_array('wcast_exception_email_settings','wcast_exception_analytics_link','');
|
365 |
-
if($wcast_exception_analytics_link){
|
366 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
367 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
368 |
}
|
369 |
|
370 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
371 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'exception' );
|
372 |
-
|
373 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
$mailer = WC()->mailer();
|
376 |
// create a new email
|
377 |
$email = new WC_Email();
|
378 |
|
379 |
// wrap the content with the email template and then add styles
|
380 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
381 |
}
|
382 |
|
383 |
/**
|
384 |
-
*
|
385 |
*/
|
386 |
-
public function _appendCampaignToString($match){
|
387 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
388 |
-
$wcast_exception_analytics_link = $ast->get_option_value_from_array('wcast_exception_email_settings','wcast_exception_analytics_link','');
|
389 |
|
390 |
$url = $match[2];
|
391 |
if (strpos($url, '?') === false) {
|
392 |
$url .= '?';
|
393 |
}
|
394 |
$url .= $wcast_exception_analytics_link;
|
395 |
-
return $match[1]
|
396 |
}
|
397 |
}
|
398 |
/**
|
399 |
* Initialise our Customizer settings
|
400 |
*/
|
401 |
|
402 |
-
$wcast_exception_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Exception_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
50 |
|
51 |
/**
|
52 |
* Checks to see if we are opening our custom customizer preview
|
53 |
+
*
|
|
|
54 |
* @return bool
|
55 |
*/
|
56 |
public function is_own_preview_request() {
|
59 |
|
60 |
/**
|
61 |
* Checks to see if we are opening our custom customizer controls
|
62 |
+
*
|
|
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function is_own_customizer_request() {
|
66 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
+
* Code for initialize default value for customizer
|
71 |
*/
|
72 |
public function wcast_generate_defaults() {
|
73 |
$customizer_defaults = array(
|
107 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_enable_exception_email]',
|
108 |
array(
|
109 |
'label' => __( 'Enable Exception email', 'woo-advanced-shipment-tracking' ),
|
110 |
+
'description' => '',
|
111 |
'section' => 'trackship_shipment_status_email',
|
112 |
'type' => 'checkbox',
|
113 |
'active_callback' => array( $this, 'active_callback' ),
|
150 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_email_subject]',
|
151 |
array(
|
152 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
153 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
154 |
'section' => 'trackship_shipment_status_email',
|
155 |
'type' => 'text',
|
156 |
'input_attrs' => array(
|
174 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_email_heading]',
|
175 |
array(
|
176 |
'label' => __( 'Email heading', 'woocommerce' ),
|
177 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
178 |
'section' => 'trackship_shipment_status_email',
|
179 |
'type' => 'text',
|
180 |
'input_attrs' => array(
|
198 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_exception_email_settings[wcast_exception_email_content]',
|
199 |
array(
|
200 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
201 |
+
'description' => '',
|
202 |
'section' => 'trackship_shipment_status_email',
|
203 |
'input_attrs' => array(
|
204 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
238 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_show_order_details]',
|
239 |
array(
|
240 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
241 |
+
'description' => '',
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
257 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_hide_shipping_item_price]',
|
258 |
array(
|
259 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
260 |
+
'description' => '',
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
276 |
$wp_customize->add_control( 'wcast_exception_email_settings[wcast_exception_show_shipping_address]',
|
277 |
array(
|
278 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'description' => '',
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback' ),
|
300 |
'input_attrs' => array(
|
301 |
'class' => '',
|
302 |
'style' => '',
|
303 |
+
'placeholder' => '',
|
304 |
),
|
305 |
'active_callback' => array( $this, 'active_callback' ),
|
306 |
)
|
307 |
);
|
308 |
}
|
309 |
|
310 |
+
public function active_callback() {
|
311 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
312 |
}
|
313 |
|
314 |
+
public function active_callback_only_show_order_details() {
|
315 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
316 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_show_order_details', $this->defaults['wcast_exception_show_order_details'] );
|
317 |
|
318 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
319 |
}
|
320 |
|
321 |
/**
|
322 |
* Set up preview
|
323 |
+
*
|
|
|
324 |
* @return void
|
325 |
*/
|
326 |
public function set_up_preview() {
|
327 |
|
328 |
// Make sure this is own preview request.
|
329 |
+
if ( ! $this->is_own_preview_request() ) {
|
330 |
+
return;
|
331 |
+
}
|
332 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/exception_preview.php';
|
333 |
+
exit;
|
334 |
}
|
335 |
|
336 |
/**
|
337 |
+
* Code for preview of exception email
|
338 |
*/
|
339 |
+
public function preview_exception_email() {
|
340 |
|
341 |
+
$preview_id = get_theme_mod( 'wcast_intransit_email_preview_order_id' );
|
342 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
343 |
|
344 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_email_heading', $this->defaults['wcast_exception_email_heading'] );
|
345 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_email_content', $this->defaults['wcast_exception_email_content'] );
|
346 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_show_order_details', $this->defaults['wcast_exception_show_order_details'] );
|
347 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_hide_shipping_item_price', $this->defaults['wcast_exception_hide_shipping_item_price'] );
|
348 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_show_shipping_address', $this->defaults['wcast_exception_show_shipping_address'] );
|
349 |
|
350 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
351 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
352 |
+
echo wp_kses_post( $content );
|
353 |
return;
|
354 |
}
|
355 |
|
356 |
$order = wc_get_order( $preview_id );
|
357 |
|
358 |
+
if ( !$order ) {
|
359 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
360 |
+
echo wp_kses_post( $content );
|
361 |
return;
|
362 |
}
|
363 |
|
365 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
366 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
367 |
|
368 |
+
$wcast_exception_analytics_link = $ast->get_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_analytics_link', '' );
|
369 |
+
if ( $wcast_exception_analytics_link ) {
|
370 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
371 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
372 |
}
|
373 |
|
374 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
375 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'exception' );
|
376 |
+
|
377 |
+
if ( $wcast_show_order_details ) {
|
378 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
379 |
+
}
|
380 |
+
|
381 |
+
if ( $wcast_show_shipping_address ) {
|
382 |
+
$message .= $ast->order_shipping_details_template( $order );
|
383 |
+
}
|
384 |
|
385 |
$mailer = WC()->mailer();
|
386 |
// create a new email
|
387 |
$email = new WC_Email();
|
388 |
|
389 |
// wrap the content with the email template and then add styles
|
390 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
391 |
}
|
392 |
|
393 |
/**
|
394 |
+
* Code for append analytics link in email content
|
395 |
*/
|
396 |
+
public function _appendCampaignToString( $match ) {
|
397 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
398 |
+
$wcast_exception_analytics_link = $ast->get_option_value_from_array( 'wcast_exception_email_settings', 'wcast_exception_analytics_link', '' );
|
399 |
|
400 |
$url = $match[2];
|
401 |
if (strpos($url, '?') === false) {
|
402 |
$url .= '?';
|
403 |
}
|
404 |
$url .= $wcast_exception_analytics_link;
|
405 |
+
return $match[1] . $url . $match[3];
|
406 |
}
|
407 |
}
|
408 |
/**
|
409 |
* Initialise our Customizer settings
|
410 |
*/
|
411 |
|
412 |
+
$wcast_exception_customizer_email = new Wcast_Exception_Customizer_Email();
|
includes/customizer/class-wc-failure-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -46,8 +50,7 @@ class wcast_failure_customizer_email {
|
|
46 |
|
47 |
/**
|
48 |
* Checks to see if we are opening our custom customizer preview
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
* @return bool
|
52 |
*/
|
53 |
public function is_own_preview_request() {
|
@@ -56,16 +59,15 @@ class wcast_failure_customizer_email {
|
|
56 |
|
57 |
/**
|
58 |
* Checks to see if we are opening our custom customizer controls
|
59 |
-
*
|
60 |
-
* @access public
|
61 |
* @return bool
|
62 |
*/
|
63 |
public function is_own_customizer_request() {
|
64 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
*/
|
70 |
public function wcast_generate_defaults() {
|
71 |
$customizer_defaults = array(
|
@@ -105,7 +107,7 @@ class wcast_failure_customizer_email {
|
|
105 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_enable_failure_email]',
|
106 |
array(
|
107 |
'label' => __( 'Enable Failed Attempt email', 'woo-advanced-shipment-tracking' ),
|
108 |
-
'description' =>
|
109 |
'section' => 'trackship_shipment_status_email',
|
110 |
'type' => 'checkbox',
|
111 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -148,7 +150,7 @@ class wcast_failure_customizer_email {
|
|
148 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_email_subject]',
|
149 |
array(
|
150 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
151 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
152 |
'section' => 'trackship_shipment_status_email',
|
153 |
'type' => 'text',
|
154 |
'input_attrs' => array(
|
@@ -172,7 +174,7 @@ class wcast_failure_customizer_email {
|
|
172 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_email_heading]',
|
173 |
array(
|
174 |
'label' => __( 'Email heading', 'woocommerce' ),
|
175 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
176 |
'section' => 'trackship_shipment_status_email',
|
177 |
'type' => 'text',
|
178 |
'input_attrs' => array(
|
@@ -196,7 +198,7 @@ class wcast_failure_customizer_email {
|
|
196 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_failure_email_settings[wcast_failure_email_content]',
|
197 |
array(
|
198 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
199 |
-
'description' =>
|
200 |
'section' => 'trackship_shipment_status_email',
|
201 |
'input_attrs' => array(
|
202 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -236,7 +238,7 @@ class wcast_failure_customizer_email {
|
|
236 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_show_order_details]',
|
237 |
array(
|
238 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
239 |
-
'description' =>
|
240 |
'section' => 'trackship_shipment_status_email',
|
241 |
'type' => 'checkbox',
|
242 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -255,7 +257,7 @@ class wcast_failure_customizer_email {
|
|
255 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_hide_shipping_item_price]',
|
256 |
array(
|
257 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' =>
|
259 |
'section' => 'trackship_shipment_status_email',
|
260 |
'type' => 'checkbox',
|
261 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -274,7 +276,7 @@ class wcast_failure_customizer_email {
|
|
274 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_show_shipping_address]',
|
275 |
array(
|
276 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
277 |
-
'description' =>
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'type' => 'checkbox',
|
280 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -298,63 +300,69 @@ class wcast_failure_customizer_email {
|
|
298 |
'input_attrs' => array(
|
299 |
'class' => '',
|
300 |
'style' => '',
|
301 |
-
'placeholder' =>
|
302 |
),
|
303 |
'active_callback' => array( $this, 'active_callback' ),
|
304 |
)
|
305 |
);
|
306 |
}
|
307 |
|
308 |
-
public function active_callback(){
|
309 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
310 |
}
|
311 |
|
312 |
-
public function active_callback_only_show_order_details(){
|
313 |
|
314 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
315 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_order_details'
|
316 |
|
317 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
318 |
}
|
319 |
|
320 |
/**
|
321 |
* Set up preview
|
322 |
-
*
|
323 |
-
* @access public
|
324 |
* @return void
|
325 |
*/
|
326 |
public function set_up_preview() {
|
327 |
|
328 |
// Make sure this is own preview request.
|
329 |
-
if ( ! $this->is_own_preview_request() )
|
330 |
-
|
|
|
|
|
|
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
-
*
|
335 |
*/
|
336 |
-
public function preview_failure_email(){
|
337 |
|
338 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
339 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
|
|
|
|
|
|
|
|
340 |
|
341 |
-
$
|
342 |
-
$email_content = $ast->get_option_value_from_array('wcast_failure_email_settings','wcast_failure_email_content',$this->defaults['wcast_failure_email_content']);
|
343 |
-
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_order_details',$this->defaults['wcast_failure_show_order_details']);
|
344 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_hide_shipping_item_price',$this->defaults['wcast_failure_hide_shipping_item_price']);
|
345 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_shipping_address',$this->defaults['wcast_failure_show_shipping_address']);
|
346 |
|
347 |
-
|
|
|
|
|
|
|
|
|
348 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
349 |
-
echo $content;
|
350 |
return;
|
351 |
}
|
352 |
|
353 |
$order = wc_get_order( $preview_id );
|
354 |
|
355 |
-
if(!$order){
|
356 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
357 |
-
echo $content;
|
358 |
return;
|
359 |
}
|
360 |
|
@@ -362,42 +370,49 @@ class wcast_failure_customizer_email {
|
|
362 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
363 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
364 |
|
365 |
-
$wcast_failure_analytics_link = $ast->get_option_value_from_array('wcast_failure_email_settings','wcast_failure_analytics_link','');
|
366 |
-
if($wcast_failure_analytics_link){
|
367 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
368 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
369 |
}
|
370 |
|
371 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
|
|
372 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'failure' );
|
373 |
-
|
374 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
|
376 |
$mailer = WC()->mailer();
|
377 |
// create a new email
|
378 |
$email = new WC_Email();
|
379 |
|
380 |
// wrap the content with the email template and then add styles
|
381 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
382 |
}
|
383 |
|
384 |
/**
|
385 |
-
*
|
386 |
*/
|
387 |
-
public function _appendCampaignToString($match){
|
388 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
389 |
-
$wcast_failure_analytics_link = $ast->get_option_value_from_array('wcast_failure_email_settings','wcast_failure_analytics_link','');
|
390 |
|
391 |
$url = $match[2];
|
392 |
if (strpos($url, '?') === false) {
|
393 |
$url .= '?';
|
394 |
}
|
395 |
$url .= $wcast_failure_analytics_link;
|
396 |
-
return $match[1]
|
397 |
}
|
398 |
}
|
399 |
/**
|
400 |
* Initialise our Customizer settings
|
401 |
*/
|
402 |
|
403 |
-
$wcast_failure_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Failure_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
50 |
|
51 |
/**
|
52 |
* Checks to see if we are opening our custom customizer preview
|
53 |
+
*
|
|
|
54 |
* @return bool
|
55 |
*/
|
56 |
public function is_own_preview_request() {
|
59 |
|
60 |
/**
|
61 |
* Checks to see if we are opening our custom customizer controls
|
62 |
+
*
|
|
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function is_own_customizer_request() {
|
66 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
+
* Code for initialize default value for customizer
|
71 |
*/
|
72 |
public function wcast_generate_defaults() {
|
73 |
$customizer_defaults = array(
|
107 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_enable_failure_email]',
|
108 |
array(
|
109 |
'label' => __( 'Enable Failed Attempt email', 'woo-advanced-shipment-tracking' ),
|
110 |
+
'description' => '',
|
111 |
'section' => 'trackship_shipment_status_email',
|
112 |
'type' => 'checkbox',
|
113 |
'active_callback' => array( $this, 'active_callback' ),
|
150 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_email_subject]',
|
151 |
array(
|
152 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
153 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
154 |
'section' => 'trackship_shipment_status_email',
|
155 |
'type' => 'text',
|
156 |
'input_attrs' => array(
|
174 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_email_heading]',
|
175 |
array(
|
176 |
'label' => __( 'Email heading', 'woocommerce' ),
|
177 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
178 |
'section' => 'trackship_shipment_status_email',
|
179 |
'type' => 'text',
|
180 |
'input_attrs' => array(
|
198 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_failure_email_settings[wcast_failure_email_content]',
|
199 |
array(
|
200 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
201 |
+
'description' => '',
|
202 |
'section' => 'trackship_shipment_status_email',
|
203 |
'input_attrs' => array(
|
204 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
238 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_show_order_details]',
|
239 |
array(
|
240 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
241 |
+
'description' => '',
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
257 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_hide_shipping_item_price]',
|
258 |
array(
|
259 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
260 |
+
'description' => '',
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
276 |
$wp_customize->add_control( 'wcast_failure_email_settings[wcast_failure_show_shipping_address]',
|
277 |
array(
|
278 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'description' => '',
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback' ),
|
300 |
'input_attrs' => array(
|
301 |
'class' => '',
|
302 |
'style' => '',
|
303 |
+
'placeholder' => '',
|
304 |
),
|
305 |
'active_callback' => array( $this, 'active_callback' ),
|
306 |
)
|
307 |
);
|
308 |
}
|
309 |
|
310 |
+
public function active_callback() {
|
311 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
312 |
}
|
313 |
|
314 |
+
public function active_callback_only_show_order_details() {
|
315 |
|
316 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
317 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_show_order_details', $this->defaults['wcast_failure_show_order_details'] );
|
318 |
|
319 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
* Set up preview
|
324 |
+
*
|
|
|
325 |
* @return void
|
326 |
*/
|
327 |
public function set_up_preview() {
|
328 |
|
329 |
// Make sure this is own preview request.
|
330 |
+
if ( ! $this->is_own_preview_request() ) {
|
331 |
+
return;
|
332 |
+
}
|
333 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/failure_preview.php';
|
334 |
+
exit;
|
335 |
}
|
336 |
|
337 |
/**
|
338 |
+
* Code for preview of failure email
|
339 |
*/
|
340 |
+
public function preview_failure_email() {
|
341 |
|
342 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
343 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
344 |
+
|
345 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_email_heading', $this->defaults['wcast_failure_email_heading'] );
|
346 |
+
|
347 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_email_content', $this->defaults['wcast_failure_email_content'] );
|
348 |
|
349 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_show_order_details', $this->defaults['wcast_failure_show_order_details'] );
|
|
|
|
|
|
|
|
|
350 |
|
351 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_hide_shipping_item_price', $this->defaults['wcast_failure_hide_shipping_item_price'] );
|
352 |
+
|
353 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_show_shipping_address', $this->defaults['wcast_failure_show_shipping_address'] );
|
354 |
+
|
355 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
356 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
357 |
+
echo wp_kses_post( $content );
|
358 |
return;
|
359 |
}
|
360 |
|
361 |
$order = wc_get_order( $preview_id );
|
362 |
|
363 |
+
if ( !$order ) {
|
364 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
365 |
+
echo wp_kses_post( $content );
|
366 |
return;
|
367 |
}
|
368 |
|
370 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
371 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
372 |
|
373 |
+
$wcast_failure_analytics_link = $ast->get_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_analytics_link', '' );
|
374 |
+
if ( $wcast_failure_analytics_link ) {
|
375 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
376 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
377 |
}
|
378 |
|
379 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
380 |
+
|
381 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'failure' );
|
382 |
+
|
383 |
+
if ( $wcast_show_order_details ) {
|
384 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( $wcast_show_shipping_address ) {
|
388 |
+
$message .= $ast->order_shipping_details_template( $order );
|
389 |
+
}
|
390 |
|
391 |
$mailer = WC()->mailer();
|
392 |
// create a new email
|
393 |
$email = new WC_Email();
|
394 |
|
395 |
// wrap the content with the email template and then add styles
|
396 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
397 |
}
|
398 |
|
399 |
/**
|
400 |
+
* Code for append analytics link in email content
|
401 |
*/
|
402 |
+
public function _appendCampaignToString( $match ) {
|
403 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
404 |
+
$wcast_failure_analytics_link = $ast->get_option_value_from_array( 'wcast_failure_email_settings', 'wcast_failure_analytics_link', '' );
|
405 |
|
406 |
$url = $match[2];
|
407 |
if (strpos($url, '?') === false) {
|
408 |
$url .= '?';
|
409 |
}
|
410 |
$url .= $wcast_failure_analytics_link;
|
411 |
+
return $match[1] . $url . $match[3];
|
412 |
}
|
413 |
}
|
414 |
/**
|
415 |
* Initialise our Customizer settings
|
416 |
*/
|
417 |
|
418 |
+
$wcast_failure_customizer_email = new Wcast_Failure_Customizer_Email();
|
includes/customizer/class-wc-intransit-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -46,8 +50,7 @@ class wcast_intransit_customizer_email {
|
|
46 |
|
47 |
/**
|
48 |
* Checks to see if we are opening our custom customizer preview
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
* @return bool
|
52 |
*/
|
53 |
public function is_own_preview_request() {
|
@@ -56,12 +59,11 @@ class wcast_intransit_customizer_email {
|
|
56 |
|
57 |
/**
|
58 |
* Checks to see if we are opening our custom customizer controls
|
59 |
-
*
|
60 |
-
* @access public
|
61 |
* @return bool
|
62 |
*/
|
63 |
public function is_own_customizer_request() {
|
64 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
65 |
}
|
66 |
|
67 |
/**
|
@@ -69,29 +71,28 @@ class wcast_intransit_customizer_email {
|
|
69 |
*
|
70 |
*/
|
71 |
public function get_customizer_url( $email, $shipment_status, $return_tab ) {
|
72 |
-
$preview_status = str_replace(
|
73 |
return add_query_arg( array(
|
74 |
'trackship-customizer' => '1',
|
75 |
'email' => $email,
|
76 |
'shipment_status' => $shipment_status,
|
77 |
'autofocus[section]' => 'trackship_shipment_status_email',
|
78 |
-
'url' => urlencode( add_query_arg( array( 'wcast-'
|
79 |
'return' => urlencode( $this->get_email_settings_page_url($return_tab) ),
|
80 |
), admin_url( 'customize.php' ) );
|
81 |
}
|
82 |
|
83 |
/**
|
84 |
* Get WooCommerce email settings page URL
|
85 |
-
*
|
86 |
-
* @access public
|
87 |
* @return string
|
88 |
*/
|
89 |
-
public function get_email_settings_page_url($return_tab) {
|
90 |
return admin_url( 'admin.php?page=trackship-for-woocommerce&tab=' . $return_tab );
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
-
*
|
95 |
*/
|
96 |
public function wcast_generate_defaults() {
|
97 |
$customizer_defaults = array(
|
@@ -182,7 +183,7 @@ class wcast_intransit_customizer_email {
|
|
182 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_enable_intransit_email]',
|
183 |
array(
|
184 |
'label' => __( 'Enable In Transit email', 'woo-advanced-shipment-tracking' ),
|
185 |
-
'description' =>
|
186 |
'section' => 'trackship_shipment_status_email',
|
187 |
'type' => 'checkbox',
|
188 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -225,7 +226,7 @@ class wcast_intransit_customizer_email {
|
|
225 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_email_subject]',
|
226 |
array(
|
227 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
228 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
229 |
'section' => 'trackship_shipment_status_email',
|
230 |
'type' => 'text',
|
231 |
'input_attrs' => array(
|
@@ -249,7 +250,7 @@ class wcast_intransit_customizer_email {
|
|
249 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_email_heading]',
|
250 |
array(
|
251 |
'label' => __( 'Email heading', 'woocommerce' ),
|
252 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
253 |
'section' => 'trackship_shipment_status_email',
|
254 |
'type' => 'text',
|
255 |
'input_attrs' => array(
|
@@ -273,7 +274,7 @@ class wcast_intransit_customizer_email {
|
|
273 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_intransit_email_settings[wcast_intransit_email_content]',
|
274 |
array(
|
275 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
276 |
-
'description' =>
|
277 |
'section' => 'trackship_shipment_status_email',
|
278 |
'input_attrs' => array(
|
279 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -313,7 +314,7 @@ class wcast_intransit_customizer_email {
|
|
313 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_show_order_details]',
|
314 |
array(
|
315 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
316 |
-
'description' =>
|
317 |
'section' => 'trackship_shipment_status_email',
|
318 |
'type' => 'checkbox',
|
319 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -332,7 +333,7 @@ class wcast_intransit_customizer_email {
|
|
332 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_hide_shipping_item_price]',
|
333 |
array(
|
334 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
335 |
-
'description' =>
|
336 |
'section' => 'trackship_shipment_status_email',
|
337 |
'type' => 'checkbox',
|
338 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -351,7 +352,7 @@ class wcast_intransit_customizer_email {
|
|
351 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_show_shipping_address]',
|
352 |
array(
|
353 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
354 |
-
'description' =>
|
355 |
'section' => 'trackship_shipment_status_email',
|
356 |
'type' => 'checkbox',
|
357 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -375,60 +376,66 @@ class wcast_intransit_customizer_email {
|
|
375 |
'input_attrs' => array(
|
376 |
'class' => '',
|
377 |
'style' => '',
|
378 |
-
'placeholder' =>
|
379 |
),
|
380 |
'active_callback' => array( $this, 'active_callback' ),
|
381 |
)
|
382 |
);
|
383 |
}
|
384 |
|
385 |
-
public function active_callback(){
|
386 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
387 |
}
|
388 |
|
389 |
-
public function active_callback_only_show_order_details(){
|
390 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
391 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_show_order_details'
|
392 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
393 |
}
|
394 |
|
395 |
/**
|
396 |
* Set up preview
|
397 |
-
*
|
398 |
-
* @access public
|
399 |
* @return void
|
400 |
*/
|
401 |
public function set_up_preview() {
|
402 |
// Make sure this is own preview request.
|
403 |
-
if ( ! $this->is_own_preview_request() )
|
404 |
-
|
|
|
|
|
|
|
405 |
}
|
406 |
|
407 |
/**
|
408 |
-
*
|
409 |
*/
|
410 |
-
public function preview_intransit_email(){
|
411 |
|
412 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
413 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
414 |
|
415 |
-
$email_heading = $ast->get_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_email_heading'
|
416 |
-
|
417 |
-
$
|
418 |
-
|
419 |
-
$
|
|
|
|
|
|
|
|
|
420 |
|
421 |
-
if(
|
422 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
423 |
-
echo $content;
|
424 |
return;
|
425 |
}
|
426 |
|
427 |
$order = wc_get_order( $preview_id );
|
428 |
|
429 |
-
if(!$order){
|
430 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
431 |
-
echo $content;
|
432 |
return;
|
433 |
}
|
434 |
|
@@ -436,42 +443,50 @@ class wcast_intransit_customizer_email {
|
|
436 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
437 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
438 |
|
439 |
-
$wcast_intransit_analytics_link = $ast->get_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_analytics_link','');
|
440 |
-
|
|
|
441 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
442 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
443 |
}
|
444 |
|
445 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
|
|
446 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'in_transit' );
|
447 |
-
|
448 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
$mailer = WC()->mailer();
|
451 |
// create a new email
|
452 |
$email = new WC_Email();
|
453 |
|
454 |
// wrap the content with the email template and then add styles
|
455 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
456 |
}
|
457 |
|
458 |
/**
|
459 |
-
*
|
460 |
*/
|
461 |
-
public function _appendCampaignToString($match){
|
462 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
463 |
-
$wcast_intransit_analytics_link = $ast->get_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_analytics_link','');
|
464 |
|
465 |
$url = $match[2];
|
466 |
if (strpos($url, '?') === false) {
|
467 |
$url .= '?';
|
468 |
}
|
469 |
$url .= $wcast_intransit_analytics_link;
|
470 |
-
return $match[1]
|
471 |
}
|
472 |
}
|
473 |
/**
|
474 |
* Initialise our Customizer settings
|
475 |
*/
|
476 |
|
477 |
-
$wcast_intransit_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Intransit_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
50 |
|
51 |
/**
|
52 |
* Checks to see if we are opening our custom customizer preview
|
53 |
+
*
|
|
|
54 |
* @return bool
|
55 |
*/
|
56 |
public function is_own_preview_request() {
|
59 |
|
60 |
/**
|
61 |
* Checks to see if we are opening our custom customizer controls
|
62 |
+
*
|
|
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function is_own_customizer_request() {
|
66 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
67 |
}
|
68 |
|
69 |
/**
|
71 |
*
|
72 |
*/
|
73 |
public function get_customizer_url( $email, $shipment_status, $return_tab ) {
|
74 |
+
$preview_status = str_replace( '_', '', $shipment_status );
|
75 |
return add_query_arg( array(
|
76 |
'trackship-customizer' => '1',
|
77 |
'email' => $email,
|
78 |
'shipment_status' => $shipment_status,
|
79 |
'autofocus[section]' => 'trackship_shipment_status_email',
|
80 |
+
'url' => urlencode( add_query_arg( array( 'wcast-' . $preview_status . '-email-customizer-preview' => '1' ), home_url( '/' ) ) ),
|
81 |
'return' => urlencode( $this->get_email_settings_page_url($return_tab) ),
|
82 |
), admin_url( 'customize.php' ) );
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
* Get WooCommerce email settings page URL
|
87 |
+
*
|
|
|
88 |
* @return string
|
89 |
*/
|
90 |
+
public function get_email_settings_page_url( $return_tab ) {
|
91 |
return admin_url( 'admin.php?page=trackship-for-woocommerce&tab=' . $return_tab );
|
92 |
}
|
93 |
|
94 |
/**
|
95 |
+
* Code for initialize default value for customizer
|
96 |
*/
|
97 |
public function wcast_generate_defaults() {
|
98 |
$customizer_defaults = array(
|
183 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_enable_intransit_email]',
|
184 |
array(
|
185 |
'label' => __( 'Enable In Transit email', 'woo-advanced-shipment-tracking' ),
|
186 |
+
'description' => '',
|
187 |
'section' => 'trackship_shipment_status_email',
|
188 |
'type' => 'checkbox',
|
189 |
'active_callback' => array( $this, 'active_callback' ),
|
226 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_email_subject]',
|
227 |
array(
|
228 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
229 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
230 |
'section' => 'trackship_shipment_status_email',
|
231 |
'type' => 'text',
|
232 |
'input_attrs' => array(
|
250 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_email_heading]',
|
251 |
array(
|
252 |
'label' => __( 'Email heading', 'woocommerce' ),
|
253 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
254 |
'section' => 'trackship_shipment_status_email',
|
255 |
'type' => 'text',
|
256 |
'input_attrs' => array(
|
274 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_intransit_email_settings[wcast_intransit_email_content]',
|
275 |
array(
|
276 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
277 |
+
'description' => '',
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'input_attrs' => array(
|
280 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
314 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_show_order_details]',
|
315 |
array(
|
316 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
317 |
+
'description' => '',
|
318 |
'section' => 'trackship_shipment_status_email',
|
319 |
'type' => 'checkbox',
|
320 |
'active_callback' => array( $this, 'active_callback' ),
|
333 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_hide_shipping_item_price]',
|
334 |
array(
|
335 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
336 |
+
'description' => '',
|
337 |
'section' => 'trackship_shipment_status_email',
|
338 |
'type' => 'checkbox',
|
339 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
352 |
$wp_customize->add_control( 'wcast_intransit_email_settings[wcast_intransit_show_shipping_address]',
|
353 |
array(
|
354 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
355 |
+
'description' => '',
|
356 |
'section' => 'trackship_shipment_status_email',
|
357 |
'type' => 'checkbox',
|
358 |
'active_callback' => array( $this, 'active_callback' ),
|
376 |
'input_attrs' => array(
|
377 |
'class' => '',
|
378 |
'style' => '',
|
379 |
+
'placeholder' => '',
|
380 |
),
|
381 |
'active_callback' => array( $this, 'active_callback' ),
|
382 |
)
|
383 |
);
|
384 |
}
|
385 |
|
386 |
+
public function active_callback() {
|
387 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
388 |
}
|
389 |
|
390 |
+
public function active_callback_only_show_order_details() {
|
391 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
392 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_show_order_details', $this->defaults['wcast_intransit_show_order_details'] );
|
393 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
394 |
}
|
395 |
|
396 |
/**
|
397 |
* Set up preview
|
398 |
+
*
|
|
|
399 |
* @return void
|
400 |
*/
|
401 |
public function set_up_preview() {
|
402 |
// Make sure this is own preview request.
|
403 |
+
if ( ! $this->is_own_preview_request() ) {
|
404 |
+
return;
|
405 |
+
}
|
406 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/intransit_preview.php';
|
407 |
+
exit;
|
408 |
}
|
409 |
|
410 |
/**
|
411 |
+
* Code for preview of in transit email
|
412 |
*/
|
413 |
+
public function preview_intransit_email() {
|
414 |
|
415 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
416 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
417 |
|
418 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_email_heading', $this->defaults['wcast_intransit_email_heading'] );
|
419 |
+
|
420 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_email_content', $this->defaults['wcast_intransit_email_content'] );
|
421 |
+
|
422 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_show_order_details', $this->defaults['wcast_intransit_show_order_details'] );
|
423 |
+
|
424 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_hide_shipping_item_price', $this->defaults['wcast_intransit_hide_shipping_item_price'] );
|
425 |
+
|
426 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_show_shipping_address', $this->defaults['wcast_intransit_show_shipping_address'] );
|
427 |
|
428 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
429 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
430 |
+
echo wp_kses_post( $content );
|
431 |
return;
|
432 |
}
|
433 |
|
434 |
$order = wc_get_order( $preview_id );
|
435 |
|
436 |
+
if ( !$order ) {
|
437 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
438 |
+
echo wp_kses_post( $content );
|
439 |
return;
|
440 |
}
|
441 |
|
443 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
444 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
445 |
|
446 |
+
$wcast_intransit_analytics_link = $ast->get_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_analytics_link', '' );
|
447 |
+
|
448 |
+
if ( $wcast_intransit_analytics_link ) {
|
449 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
450 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
451 |
}
|
452 |
|
453 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
454 |
+
|
455 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'in_transit' );
|
456 |
+
|
457 |
+
if ( $wcast_show_order_details ) {
|
458 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
459 |
+
}
|
460 |
+
|
461 |
+
if ( $wcast_show_shipping_address ) {
|
462 |
+
$message .= $ast->order_shipping_details_template( $order );
|
463 |
+
}
|
464 |
|
465 |
$mailer = WC()->mailer();
|
466 |
// create a new email
|
467 |
$email = new WC_Email();
|
468 |
|
469 |
// wrap the content with the email template and then add styles
|
470 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
471 |
}
|
472 |
|
473 |
/**
|
474 |
+
* Code for append analytics link in email content
|
475 |
*/
|
476 |
+
public function _appendCampaignToString( $match ) {
|
477 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
478 |
+
$wcast_intransit_analytics_link = $ast->get_option_value_from_array( 'wcast_intransit_email_settings', 'wcast_intransit_analytics_link', '' );
|
479 |
|
480 |
$url = $match[2];
|
481 |
if (strpos($url, '?') === false) {
|
482 |
$url .= '?';
|
483 |
}
|
484 |
$url .= $wcast_intransit_analytics_link;
|
485 |
+
return $match[1] . $url . $match[3];
|
486 |
}
|
487 |
}
|
488 |
/**
|
489 |
* Initialise our Customizer settings
|
490 |
*/
|
491 |
|
492 |
+
$wcast_intransit_customizer_email = new Wcast_Intransit_Customizer_Email();
|
includes/customizer/class-wc-late-shipments-email-customizer.php
CHANGED
@@ -7,19 +7,21 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
*/
|
24 |
public function wcast_generate_defaults() {
|
25 |
$customizer_defaults = array(
|
@@ -43,4 +45,4 @@ class wcast_late_shipments_customizer_email {
|
|
43 |
* Initialise our Customizer settings
|
44 |
*/
|
45 |
|
46 |
-
$wcast_late_shipments_settings = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Late_Shipments_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
}
|
22 |
|
23 |
/**
|
24 |
+
* Code for initialize default value for customizer
|
25 |
*/
|
26 |
public function wcast_generate_defaults() {
|
27 |
$customizer_defaults = array(
|
45 |
* Initialise our Customizer settings
|
46 |
*/
|
47 |
|
48 |
+
$wcast_late_shipments_settings = new Wcast_Late_Shipments_Customizer_Email();
|
includes/customizer/class-wc-onhold-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -46,8 +50,7 @@ class wcast_onhold_customizer_email {
|
|
46 |
|
47 |
/**
|
48 |
* Checks to see if we are opening our custom customizer preview
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
* @return bool
|
52 |
*/
|
53 |
public function is_own_preview_request() {
|
@@ -56,16 +59,15 @@ class wcast_onhold_customizer_email {
|
|
56 |
|
57 |
/**
|
58 |
* Checks to see if we are opening our custom customizer controls
|
59 |
-
*
|
60 |
-
* @access public
|
61 |
* @return bool
|
62 |
*/
|
63 |
public function is_own_customizer_request() {
|
64 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
*/
|
70 |
public function wcast_generate_defaults() {
|
71 |
$customizer_defaults = array(
|
@@ -105,7 +107,7 @@ class wcast_onhold_customizer_email {
|
|
105 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_enable_onhold_email]',
|
106 |
array(
|
107 |
'label' => __( 'Enable On Hold email', 'woo-advanced-shipment-tracking' ),
|
108 |
-
'description' =>
|
109 |
'section' => 'trackship_shipment_status_email',
|
110 |
'type' => 'checkbox',
|
111 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -148,7 +150,7 @@ class wcast_onhold_customizer_email {
|
|
148 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_email_subject]',
|
149 |
array(
|
150 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
151 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
152 |
'section' => 'trackship_shipment_status_email',
|
153 |
'type' => 'text',
|
154 |
'input_attrs' => array(
|
@@ -172,7 +174,7 @@ class wcast_onhold_customizer_email {
|
|
172 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_email_heading]',
|
173 |
array(
|
174 |
'label' => __( 'Email heading', 'woocommerce' ),
|
175 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
176 |
'section' => 'trackship_shipment_status_email',
|
177 |
'type' => 'text',
|
178 |
'input_attrs' => array(
|
@@ -196,7 +198,7 @@ class wcast_onhold_customizer_email {
|
|
196 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_onhold_email_settings[wcast_onhold_email_content]',
|
197 |
array(
|
198 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
199 |
-
'description' =>
|
200 |
'section' => 'trackship_shipment_status_email',
|
201 |
'input_attrs' => array(
|
202 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -236,7 +238,7 @@ class wcast_onhold_customizer_email {
|
|
236 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_show_order_details]',
|
237 |
array(
|
238 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
239 |
-
'description' =>
|
240 |
'section' => 'trackship_shipment_status_email',
|
241 |
'type' => 'checkbox',
|
242 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -255,7 +257,7 @@ class wcast_onhold_customizer_email {
|
|
255 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_hide_shipping_item_price]',
|
256 |
array(
|
257 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' =>
|
259 |
'section' => 'trackship_shipment_status_email',
|
260 |
'type' => 'checkbox',
|
261 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -274,7 +276,7 @@ class wcast_onhold_customizer_email {
|
|
274 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_show_shipping_address]',
|
275 |
array(
|
276 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
277 |
-
'description' =>
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'type' => 'checkbox',
|
280 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -298,59 +300,65 @@ class wcast_onhold_customizer_email {
|
|
298 |
'input_attrs' => array(
|
299 |
'class' => '',
|
300 |
'style' => '',
|
301 |
-
'placeholder' =>
|
302 |
),
|
303 |
'active_callback' => array( $this, 'active_callback' ),
|
304 |
)
|
305 |
);
|
306 |
}
|
307 |
|
308 |
-
public function active_callback(){
|
309 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
310 |
}
|
311 |
|
312 |
-
public function active_callback_only_show_order_details(){
|
313 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
314 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_show_order_details'
|
315 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
316 |
}
|
317 |
/**
|
318 |
* Set up preview
|
319 |
-
*
|
320 |
-
* @access public
|
321 |
* @return void
|
322 |
*/
|
323 |
public function set_up_preview() {
|
324 |
// Make sure this is own preview request.
|
325 |
-
if ( ! $this->is_own_preview_request() )
|
326 |
-
|
|
|
|
|
|
|
327 |
}
|
328 |
|
329 |
/**
|
330 |
-
*
|
331 |
*/
|
332 |
-
public function preview_onhold_email(){
|
333 |
|
334 |
-
$preview_id
|
335 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
336 |
|
337 |
-
$email_heading = $ast->get_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_email_heading'
|
338 |
-
|
339 |
-
$
|
340 |
-
|
341 |
-
$
|
|
|
|
|
|
|
|
|
342 |
|
343 |
-
if(
|
344 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
345 |
-
echo $content;
|
346 |
return;
|
347 |
}
|
348 |
|
349 |
$order = wc_get_order( $preview_id );
|
350 |
|
351 |
-
if(!$order){
|
352 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
353 |
-
echo $content;
|
354 |
return;
|
355 |
}
|
356 |
|
@@ -358,41 +366,49 @@ class wcast_onhold_customizer_email {
|
|
358 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
359 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
360 |
|
361 |
-
$wcast_onhold_analytics_link = $ast->get_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_analytics_link','');
|
362 |
-
|
|
|
363 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
364 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
365 |
}
|
366 |
|
367 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
|
|
368 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'on_hold' );
|
369 |
-
|
370 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
$mailer = WC()->mailer();
|
373 |
// create a new email
|
374 |
$email = new WC_Email();
|
375 |
|
376 |
// wrap the content with the email template and then add styles
|
377 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
378 |
}
|
379 |
|
380 |
/**
|
381 |
-
*
|
382 |
*/
|
383 |
-
public function _appendCampaignToString($match){
|
384 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
385 |
-
$wcast_onhold_analytics_link = $ast->get_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_analytics_link','');
|
386 |
|
387 |
$url = $match[2];
|
388 |
if (strpos($url, '?') === false) {
|
389 |
$url .= '?';
|
390 |
}
|
391 |
$url .= $wcast_onhold_analytics_link;
|
392 |
-
return $match[1]
|
393 |
}
|
394 |
}
|
395 |
/**
|
396 |
* Initialise our Customizer settings
|
397 |
*/
|
398 |
-
new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Onhold_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
50 |
|
51 |
/**
|
52 |
* Checks to see if we are opening our custom customizer preview
|
53 |
+
*
|
|
|
54 |
* @return bool
|
55 |
*/
|
56 |
public function is_own_preview_request() {
|
59 |
|
60 |
/**
|
61 |
* Checks to see if we are opening our custom customizer controls
|
62 |
+
*
|
|
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function is_own_customizer_request() {
|
66 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
+
* Code for initialize default value for customizer
|
71 |
*/
|
72 |
public function wcast_generate_defaults() {
|
73 |
$customizer_defaults = array(
|
107 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_enable_onhold_email]',
|
108 |
array(
|
109 |
'label' => __( 'Enable On Hold email', 'woo-advanced-shipment-tracking' ),
|
110 |
+
'description' => '',
|
111 |
'section' => 'trackship_shipment_status_email',
|
112 |
'type' => 'checkbox',
|
113 |
'active_callback' => array( $this, 'active_callback' ),
|
150 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_email_subject]',
|
151 |
array(
|
152 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
153 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
154 |
'section' => 'trackship_shipment_status_email',
|
155 |
'type' => 'text',
|
156 |
'input_attrs' => array(
|
174 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_email_heading]',
|
175 |
array(
|
176 |
'label' => __( 'Email heading', 'woocommerce' ),
|
177 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
178 |
'section' => 'trackship_shipment_status_email',
|
179 |
'type' => 'text',
|
180 |
'input_attrs' => array(
|
198 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_onhold_email_settings[wcast_onhold_email_content]',
|
199 |
array(
|
200 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
201 |
+
'description' => '',
|
202 |
'section' => 'trackship_shipment_status_email',
|
203 |
'input_attrs' => array(
|
204 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
238 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_show_order_details]',
|
239 |
array(
|
240 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
241 |
+
'description' => '',
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
257 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_hide_shipping_item_price]',
|
258 |
array(
|
259 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
260 |
+
'description' => '',
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
276 |
$wp_customize->add_control( 'wcast_onhold_email_settings[wcast_onhold_show_shipping_address]',
|
277 |
array(
|
278 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'description' => '',
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback' ),
|
300 |
'input_attrs' => array(
|
301 |
'class' => '',
|
302 |
'style' => '',
|
303 |
+
'placeholder' => '',
|
304 |
),
|
305 |
'active_callback' => array( $this, 'active_callback' ),
|
306 |
)
|
307 |
);
|
308 |
}
|
309 |
|
310 |
+
public function active_callback() {
|
311 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
312 |
}
|
313 |
|
314 |
+
public function active_callback_only_show_order_details() {
|
315 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
316 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_show_order_details', $this->defaults['wcast_onhold_show_order_details'] );
|
317 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
318 |
}
|
319 |
/**
|
320 |
* Set up preview
|
321 |
+
*
|
|
|
322 |
* @return void
|
323 |
*/
|
324 |
public function set_up_preview() {
|
325 |
// Make sure this is own preview request.
|
326 |
+
if ( ! $this->is_own_preview_request() ) {
|
327 |
+
return;
|
328 |
+
}
|
329 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/onhold_preview.php';
|
330 |
+
exit;
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
+
* Code for preview of in transit email
|
335 |
*/
|
336 |
+
public function preview_onhold_email() {
|
337 |
|
338 |
+
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
339 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
340 |
|
341 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_email_heading', $this->defaults['wcast_onhold_email_heading'] );
|
342 |
+
|
343 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_email_content', $this->defaults['wcast_onhold_email_content'] );
|
344 |
+
|
345 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_show_order_details', $this->defaults['wcast_onhold_show_order_details'] );
|
346 |
+
|
347 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_hide_shipping_item_price', $this->defaults['wcast_onhold_hide_shipping_item_price'] );
|
348 |
+
|
349 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_show_shipping_address', $this->defaults['wcast_onhold_show_shipping_address'] );
|
350 |
|
351 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
352 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
353 |
+
echo wp_kses_post( $content );
|
354 |
return;
|
355 |
}
|
356 |
|
357 |
$order = wc_get_order( $preview_id );
|
358 |
|
359 |
+
if ( !$order ) {
|
360 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
361 |
+
echo wp_kses_post( $content );
|
362 |
return;
|
363 |
}
|
364 |
|
366 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
367 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
368 |
|
369 |
+
$wcast_onhold_analytics_link = $ast->get_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_analytics_link', '' );
|
370 |
+
|
371 |
+
if ( $wcast_onhold_analytics_link ) {
|
372 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
373 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
374 |
}
|
375 |
|
376 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
377 |
+
|
378 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'on_hold' );
|
379 |
+
|
380 |
+
if ( $wcast_show_order_details ) {
|
381 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
382 |
+
}
|
383 |
+
|
384 |
+
if ( $wcast_show_shipping_address ) {
|
385 |
+
$message .= $ast->order_shipping_details_template( $order );
|
386 |
+
}
|
387 |
|
388 |
$mailer = WC()->mailer();
|
389 |
// create a new email
|
390 |
$email = new WC_Email();
|
391 |
|
392 |
// wrap the content with the email template and then add styles
|
393 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
394 |
}
|
395 |
|
396 |
/**
|
397 |
+
* Code for append analytics link in email content
|
398 |
*/
|
399 |
+
public function _appendCampaignToString( $match ) {
|
400 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
401 |
+
$wcast_onhold_analytics_link = $ast->get_option_value_from_array( 'wcast_onhold_email_settings', 'wcast_onhold_analytics_link', '' );
|
402 |
|
403 |
$url = $match[2];
|
404 |
if (strpos($url, '?') === false) {
|
405 |
$url .= '?';
|
406 |
}
|
407 |
$url .= $wcast_onhold_analytics_link;
|
408 |
+
return $match[1] . $url . $match[3];
|
409 |
}
|
410 |
}
|
411 |
/**
|
412 |
* Initialise our Customizer settings
|
413 |
*/
|
414 |
+
new Wcast_Onhold_Customizer_Email();
|
includes/customizer/class-wc-outfordelivery-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -46,8 +50,7 @@ class wcast_outfordelivery_customizer_email {
|
|
46 |
|
47 |
/**
|
48 |
* Checks to see if we are opening our custom customizer preview
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
* @return bool
|
52 |
*/
|
53 |
public function is_own_preview_request() {
|
@@ -56,16 +59,15 @@ class wcast_outfordelivery_customizer_email {
|
|
56 |
|
57 |
/**
|
58 |
* Checks to see if we are opening our custom customizer controls
|
59 |
-
*
|
60 |
-
* @access public
|
61 |
* @return bool
|
62 |
*/
|
63 |
public function is_own_customizer_request() {
|
64 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
*/
|
70 |
public function wcast_generate_defaults() {
|
71 |
$customizer_defaults = array(
|
@@ -104,7 +106,7 @@ class wcast_outfordelivery_customizer_email {
|
|
104 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_enable_outfordelivery_email]',
|
105 |
array(
|
106 |
'label' => __( 'Enable Out For Delivery email', 'woo-advanced-shipment-tracking' ),
|
107 |
-
'description' =>
|
108 |
'section' => 'trackship_shipment_status_email',
|
109 |
'type' => 'checkbox',
|
110 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -147,7 +149,7 @@ class wcast_outfordelivery_customizer_email {
|
|
147 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_subject]',
|
148 |
array(
|
149 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
150 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
151 |
'section' => 'trackship_shipment_status_email',
|
152 |
'type' => 'text',
|
153 |
'input_attrs' => array(
|
@@ -171,7 +173,7 @@ class wcast_outfordelivery_customizer_email {
|
|
171 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_heading]',
|
172 |
array(
|
173 |
'label' => __( 'Email heading', 'woocommerce' ),
|
174 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
175 |
'section' => 'trackship_shipment_status_email',
|
176 |
'type' => 'text',
|
177 |
'input_attrs' => array(
|
@@ -195,7 +197,7 @@ class wcast_outfordelivery_customizer_email {
|
|
195 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_content]',
|
196 |
array(
|
197 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
198 |
-
'description' =>
|
199 |
'section' => 'trackship_shipment_status_email',
|
200 |
'input_attrs' => array(
|
201 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -235,7 +237,7 @@ class wcast_outfordelivery_customizer_email {
|
|
235 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_show_order_details]',
|
236 |
array(
|
237 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
238 |
-
'description' =>
|
239 |
'section' => 'trackship_shipment_status_email',
|
240 |
'type' => 'checkbox',
|
241 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -254,7 +256,7 @@ class wcast_outfordelivery_customizer_email {
|
|
254 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_hide_shipping_item_price]',
|
255 |
array(
|
256 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
257 |
-
'description' =>
|
258 |
'section' => 'trackship_shipment_status_email',
|
259 |
'type' => 'checkbox',
|
260 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -273,7 +275,7 @@ class wcast_outfordelivery_customizer_email {
|
|
273 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_show_shipping_address]',
|
274 |
array(
|
275 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
276 |
-
'description' =>
|
277 |
'section' => 'trackship_shipment_status_email',
|
278 |
'type' => 'checkbox',
|
279 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -297,60 +299,62 @@ class wcast_outfordelivery_customizer_email {
|
|
297 |
'input_attrs' => array(
|
298 |
'class' => '',
|
299 |
'style' => '',
|
300 |
-
'placeholder' =>
|
301 |
),
|
302 |
'active_callback' => array( $this, 'active_callback' ),
|
303 |
)
|
304 |
);
|
305 |
}
|
306 |
|
307 |
-
public function active_callback(){
|
308 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
309 |
}
|
310 |
|
311 |
-
public function active_callback_only_show_order_details(){
|
312 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
313 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_show_order_details'
|
314 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
315 |
}
|
316 |
|
317 |
/**
|
318 |
* Set up preview
|
319 |
-
*
|
320 |
-
* @access public
|
321 |
* @return void
|
322 |
*/
|
323 |
public function set_up_preview() {
|
324 |
// Make sure this is own preview request.
|
325 |
-
if ( ! $this->is_own_preview_request() )
|
326 |
-
|
|
|
|
|
|
|
327 |
}
|
328 |
|
329 |
/**
|
330 |
-
*
|
331 |
*/
|
332 |
-
public function preview_outfordelivery_email(){
|
333 |
|
334 |
-
$preview_id
|
335 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
336 |
|
337 |
-
$email_heading = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_email_heading'
|
338 |
-
$email_content = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_email_content'
|
339 |
-
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_show_order_details'
|
340 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_hide_shipping_item_price'
|
341 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_show_shipping_address'
|
342 |
|
343 |
-
if(
|
344 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
345 |
-
echo $content;
|
346 |
return;
|
347 |
}
|
348 |
|
349 |
$order = wc_get_order( $preview_id );
|
350 |
|
351 |
-
if(!$order){
|
352 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
353 |
-
echo $content;
|
354 |
return;
|
355 |
}
|
356 |
|
@@ -358,42 +362,48 @@ class wcast_outfordelivery_customizer_email {
|
|
358 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
359 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
360 |
|
361 |
-
$wcast_outfordelivery_analytics_link = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_analytics_link','');
|
362 |
-
if($wcast_outfordelivery_analytics_link){
|
363 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
364 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
365 |
}
|
366 |
|
367 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
368 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'out_for_delivery' );
|
369 |
-
|
370 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
$mailer = WC()->mailer();
|
373 |
// create a new email
|
374 |
$email = new WC_Email();
|
375 |
|
376 |
// wrap the content with the email template and then add styles
|
377 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
378 |
}
|
379 |
|
380 |
/**
|
381 |
-
*
|
382 |
*/
|
383 |
-
public function _appendCampaignToString($match){
|
384 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
385 |
-
$wcast_outfordelivery_analytics_link = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_analytics_link','');
|
386 |
|
387 |
$url = $match[2];
|
388 |
if (strpos($url, '?') === false) {
|
389 |
$url .= '?';
|
390 |
}
|
391 |
$url .= $wcast_outfordelivery_analytics_link;
|
392 |
-
return $match[1]
|
393 |
}
|
394 |
}
|
395 |
/**
|
396 |
* Initialise our Customizer settings
|
397 |
*/
|
398 |
|
399 |
-
$wcast_outfordelivery_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Outfordelivery_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
50 |
|
51 |
/**
|
52 |
* Checks to see if we are opening our custom customizer preview
|
53 |
+
*
|
|
|
54 |
* @return bool
|
55 |
*/
|
56 |
public function is_own_preview_request() {
|
59 |
|
60 |
/**
|
61 |
* Checks to see if we are opening our custom customizer controls
|
62 |
+
*
|
|
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function is_own_customizer_request() {
|
66 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
+
* Code for initialize default value for customizer
|
71 |
*/
|
72 |
public function wcast_generate_defaults() {
|
73 |
$customizer_defaults = array(
|
106 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_enable_outfordelivery_email]',
|
107 |
array(
|
108 |
'label' => __( 'Enable Out For Delivery email', 'woo-advanced-shipment-tracking' ),
|
109 |
+
'description' => '',
|
110 |
'section' => 'trackship_shipment_status_email',
|
111 |
'type' => 'checkbox',
|
112 |
'active_callback' => array( $this, 'active_callback' ),
|
149 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_subject]',
|
150 |
array(
|
151 |
'label' => __( 'Email Subject', 'woo-advanced-shipment-tracking' ),
|
152 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
153 |
'section' => 'trackship_shipment_status_email',
|
154 |
'type' => 'text',
|
155 |
'input_attrs' => array(
|
173 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_heading]',
|
174 |
array(
|
175 |
'label' => __( 'Email heading', 'woocommerce' ),
|
176 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
177 |
'section' => 'trackship_shipment_status_email',
|
178 |
'type' => 'text',
|
179 |
'input_attrs' => array(
|
197 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_outfordelivery_email_settings[wcast_outfordelivery_email_content]',
|
198 |
array(
|
199 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
200 |
+
'description' => '',
|
201 |
'section' => 'trackship_shipment_status_email',
|
202 |
'input_attrs' => array(
|
203 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
237 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_show_order_details]',
|
238 |
array(
|
239 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
240 |
+
'description' => '',
|
241 |
'section' => 'trackship_shipment_status_email',
|
242 |
'type' => 'checkbox',
|
243 |
'active_callback' => array( $this, 'active_callback' ),
|
256 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_hide_shipping_item_price]',
|
257 |
array(
|
258 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
259 |
+
'description' => '',
|
260 |
'section' => 'trackship_shipment_status_email',
|
261 |
'type' => 'checkbox',
|
262 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
275 |
$wp_customize->add_control( 'wcast_outfordelivery_email_settings[wcast_outfordelivery_show_shipping_address]',
|
276 |
array(
|
277 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
278 |
+
'description' => '',
|
279 |
'section' => 'trackship_shipment_status_email',
|
280 |
'type' => 'checkbox',
|
281 |
'active_callback' => array( $this, 'active_callback' ),
|
299 |
'input_attrs' => array(
|
300 |
'class' => '',
|
301 |
'style' => '',
|
302 |
+
'placeholder' => '',
|
303 |
),
|
304 |
'active_callback' => array( $this, 'active_callback' ),
|
305 |
)
|
306 |
);
|
307 |
}
|
308 |
|
309 |
+
public function active_callback() {
|
310 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
311 |
}
|
312 |
|
313 |
+
public function active_callback_only_show_order_details() {
|
314 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
315 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_show_order_details', $this->defaults['wcast_outfordelivery_show_order_details'] );
|
316 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
317 |
}
|
318 |
|
319 |
/**
|
320 |
* Set up preview
|
321 |
+
*
|
|
|
322 |
* @return void
|
323 |
*/
|
324 |
public function set_up_preview() {
|
325 |
// Make sure this is own preview request.
|
326 |
+
if ( ! $this->is_own_preview_request() ) {
|
327 |
+
return;
|
328 |
+
}
|
329 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/outfordelivery_preview.php';
|
330 |
+
exit;
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
+
* Code for preview of out for delivery email
|
335 |
*/
|
336 |
+
public function preview_outfordelivery_email() {
|
337 |
|
338 |
+
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
339 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
340 |
|
341 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_email_heading', $this->defaults['wcast_outfordelivery_email_heading'] );
|
342 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_email_content', $this->defaults['wcast_outfordelivery_email_content'] );
|
343 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_show_order_details', $this->defaults['wcast_outfordelivery_show_order_details'] );
|
344 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_hide_shipping_item_price', $this->defaults['wcast_outfordelivery_hide_shipping_item_price'] );
|
345 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_show_shipping_address', $this->defaults['wcast_outfordelivery_show_shipping_address'] );
|
346 |
|
347 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
348 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
349 |
+
echo wp_kses_post( $content );
|
350 |
return;
|
351 |
}
|
352 |
|
353 |
$order = wc_get_order( $preview_id );
|
354 |
|
355 |
+
if ( !$order ) {
|
356 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
357 |
+
echo wp_kses_post( $content );
|
358 |
return;
|
359 |
}
|
360 |
|
362 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
363 |
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
364 |
|
365 |
+
$wcast_outfordelivery_analytics_link = $ast->get_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_analytics_link', '' );
|
366 |
+
if ( $wcast_outfordelivery_analytics_link ) {
|
367 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
368 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
369 |
}
|
370 |
|
371 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
372 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'out_for_delivery' );
|
373 |
+
|
374 |
+
if ( $wcast_show_order_details ) {
|
375 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
376 |
+
}
|
377 |
+
|
378 |
+
if ( $wcast_show_shipping_address ) {
|
379 |
+
$message .= $ast->order_shipping_details_template( $order );
|
380 |
+
}
|
381 |
|
382 |
$mailer = WC()->mailer();
|
383 |
// create a new email
|
384 |
$email = new WC_Email();
|
385 |
|
386 |
// wrap the content with the email template and then add styles
|
387 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
388 |
}
|
389 |
|
390 |
/**
|
391 |
+
* Code for append analytics link in email content
|
392 |
*/
|
393 |
+
public function _appendCampaignToString( $match ) {
|
394 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
395 |
+
$wcast_outfordelivery_analytics_link = $ast->get_option_value_from_array( 'wcast_outfordelivery_email_settings', 'wcast_outfordelivery_analytics_link', '' );
|
396 |
|
397 |
$url = $match[2];
|
398 |
if (strpos($url, '?') === false) {
|
399 |
$url .= '?';
|
400 |
}
|
401 |
$url .= $wcast_outfordelivery_analytics_link;
|
402 |
+
return $match[1] . $url . $match[3];
|
403 |
}
|
404 |
}
|
405 |
/**
|
406 |
* Initialise our Customizer settings
|
407 |
*/
|
408 |
|
409 |
+
$wcast_outfordelivery_customizer_email = new Wcast_Outfordelivery_Customizer_Email();
|
includes/customizer/class-wc-partial-shipped-email-customizer.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
|
12 |
|
13 |
// Get our default values
|
@@ -19,7 +19,9 @@ class wcast_partial_shipped_customizer_email {
|
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
23 |
|
24 |
// Register our sections
|
25 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -65,8 +67,7 @@ class wcast_partial_shipped_customizer_email {
|
|
65 |
|
66 |
/**
|
67 |
* Checks to see if we are opening our custom customizer preview
|
68 |
-
*
|
69 |
-
* @access public
|
70 |
* @return bool
|
71 |
*/
|
72 |
public function is_own_preview_request() {
|
@@ -75,12 +76,11 @@ class wcast_partial_shipped_customizer_email {
|
|
75 |
|
76 |
/**
|
77 |
* Checks to see if we are opening our custom customizer controls
|
78 |
-
*
|
79 |
-
* @access public
|
80 |
* @return bool
|
81 |
*/
|
82 |
public function is_own_customizer_request() {
|
83 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
84 |
}
|
85 |
|
86 |
/**
|
@@ -100,8 +100,7 @@ class wcast_partial_shipped_customizer_email {
|
|
100 |
|
101 |
/**
|
102 |
* Get WooCommerce email settings page URL
|
103 |
-
*
|
104 |
-
* @access public
|
105 |
* @return string
|
106 |
*/
|
107 |
public function get_email_settings_page_url() {
|
@@ -109,7 +108,7 @@ class wcast_partial_shipped_customizer_email {
|
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
-
*
|
113 |
*/
|
114 |
public function wcast_generate_defaults() {
|
115 |
$customizer_defaults = array(
|
@@ -191,7 +190,7 @@ class wcast_partial_shipped_customizer_email {
|
|
191 |
$wp_customize->add_control( 'customizer_partial_shipped_order_settings_enabled',
|
192 |
array(
|
193 |
'label' => __( 'Enable Partially Shipped order status email', 'woo-advanced-shipment-tracking' ),
|
194 |
-
'description' =>
|
195 |
'section' => 'custom_order_status_email',
|
196 |
'type' => 'checkbox',
|
197 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -210,7 +209,7 @@ class wcast_partial_shipped_customizer_email {
|
|
210 |
$wp_customize->add_control( 'woocommerce_customer_partial_shipped_order_settings[subject]',
|
211 |
array(
|
212 |
'label' => __( 'Subject', 'woocommerce' ),
|
213 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
214 |
'section' => 'custom_order_status_email',
|
215 |
'type' => 'text',
|
216 |
'input_attrs' => array(
|
@@ -234,7 +233,7 @@ class wcast_partial_shipped_customizer_email {
|
|
234 |
$wp_customize->add_control( 'woocommerce_customer_partial_shipped_order_settings[heading]',
|
235 |
array(
|
236 |
'label' => __( 'Email heading', 'woocommerce' ),
|
237 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
238 |
'section' => 'custom_order_status_email',
|
239 |
'type' => 'text',
|
240 |
'input_attrs' => array(
|
@@ -259,7 +258,7 @@ class wcast_partial_shipped_customizer_email {
|
|
259 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_partial_shipped_order_settings[wcast_partial_shipped_email_content]',
|
260 |
array(
|
261 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
262 |
-
'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
|
263 |
'section' => 'custom_order_status_email',
|
264 |
'input_attrs' => array(
|
265 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -287,42 +286,44 @@ class wcast_partial_shipped_customizer_email {
|
|
287 |
) );
|
288 |
}
|
289 |
|
290 |
-
public function active_callback(){
|
291 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
292 |
}
|
293 |
|
294 |
/**
|
295 |
* Set up preview
|
296 |
-
*
|
297 |
-
* @access public
|
298 |
* @return void
|
299 |
*/
|
300 |
public function set_up_preview() {
|
301 |
// Make sure this is own preview request.
|
302 |
-
if ( ! $this->is_own_preview_request() )
|
303 |
-
|
|
|
|
|
|
|
304 |
}
|
305 |
|
306 |
/**
|
307 |
-
*
|
308 |
*/
|
309 |
-
public function preview_partial_shipped_email(){
|
310 |
// Load WooCommerce emails.
|
311 |
$wc_emails = WC_Emails::instance();
|
312 |
$emails = $wc_emails->get_emails();
|
313 |
$preview_id = get_theme_mod('wcast_email_preview_order_id');
|
314 |
|
315 |
-
if(
|
316 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
317 |
-
echo $content;
|
318 |
return;
|
319 |
}
|
320 |
|
321 |
$order = wc_get_order( $preview_id );
|
322 |
|
323 |
-
if(!$order){
|
324 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
325 |
-
echo $content;
|
326 |
return;
|
327 |
}
|
328 |
|
@@ -361,13 +362,12 @@ class wcast_partial_shipped_customizer_email {
|
|
361 |
$content = $email->style_inline( $content );
|
362 |
$content = apply_filters( 'woocommerce_mail_content', $content );
|
363 |
|
364 |
-
echo $content;
|
365 |
}
|
366 |
|
367 |
/**
|
368 |
* Get WooCommerce order for preview
|
369 |
*
|
370 |
-
* @access public
|
371 |
* @param string $order_status
|
372 |
* @return object
|
373 |
*/
|
@@ -393,7 +393,7 @@ class wcast_partial_shipped_customizer_email {
|
|
393 |
'billing_country' => 'GB',
|
394 |
'billing_email' => 'sherlock@holmes.co.uk',
|
395 |
'billing_phone' => '02079304832',
|
396 |
-
'date_created' =>
|
397 |
'total' => 24.90,
|
398 |
) );
|
399 |
|
@@ -434,7 +434,7 @@ function ps_customizer() {
|
|
434 |
static $instance;
|
435 |
|
436 |
if ( ! isset( $instance ) ) {
|
437 |
-
$instance = new
|
438 |
}
|
439 |
|
440 |
return $instance;
|
@@ -451,16 +451,17 @@ add_action( 'customize_save_customizer_partial_shipped_order_settings_enabled',
|
|
451 |
|
452 |
/**
|
453 |
* Update Delivered order email enable/disable
|
454 |
-
*
|
455 |
*/
|
456 |
-
function woocommerce_customer_partial_shipped_order_settings_fun($data){
|
457 |
-
|
|
|
|
|
458 |
$partial_shipped_order_settings = get_option( 'woocommerce_customer_partial_shipped_order_settings');
|
459 |
|
460 |
-
if(isset($post_values['customizer_partial_shipped_order_settings_enabled']) && ($post_values['customizer_partial_shipped_order_settings_enabled']
|
461 |
$partial_shipped_order_settings['enabled'] = 'yes';
|
462 |
-
} else{
|
463 |
$partial_shipped_order_settings['enabled'] = 'no';
|
464 |
}
|
465 |
-
update_option( 'woocommerce_customer_partial_shipped_order_settings'
|
466 |
-
}
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Partial_Shipped_Customizer_Email {
|
11 |
|
12 |
|
13 |
// Get our default values
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
|
26 |
// Register our sections
|
27 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
67 |
|
68 |
/**
|
69 |
* Checks to see if we are opening our custom customizer preview
|
70 |
+
*
|
|
|
71 |
* @return bool
|
72 |
*/
|
73 |
public function is_own_preview_request() {
|
76 |
|
77 |
/**
|
78 |
* Checks to see if we are opening our custom customizer controls
|
79 |
+
*
|
|
|
80 |
* @return bool
|
81 |
*/
|
82 |
public function is_own_customizer_request() {
|
83 |
+
return isset( $_REQUEST['email'] ) && 'custom_order_status_email' === $_REQUEST['email'];
|
84 |
}
|
85 |
|
86 |
/**
|
100 |
|
101 |
/**
|
102 |
* Get WooCommerce email settings page URL
|
103 |
+
*
|
|
|
104 |
* @return string
|
105 |
*/
|
106 |
public function get_email_settings_page_url() {
|
108 |
}
|
109 |
|
110 |
/**
|
111 |
+
* Code for initialize default value for customizer
|
112 |
*/
|
113 |
public function wcast_generate_defaults() {
|
114 |
$customizer_defaults = array(
|
190 |
$wp_customize->add_control( 'customizer_partial_shipped_order_settings_enabled',
|
191 |
array(
|
192 |
'label' => __( 'Enable Partially Shipped order status email', 'woo-advanced-shipment-tracking' ),
|
193 |
+
'description' => '',
|
194 |
'section' => 'custom_order_status_email',
|
195 |
'type' => 'checkbox',
|
196 |
'active_callback' => array( $this, 'active_callback' ),
|
209 |
$wp_customize->add_control( 'woocommerce_customer_partial_shipped_order_settings[subject]',
|
210 |
array(
|
211 |
'label' => __( 'Subject', 'woocommerce' ),
|
212 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
213 |
'section' => 'custom_order_status_email',
|
214 |
'type' => 'text',
|
215 |
'input_attrs' => array(
|
233 |
$wp_customize->add_control( 'woocommerce_customer_partial_shipped_order_settings[heading]',
|
234 |
array(
|
235 |
'label' => __( 'Email heading', 'woocommerce' ),
|
236 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
237 |
'section' => 'custom_order_status_email',
|
238 |
'type' => 'text',
|
239 |
'input_attrs' => array(
|
258 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_partial_shipped_order_settings[wcast_partial_shipped_email_content]',
|
259 |
array(
|
260 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
261 |
+
'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
|
262 |
'section' => 'custom_order_status_email',
|
263 |
'input_attrs' => array(
|
264 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
286 |
) );
|
287 |
}
|
288 |
|
289 |
+
public function active_callback() {
|
290 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
291 |
}
|
292 |
|
293 |
/**
|
294 |
* Set up preview
|
295 |
+
*
|
|
|
296 |
* @return void
|
297 |
*/
|
298 |
public function set_up_preview() {
|
299 |
// Make sure this is own preview request.
|
300 |
+
if ( ! $this->is_own_preview_request() ) {
|
301 |
+
return;
|
302 |
+
}
|
303 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/partial_shipped_preview.php';
|
304 |
+
exit;
|
305 |
}
|
306 |
|
307 |
/**
|
308 |
+
* Code for preview of delivered order status email
|
309 |
*/
|
310 |
+
public function preview_partial_shipped_email() {
|
311 |
// Load WooCommerce emails.
|
312 |
$wc_emails = WC_Emails::instance();
|
313 |
$emails = $wc_emails->get_emails();
|
314 |
$preview_id = get_theme_mod('wcast_email_preview_order_id');
|
315 |
|
316 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
317 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
318 |
+
echo wp_kses_post( $content );
|
319 |
return;
|
320 |
}
|
321 |
|
322 |
$order = wc_get_order( $preview_id );
|
323 |
|
324 |
+
if ( !$order ) {
|
325 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
326 |
+
echo wp_kses_post( $content );
|
327 |
return;
|
328 |
}
|
329 |
|
362 |
$content = $email->style_inline( $content );
|
363 |
$content = apply_filters( 'woocommerce_mail_content', $content );
|
364 |
|
365 |
+
echo wp_kses_post( $content );
|
366 |
}
|
367 |
|
368 |
/**
|
369 |
* Get WooCommerce order for preview
|
370 |
*
|
|
|
371 |
* @param string $order_status
|
372 |
* @return object
|
373 |
*/
|
393 |
'billing_country' => 'GB',
|
394 |
'billing_email' => 'sherlock@holmes.co.uk',
|
395 |
'billing_phone' => '02079304832',
|
396 |
+
'date_created' => gmdate( 'Y-m-d H:i:s' ),
|
397 |
'total' => 24.90,
|
398 |
) );
|
399 |
|
434 |
static $instance;
|
435 |
|
436 |
if ( ! isset( $instance ) ) {
|
437 |
+
$instance = new Wcast_Partial_Shipped_Customizer_Email();
|
438 |
}
|
439 |
|
440 |
return $instance;
|
451 |
|
452 |
/**
|
453 |
* Update Delivered order email enable/disable
|
|
|
454 |
*/
|
455 |
+
function woocommerce_customer_partial_shipped_order_settings_fun( $data ) {
|
456 |
+
|
457 |
+
$customized = isset( $_POST['customized'] ) ? wc_clean( $_POST['customized'] ) : '';
|
458 |
+
$post_values = json_decode( wp_unslash( $customized ), true );
|
459 |
$partial_shipped_order_settings = get_option( 'woocommerce_customer_partial_shipped_order_settings');
|
460 |
|
461 |
+
if ( isset( $post_values['customizer_partial_shipped_order_settings_enabled'] ) && ( 1 == $post_values['customizer_partial_shipped_order_settings_enabled'] ) ) {
|
462 |
$partial_shipped_order_settings['enabled'] = 'yes';
|
463 |
+
} else {
|
464 |
$partial_shipped_order_settings['enabled'] = 'no';
|
465 |
}
|
466 |
+
update_option( 'woocommerce_customer_partial_shipped_order_settings', $partial_shipped_order_settings );
|
467 |
+
}
|
includes/customizer/class-wc-returntosender-email-customizer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
-
if(!$wc_ast_api_key)
|
|
|
|
|
18 |
|
19 |
// Register our sample default controls
|
20 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
21 |
|
22 |
// Only proceed if this is own request.
|
23 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
24 |
|
25 |
// Register our sections
|
26 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -47,8 +51,7 @@ class wcast_returntosender_customizer_email {
|
|
47 |
|
48 |
/**
|
49 |
* Checks to see if we are opening our custom customizer preview
|
50 |
-
*
|
51 |
-
* @access public
|
52 |
* @return bool
|
53 |
*/
|
54 |
public function is_own_preview_request() {
|
@@ -57,16 +60,15 @@ class wcast_returntosender_customizer_email {
|
|
57 |
|
58 |
/**
|
59 |
* Checks to see if we are opening our custom customizer controls
|
60 |
-
*
|
61 |
-
* @access public
|
62 |
* @return bool
|
63 |
*/
|
64 |
public function is_own_customizer_request() {
|
65 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
-
*
|
70 |
*/
|
71 |
public function wcast_generate_defaults() {
|
72 |
$customizer_defaults = array(
|
@@ -106,7 +108,7 @@ class wcast_returntosender_customizer_email {
|
|
106 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_enable_returntosender_email]',
|
107 |
array(
|
108 |
'label' => __( 'Enable Return To Sender email', 'woo-advanced-shipment-tracking' ),
|
109 |
-
'description' =>
|
110 |
'section' => 'trackship_shipment_status_email',
|
111 |
'type' => 'checkbox',
|
112 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -149,7 +151,7 @@ class wcast_returntosender_customizer_email {
|
|
149 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_email_subject]',
|
150 |
array(
|
151 |
'label' => __( 'Email Subject', 'woocommerce' ),
|
152 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
153 |
'section' => 'trackship_shipment_status_email',
|
154 |
'type' => 'text',
|
155 |
'input_attrs' => array(
|
@@ -173,7 +175,7 @@ class wcast_returntosender_customizer_email {
|
|
173 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_email_heading]',
|
174 |
array(
|
175 |
'label' => __( 'Email heading', 'woocommerce' ),
|
176 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
177 |
'section' => 'trackship_shipment_status_email',
|
178 |
'type' => 'text',
|
179 |
'input_attrs' => array(
|
@@ -197,7 +199,7 @@ class wcast_returntosender_customizer_email {
|
|
197 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_returntosender_email_settings[wcast_returntosender_email_content]',
|
198 |
array(
|
199 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
200 |
-
'description' =>
|
201 |
'section' => 'trackship_shipment_status_email',
|
202 |
'input_attrs' => array(
|
203 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -236,7 +238,7 @@ class wcast_returntosender_customizer_email {
|
|
236 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_show_order_details]',
|
237 |
array(
|
238 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
239 |
-
'description' =>
|
240 |
'section' => 'trackship_shipment_status_email',
|
241 |
'type' => 'checkbox',
|
242 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -255,7 +257,7 @@ class wcast_returntosender_customizer_email {
|
|
255 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_hide_shipping_item_price]',
|
256 |
array(
|
257 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' =>
|
259 |
'section' => 'trackship_shipment_status_email',
|
260 |
'type' => 'checkbox',
|
261 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
@@ -274,7 +276,7 @@ class wcast_returntosender_customizer_email {
|
|
274 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_show_shipping_address]',
|
275 |
array(
|
276 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
277 |
-
'description' =>
|
278 |
'section' => 'trackship_shipment_status_email',
|
279 |
'type' => 'checkbox',
|
280 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -298,101 +300,114 @@ class wcast_returntosender_customizer_email {
|
|
298 |
'input_attrs' => array(
|
299 |
'class' => '',
|
300 |
'style' => '',
|
301 |
-
'placeholder' =>
|
302 |
),
|
303 |
'active_callback' => array( $this, 'active_callback' ),
|
304 |
)
|
305 |
);
|
306 |
}
|
307 |
|
308 |
-
public function active_callback(){
|
309 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
310 |
}
|
311 |
|
312 |
-
public function active_callback_only_show_order_details(){
|
313 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
314 |
-
$show_order_details = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_order_details'
|
315 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
316 |
}
|
317 |
/**
|
318 |
* Set up preview
|
319 |
-
*
|
320 |
-
* @access public
|
321 |
* @return void
|
322 |
*/
|
323 |
public function set_up_preview() {
|
324 |
// Make sure this is own preview request.
|
325 |
-
if ( ! $this->is_own_preview_request() )
|
326 |
-
|
|
|
|
|
|
|
327 |
}
|
328 |
|
329 |
/**
|
330 |
-
*
|
331 |
*/
|
332 |
-
public function preview_returntosender_email(){
|
333 |
|
334 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
335 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
$
|
338 |
-
$email_content = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_email_content',$this->defaults['wcast_returntosender_email_content']);$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_order_details',$this->defaults['wcast_returntosender_show_order_details']);
|
339 |
-
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_hide_shipping_item_price',$this->defaults['wcast_returntosender_hide_shipping_item_price']);
|
340 |
-
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_shipping_address',$this->defaults['wcast_returntosender_show_shipping_address']);
|
341 |
|
342 |
-
|
|
|
|
|
|
|
|
|
343 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
344 |
-
echo $content;
|
345 |
return;
|
346 |
}
|
347 |
|
348 |
$order = wc_get_order( $preview_id );
|
349 |
|
350 |
-
if(!$order){
|
351 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
352 |
-
echo $content;
|
353 |
return;
|
354 |
}
|
355 |
|
356 |
// get the preview email subject
|
357 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
358 |
-
$message = wc_trackship_email_manager()->email_content($email_content
|
359 |
|
360 |
-
$wcast_returntosender_analytics_link = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_analytics_link','');
|
361 |
-
if($wcast_returntosender_analytics_link){
|
362 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
363 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
364 |
}
|
365 |
|
366 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
367 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'return_to_sender' );
|
368 |
-
|
369 |
-
if( $
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
$mailer = WC()->mailer();
|
372 |
// create a new email
|
373 |
$email = new WC_Email();
|
374 |
|
375 |
// wrap the content with the email template and then add styles
|
376 |
-
echo apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
377 |
}
|
378 |
|
379 |
/**
|
380 |
-
*
|
381 |
*/
|
382 |
-
public function _appendCampaignToString($match){
|
383 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
384 |
-
$wcast_returntosender_analytics_link = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_analytics_link','');
|
385 |
|
386 |
$url = $match[2];
|
387 |
if (strpos($url, '?') === false) {
|
388 |
$url .= '?';
|
389 |
}
|
390 |
$url .= $wcast_returntosender_analytics_link;
|
391 |
-
return $match[1]
|
392 |
}
|
393 |
}
|
394 |
/**
|
395 |
* Initialise our Customizer settings
|
396 |
*/
|
397 |
|
398 |
-
$wcast_returntosender_customizer_email = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Returntosender_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
14 |
$this->defaults = $this->wcast_generate_defaults();
|
15 |
|
16 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
17 |
+
if ( !$wc_ast_api_key ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
|
21 |
// Register our sample default controls
|
22 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
23 |
|
24 |
// Only proceed if this is own request.
|
25 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
|
29 |
// Register our sections
|
30 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
51 |
|
52 |
/**
|
53 |
* Checks to see if we are opening our custom customizer preview
|
54 |
+
*
|
|
|
55 |
* @return bool
|
56 |
*/
|
57 |
public function is_own_preview_request() {
|
60 |
|
61 |
/**
|
62 |
* Checks to see if we are opening our custom customizer controls
|
63 |
+
*
|
|
|
64 |
* @return bool
|
65 |
*/
|
66 |
public function is_own_customizer_request() {
|
67 |
+
return isset( $_REQUEST['email'] ) && 'trackship_shipment_status_email' === $_REQUEST['email'];
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
+
* Code for initialize default value for customizer
|
72 |
*/
|
73 |
public function wcast_generate_defaults() {
|
74 |
$customizer_defaults = array(
|
108 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_enable_returntosender_email]',
|
109 |
array(
|
110 |
'label' => __( 'Enable Return To Sender email', 'woo-advanced-shipment-tracking' ),
|
111 |
+
'description' => '',
|
112 |
'section' => 'trackship_shipment_status_email',
|
113 |
'type' => 'checkbox',
|
114 |
'active_callback' => array( $this, 'active_callback' ),
|
151 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_email_subject]',
|
152 |
array(
|
153 |
'label' => __( 'Email Subject', 'woocommerce' ),
|
154 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
155 |
'section' => 'trackship_shipment_status_email',
|
156 |
'type' => 'text',
|
157 |
'input_attrs' => array(
|
175 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_email_heading]',
|
176 |
array(
|
177 |
'label' => __( 'Email heading', 'woocommerce' ),
|
178 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
179 |
'section' => 'trackship_shipment_status_email',
|
180 |
'type' => 'text',
|
181 |
'input_attrs' => array(
|
199 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'wcast_returntosender_email_settings[wcast_returntosender_email_content]',
|
200 |
array(
|
201 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
202 |
+
'description' => '',
|
203 |
'section' => 'trackship_shipment_status_email',
|
204 |
'input_attrs' => array(
|
205 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
238 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_show_order_details]',
|
239 |
array(
|
240 |
'label' => __( 'Display the Shipping items', 'woo-advanced-shipment-tracking' ),
|
241 |
+
'description' => '',
|
242 |
'section' => 'trackship_shipment_status_email',
|
243 |
'type' => 'checkbox',
|
244 |
'active_callback' => array( $this, 'active_callback' ),
|
257 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_hide_shipping_item_price]',
|
258 |
array(
|
259 |
'label' => __( 'Hide Shipping Items Price', 'woo-advanced-shipment-tracking' ),
|
260 |
+
'description' => '',
|
261 |
'section' => 'trackship_shipment_status_email',
|
262 |
'type' => 'checkbox',
|
263 |
'active_callback' => array( $this, 'active_callback_only_show_order_details' ),
|
276 |
$wp_customize->add_control( 'wcast_returntosender_email_settings[wcast_returntosender_show_shipping_address]',
|
277 |
array(
|
278 |
'label' => __( 'Display the shipping address', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'description' => '',
|
280 |
'section' => 'trackship_shipment_status_email',
|
281 |
'type' => 'checkbox',
|
282 |
'active_callback' => array( $this, 'active_callback' ),
|
300 |
'input_attrs' => array(
|
301 |
'class' => '',
|
302 |
'style' => '',
|
303 |
+
'placeholder' => '',
|
304 |
),
|
305 |
'active_callback' => array( $this, 'active_callback' ),
|
306 |
)
|
307 |
);
|
308 |
}
|
309 |
|
310 |
+
public function active_callback() {
|
311 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
312 |
}
|
313 |
|
314 |
+
public function active_callback_only_show_order_details() {
|
315 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
316 |
+
$show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_show_order_details', $this->defaults['wcast_returntosender_show_order_details'] );
|
317 |
return ( $this->is_own_preview_request() && $show_order_details ) ? true : false ;
|
318 |
}
|
319 |
/**
|
320 |
* Set up preview
|
321 |
+
*
|
|
|
322 |
* @return void
|
323 |
*/
|
324 |
public function set_up_preview() {
|
325 |
// Make sure this is own preview request.
|
326 |
+
if ( ! $this->is_own_preview_request() ) {
|
327 |
+
return;
|
328 |
+
}
|
329 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/returntosender_preview.php';
|
330 |
+
exit;
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
+
* Code for preview of return to sender email
|
335 |
*/
|
336 |
+
public function preview_returntosender_email() {
|
337 |
|
338 |
$preview_id = get_theme_mod('wcast_intransit_email_preview_order_id');
|
339 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
340 |
+
|
341 |
+
$email_heading = $ast->get_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_email_heading', $this->defaults['wcast_returntosender_email_heading'] );
|
342 |
+
|
343 |
+
$email_content = $ast->get_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_email_content', $this->defaults['wcast_returntosender_email_content'] );
|
344 |
|
345 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_show_order_details', $this->defaults['wcast_returntosender_show_order_details'] );
|
|
|
|
|
|
|
346 |
|
347 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_hide_shipping_item_price', $this->defaults['wcast_returntosender_hide_shipping_item_price'] );
|
348 |
+
|
349 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_show_shipping_address', $this->defaults['wcast_returntosender_show_shipping_address'] );
|
350 |
+
|
351 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
352 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
353 |
+
echo wp_kses_post( $content );
|
354 |
return;
|
355 |
}
|
356 |
|
357 |
$order = wc_get_order( $preview_id );
|
358 |
|
359 |
+
if ( !$order ) {
|
360 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
361 |
+
echo wp_kses_post( $content );
|
362 |
return;
|
363 |
}
|
364 |
|
365 |
// get the preview email subject
|
366 |
$email_heading = wc_trackship_email_manager()->email_heading( $email_heading, $preview_id, $order );
|
367 |
+
$message = wc_trackship_email_manager()->email_content( $email_content, $preview_id, $order );
|
368 |
|
369 |
+
$wcast_returntosender_analytics_link = $ast->get_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_analytics_link', '' );
|
370 |
+
if ( $wcast_returntosender_analytics_link ) {
|
371 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
372 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
373 |
}
|
374 |
|
375 |
$tracking_items = $ast->get_tracking_items( $preview_id, true );
|
376 |
$message .= $ast->tracking_info_template( $preview_id, $tracking_items, 'return_to_sender' );
|
377 |
+
|
378 |
+
if ( $wcast_show_order_details ) {
|
379 |
+
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
380 |
+
}
|
381 |
+
|
382 |
+
if ( $wcast_show_shipping_address ) {
|
383 |
+
$message .= $ast->order_shipping_details_template( $order );
|
384 |
+
}
|
385 |
|
386 |
$mailer = WC()->mailer();
|
387 |
// create a new email
|
388 |
$email = new WC_Email();
|
389 |
|
390 |
// wrap the content with the email template and then add styles
|
391 |
+
echo wp_kses_post( apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) ) );
|
392 |
}
|
393 |
|
394 |
/**
|
395 |
+
* Code for append analytics link in email content
|
396 |
*/
|
397 |
+
public function _appendCampaignToString( $match ) {
|
398 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
399 |
+
$wcast_returntosender_analytics_link = $ast->get_option_value_from_array( 'wcast_returntosender_email_settings', 'wcast_returntosender_analytics_link', '' );
|
400 |
|
401 |
$url = $match[2];
|
402 |
if (strpos($url, '?') === false) {
|
403 |
$url .= '?';
|
404 |
}
|
405 |
$url .= $wcast_returntosender_analytics_link;
|
406 |
+
return $match[1] . $url . $match[3];
|
407 |
}
|
408 |
}
|
409 |
/**
|
410 |
* Initialise our Customizer settings
|
411 |
*/
|
412 |
|
413 |
+
$wcast_returntosender_customizer_email = new Wcast_Returntosender_Customizer_Email();
|
includes/customizer/class-wc-tracking-info-customizer.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
private static $order_ids = null;
|
13 |
|
@@ -19,7 +19,9 @@ class wcast_initialise_customizer_settings {
|
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
23 |
|
24 |
// Register our sections
|
25 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -45,7 +47,7 @@ class wcast_initialise_customizer_settings {
|
|
45 |
|
46 |
|
47 |
/**
|
48 |
-
*
|
49 |
*/
|
50 |
public function enqueue_preview_scripts() {
|
51 |
wp_enqueue_script('wcast-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
@@ -68,8 +70,7 @@ class wcast_initialise_customizer_settings {
|
|
68 |
|
69 |
/**
|
70 |
* Checks to see if we are opening our custom customizer preview
|
71 |
-
*
|
72 |
-
* @access public
|
73 |
* @return bool
|
74 |
*/
|
75 |
public function is_own_preview_request() {
|
@@ -78,19 +79,18 @@ class wcast_initialise_customizer_settings {
|
|
78 |
|
79 |
/**
|
80 |
* Checks to see if we are opening our custom customizer controls
|
81 |
-
*
|
82 |
-
* @access public
|
83 |
* @return bool
|
84 |
*/
|
85 |
public function is_own_customizer_request() {
|
86 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
* Get Customizer URL
|
91 |
*
|
92 |
*/
|
93 |
-
public function get_customizer_url($email
|
94 |
return add_query_arg( array(
|
95 |
'wcast-customizer' => '1',
|
96 |
'email' => $email,
|
@@ -103,16 +103,15 @@ class wcast_initialise_customizer_settings {
|
|
103 |
|
104 |
/**
|
105 |
* Get WooCommerce email settings page URL
|
106 |
-
*
|
107 |
-
* @access public
|
108 |
* @return string
|
109 |
*/
|
110 |
-
public function get_email_settings_page_url($return_tab) {
|
111 |
-
return admin_url( 'admin.php?page=woocommerce-advanced-shipment-tracking&tab='
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
-
*
|
116 |
*/
|
117 |
public function wcast_generate_defaults() {
|
118 |
$customizer_defaults = array(
|
@@ -166,7 +165,7 @@ class wcast_initialise_customizer_settings {
|
|
166 |
|
167 |
$font_size_array[ '' ] = __( 'Select', 'woocommerce' );
|
168 |
for ( $i = 10; $i <= 30; $i++ ) {
|
169 |
-
$font_size_array[ $i ] = $i.
|
170 |
}
|
171 |
|
172 |
// Preview Order
|
@@ -223,7 +222,7 @@ class wcast_initialise_customizer_settings {
|
|
223 |
$wp_customize->add_control( 'tracking_info_settings[hide_trackig_header]',
|
224 |
array(
|
225 |
'label' => __( 'Hide Tracking Header', 'woo-advanced-shipment-tracking' ),
|
226 |
-
'description' =>
|
227 |
'section' => 'ast_tracking_general_section',
|
228 |
'type' => 'checkbox'
|
229 |
)
|
@@ -241,7 +240,7 @@ class wcast_initialise_customizer_settings {
|
|
241 |
$wp_customize->add_control( 'tracking_info_settings[header_text_change]',
|
242 |
array(
|
243 |
'label' => __( 'Tracking Header text', 'woo-advanced-shipment-tracking' ),
|
244 |
-
'description' =>
|
245 |
'section' => 'ast_tracking_general_section',
|
246 |
'type' => 'text',
|
247 |
'input_attrs' => array(
|
@@ -408,7 +407,7 @@ class wcast_initialise_customizer_settings {
|
|
408 |
$wp_customize->add_control( 'tracking_info_settings[show_provider_border]',
|
409 |
array(
|
410 |
'label' => __( 'Show bottom border', 'woo-advanced-shipment-tracking' ),
|
411 |
-
'description' =>
|
412 |
'section' => 'ast_tracking_general_section',
|
413 |
'type' => 'checkbox',
|
414 |
'active_callback' => array( $this, 'active_callback_for_simple_layout' ),
|
@@ -464,7 +463,7 @@ class wcast_initialise_customizer_settings {
|
|
464 |
$wp_customize->add_control( 'tracking_info_settings[display_shipment_provider_name]',
|
465 |
array(
|
466 |
'label' => __( 'Display shipping provider name', 'woo-advanced-shipment-tracking' ),
|
467 |
-
'description' =>
|
468 |
'section' => 'ast_tracking_general_section',
|
469 |
'type' => 'checkbox',
|
470 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
@@ -483,7 +482,7 @@ class wcast_initialise_customizer_settings {
|
|
483 |
$wp_customize->add_control( 'tracking_info_settings[display_shipment_provider_image]',
|
484 |
array(
|
485 |
'label' => __( 'Display shipping provider image', 'woo-advanced-shipment-tracking' ),
|
486 |
-
'description' =>
|
487 |
'section' => 'ast_tracking_general_section',
|
488 |
'type' => 'checkbox',
|
489 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
@@ -502,7 +501,7 @@ class wcast_initialise_customizer_settings {
|
|
502 |
$wp_customize->add_control( 'tracking_info_settings[remove_date_from_tracking]',
|
503 |
array(
|
504 |
'label' => __( 'Hide the shipped date', 'woo-advanced-shipment-tracking' ),
|
505 |
-
'description' =>
|
506 |
'section' => 'ast_tracking_general_section',
|
507 |
'type' => 'checkbox',
|
508 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
@@ -521,7 +520,7 @@ class wcast_initialise_customizer_settings {
|
|
521 |
$wp_customize->add_control( 'tracking_info_settings[tracking_number_link]',
|
522 |
array(
|
523 |
'label' => __( 'Use tracking number as a link', 'woo-advanced-shipment-tracking' ),
|
524 |
-
'description' =>
|
525 |
'section' => 'ast_tracking_general_section',
|
526 |
'type' => 'checkbox',
|
527 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
@@ -642,7 +641,7 @@ class wcast_initialise_customizer_settings {
|
|
642 |
$wp_customize->add_control( 'tracking_info_settings[hide_table_header]',
|
643 |
array(
|
644 |
'label' => __( 'Hide Table Headers', 'woo-advanced-shipment-tracking' ),
|
645 |
-
'description' =>
|
646 |
'section' => 'ast_tracking_general_section',
|
647 |
'type' => 'checkbox',
|
648 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
@@ -661,7 +660,7 @@ class wcast_initialise_customizer_settings {
|
|
661 |
$wp_customize->add_control( 'tracking_info_settings[provider_header_text]',
|
662 |
array(
|
663 |
'label' => __( 'Shipping provider header text', 'woo-advanced-shipment-tracking' ),
|
664 |
-
'description' =>
|
665 |
'section' => 'ast_tracking_general_section',
|
666 |
'type' => 'text',
|
667 |
'input_attrs' => array(
|
@@ -685,7 +684,7 @@ class wcast_initialise_customizer_settings {
|
|
685 |
$wp_customize->add_control( 'tracking_info_settings[tracking_number_header_text]',
|
686 |
array(
|
687 |
'label' => __( 'Tracking number header text', 'woo-advanced-shipment-tracking' ),
|
688 |
-
'description' =>
|
689 |
'section' => 'ast_tracking_general_section',
|
690 |
'type' => 'text',
|
691 |
'input_attrs' => array(
|
@@ -708,7 +707,7 @@ class wcast_initialise_customizer_settings {
|
|
708 |
$wp_customize->add_control( 'tracking_info_settings[shipped_date_header_text]',
|
709 |
array(
|
710 |
'label' => __( 'Shipped date header text', 'woo-advanced-shipment-tracking' ),
|
711 |
-
'description' =>
|
712 |
'section' => 'ast_tracking_general_section',
|
713 |
'type' => 'text',
|
714 |
'input_attrs' => array(
|
@@ -945,7 +944,7 @@ class wcast_initialise_customizer_settings {
|
|
945 |
$wp_customize->add_control( 'tracking_info_settings[show_track_label]',
|
946 |
array(
|
947 |
'label' => __( 'Track Header', 'woo-advanced-shipment-tracking' ),
|
948 |
-
'description' =>
|
949 |
'section' => 'ast_tracking_general_section',
|
950 |
'type' => 'checkbox',
|
951 |
'active_callback' => array( $this, 'active_callback_for_table_layout_tracking_link' ),
|
@@ -964,7 +963,7 @@ class wcast_initialise_customizer_settings {
|
|
964 |
$wp_customize->add_control( 'tracking_info_settings[track_header_text]',
|
965 |
array(
|
966 |
'label' => __( 'Track header text', 'woo-advanced-shipment-tracking' ),
|
967 |
-
'description' =>
|
968 |
'section' => 'ast_tracking_general_section',
|
969 |
'type' => 'text',
|
970 |
'input_attrs' => array(
|
@@ -1014,107 +1013,121 @@ class wcast_initialise_customizer_settings {
|
|
1014 |
}
|
1015 |
|
1016 |
|
1017 |
-
public function active_callback_for_hide_trackig_header(){
|
1018 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1019 |
-
$hide_trackig_header = $ast->get_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
1020 |
return ( !$hide_trackig_header ) ? true : false ;
|
1021 |
}
|
1022 |
|
1023 |
-
public function active_callback_for_table_layout(){
|
1024 |
|
1025 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1026 |
-
if( $fluid_template )
|
|
|
|
|
1027 |
|
1028 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1029 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1030 |
|
1031 |
-
return (
|
1032 |
}
|
1033 |
|
1034 |
-
public function active_callback_for_table_layout_table_header(){
|
1035 |
|
1036 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1037 |
-
if( $fluid_template )
|
|
|
|
|
1038 |
|
1039 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1040 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1041 |
-
$hide_table_header = $ast->get_option_value_from_array( 'tracking_info_settings','hide_table_header', '' );
|
1042 |
|
1043 |
-
return (
|
1044 |
}
|
1045 |
|
1046 |
-
public function active_callback_for_table_layout_tracking_link(){
|
1047 |
|
1048 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1049 |
-
if( $fluid_template )
|
|
|
|
|
1050 |
|
1051 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1052 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1053 |
-
$tracking_number_link = $ast->get_option_value_from_array( 'tracking_info_settings','tracking_number_link', '' );
|
1054 |
|
1055 |
-
return (
|
1056 |
}
|
1057 |
|
1058 |
-
public function active_callback_for_table_layout_tracking_link_track_header(){
|
1059 |
|
1060 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1061 |
-
if( $fluid_template )
|
|
|
|
|
1062 |
|
1063 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1064 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1065 |
-
$tracking_number_link = $ast->get_option_value_from_array( 'tracking_info_settings','tracking_number_link', '' );
|
1066 |
-
$show_track_label = $ast->get_option_value_from_array( 'tracking_info_settings','show_track_label', '' );
|
1067 |
|
1068 |
-
return (
|
1069 |
}
|
1070 |
|
1071 |
-
public function active_callback_for_simple_layout(){
|
1072 |
|
1073 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1074 |
-
if( $fluid_template )
|
|
|
|
|
1075 |
|
1076 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1077 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1078 |
|
1079 |
-
return (
|
1080 |
}
|
1081 |
|
1082 |
-
public function active_callback_for_simple_layout_show_provider_border(){
|
1083 |
|
1084 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1085 |
-
if( $fluid_template )
|
|
|
|
|
1086 |
|
1087 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
1088 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
1089 |
-
$show_provider_border = $ast->get_option_value_from_array( 'tracking_info_settings','show_provider_border', $this->defaults['show_provider_border'] );
|
1090 |
|
1091 |
-
return (
|
1092 |
}
|
1093 |
|
1094 |
/**
|
1095 |
* Set up preview
|
1096 |
-
*
|
1097 |
-
* @access public
|
1098 |
* @return void
|
1099 |
*/
|
1100 |
public function set_up_preview() {
|
1101 |
// Make sure this is own preview request.
|
1102 |
-
if ( ! $this->is_own_preview_request() )
|
1103 |
-
|
|
|
|
|
|
|
1104 |
}
|
1105 |
|
1106 |
/**
|
1107 |
-
*
|
1108 |
*/
|
1109 |
-
public function preview_completed_email(){
|
1110 |
|
1111 |
$ast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
1112 |
|
1113 |
$tracking_info_settings = get_option('tracking_info_settings');
|
1114 |
|
1115 |
-
if($tracking_info_settings['display_tracking_info_at']
|
1116 |
add_action( 'woocommerce_email_order_meta', array( $ast, 'email_display' ), 0, 4 );
|
1117 |
-
} else{
|
1118 |
add_action( 'woocommerce_email_before_order_table', array( $ast, 'email_display' ), 0, 4 );
|
1119 |
}
|
1120 |
|
@@ -1125,16 +1138,11 @@ class wcast_initialise_customizer_settings {
|
|
1125 |
$preview_id = get_theme_mod('wcast_preview_order_id');
|
1126 |
$email_type = 'WC_Email_Customer_Completed_Order';
|
1127 |
|
1128 |
-
if ( false === $email_type )
|
1129 |
-
|
1130 |
-
|
1131 |
|
1132 |
-
|
1133 |
-
|
1134 |
-
//$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'To preview the tracking display, please add tracking information to at least one order and choose it in the preview order selection.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
1135 |
-
//echo $content;
|
1136 |
-
//return;
|
1137 |
-
}
|
1138 |
|
1139 |
// Reference email.
|
1140 |
if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
|
@@ -1166,13 +1174,12 @@ class wcast_initialise_customizer_settings {
|
|
1166 |
if ( 'plain' === $email->email_type ) {
|
1167 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . str_replace( "\n", '<br/>', $content ) . '</div>';
|
1168 |
}
|
1169 |
-
echo $content;
|
1170 |
}
|
1171 |
|
1172 |
/**
|
1173 |
* Get WooCommerce order for preview
|
1174 |
*
|
1175 |
-
* @access public
|
1176 |
* @param string $order_status
|
1177 |
* @return object
|
1178 |
*/
|
@@ -1197,7 +1204,7 @@ class wcast_initialise_customizer_settings {
|
|
1197 |
'billing_country' => 'GB',
|
1198 |
'billing_email' => 'sherlock@holmes.co.uk',
|
1199 |
'billing_phone' => '02079304832',
|
1200 |
-
'date_created' =>
|
1201 |
'total' => 24.90,
|
1202 |
) );
|
1203 |
|
@@ -1228,4 +1235,4 @@ class wcast_initialise_customizer_settings {
|
|
1228 |
* Initialise our Customizer settings
|
1229 |
*/
|
1230 |
|
1231 |
-
$wcast_customizer_settings = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Initialise_Customizer_Settings {
|
11 |
// Get our default values
|
12 |
private static $order_ids = null;
|
13 |
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
|
26 |
// Register our sections
|
27 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
47 |
|
48 |
|
49 |
/**
|
50 |
+
* Add css and js for preview
|
51 |
*/
|
52 |
public function enqueue_preview_scripts() {
|
53 |
wp_enqueue_script('wcast-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
70 |
|
71 |
/**
|
72 |
* Checks to see if we are opening our custom customizer preview
|
73 |
+
*
|
|
|
74 |
* @return bool
|
75 |
*/
|
76 |
public function is_own_preview_request() {
|
79 |
|
80 |
/**
|
81 |
* Checks to see if we are opening our custom customizer controls
|
82 |
+
*
|
|
|
83 |
* @return bool
|
84 |
*/
|
85 |
public function is_own_customizer_request() {
|
86 |
+
return isset( $_REQUEST['email'] ) && 'ast_tracking_general_section' === $_REQUEST['email'];
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
* Get Customizer URL
|
91 |
*
|
92 |
*/
|
93 |
+
public function get_customizer_url( $email, $return_tab ) {
|
94 |
return add_query_arg( array(
|
95 |
'wcast-customizer' => '1',
|
96 |
'email' => $email,
|
103 |
|
104 |
/**
|
105 |
* Get WooCommerce email settings page URL
|
106 |
+
*
|
|
|
107 |
* @return string
|
108 |
*/
|
109 |
+
public function get_email_settings_page_url( $return_tab ) {
|
110 |
+
return admin_url( 'admin.php?page=woocommerce-advanced-shipment-tracking&tab=' . $return_tab );
|
111 |
}
|
112 |
|
113 |
/**
|
114 |
+
* Code for initialize default value for customizer
|
115 |
*/
|
116 |
public function wcast_generate_defaults() {
|
117 |
$customizer_defaults = array(
|
165 |
|
166 |
$font_size_array[ '' ] = __( 'Select', 'woocommerce' );
|
167 |
for ( $i = 10; $i <= 30; $i++ ) {
|
168 |
+
$font_size_array[ $i ] = $i . 'px';
|
169 |
}
|
170 |
|
171 |
// Preview Order
|
222 |
$wp_customize->add_control( 'tracking_info_settings[hide_trackig_header]',
|
223 |
array(
|
224 |
'label' => __( 'Hide Tracking Header', 'woo-advanced-shipment-tracking' ),
|
225 |
+
'description' => '',
|
226 |
'section' => 'ast_tracking_general_section',
|
227 |
'type' => 'checkbox'
|
228 |
)
|
240 |
$wp_customize->add_control( 'tracking_info_settings[header_text_change]',
|
241 |
array(
|
242 |
'label' => __( 'Tracking Header text', 'woo-advanced-shipment-tracking' ),
|
243 |
+
'description' => '',
|
244 |
'section' => 'ast_tracking_general_section',
|
245 |
'type' => 'text',
|
246 |
'input_attrs' => array(
|
407 |
$wp_customize->add_control( 'tracking_info_settings[show_provider_border]',
|
408 |
array(
|
409 |
'label' => __( 'Show bottom border', 'woo-advanced-shipment-tracking' ),
|
410 |
+
'description' => '',
|
411 |
'section' => 'ast_tracking_general_section',
|
412 |
'type' => 'checkbox',
|
413 |
'active_callback' => array( $this, 'active_callback_for_simple_layout' ),
|
463 |
$wp_customize->add_control( 'tracking_info_settings[display_shipment_provider_name]',
|
464 |
array(
|
465 |
'label' => __( 'Display shipping provider name', 'woo-advanced-shipment-tracking' ),
|
466 |
+
'description' => '',
|
467 |
'section' => 'ast_tracking_general_section',
|
468 |
'type' => 'checkbox',
|
469 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
482 |
$wp_customize->add_control( 'tracking_info_settings[display_shipment_provider_image]',
|
483 |
array(
|
484 |
'label' => __( 'Display shipping provider image', 'woo-advanced-shipment-tracking' ),
|
485 |
+
'description' => '',
|
486 |
'section' => 'ast_tracking_general_section',
|
487 |
'type' => 'checkbox',
|
488 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
501 |
$wp_customize->add_control( 'tracking_info_settings[remove_date_from_tracking]',
|
502 |
array(
|
503 |
'label' => __( 'Hide the shipped date', 'woo-advanced-shipment-tracking' ),
|
504 |
+
'description' => '',
|
505 |
'section' => 'ast_tracking_general_section',
|
506 |
'type' => 'checkbox',
|
507 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
520 |
$wp_customize->add_control( 'tracking_info_settings[tracking_number_link]',
|
521 |
array(
|
522 |
'label' => __( 'Use tracking number as a link', 'woo-advanced-shipment-tracking' ),
|
523 |
+
'description' => '',
|
524 |
'section' => 'ast_tracking_general_section',
|
525 |
'type' => 'checkbox',
|
526 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
641 |
$wp_customize->add_control( 'tracking_info_settings[hide_table_header]',
|
642 |
array(
|
643 |
'label' => __( 'Hide Table Headers', 'woo-advanced-shipment-tracking' ),
|
644 |
+
'description' => '',
|
645 |
'section' => 'ast_tracking_general_section',
|
646 |
'type' => 'checkbox',
|
647 |
'active_callback' => array( $this, 'active_callback_for_table_layout' ),
|
660 |
$wp_customize->add_control( 'tracking_info_settings[provider_header_text]',
|
661 |
array(
|
662 |
'label' => __( 'Shipping provider header text', 'woo-advanced-shipment-tracking' ),
|
663 |
+
'description' => '',
|
664 |
'section' => 'ast_tracking_general_section',
|
665 |
'type' => 'text',
|
666 |
'input_attrs' => array(
|
684 |
$wp_customize->add_control( 'tracking_info_settings[tracking_number_header_text]',
|
685 |
array(
|
686 |
'label' => __( 'Tracking number header text', 'woo-advanced-shipment-tracking' ),
|
687 |
+
'description' => '',
|
688 |
'section' => 'ast_tracking_general_section',
|
689 |
'type' => 'text',
|
690 |
'input_attrs' => array(
|
707 |
$wp_customize->add_control( 'tracking_info_settings[shipped_date_header_text]',
|
708 |
array(
|
709 |
'label' => __( 'Shipped date header text', 'woo-advanced-shipment-tracking' ),
|
710 |
+
'description' => '',
|
711 |
'section' => 'ast_tracking_general_section',
|
712 |
'type' => 'text',
|
713 |
'input_attrs' => array(
|
944 |
$wp_customize->add_control( 'tracking_info_settings[show_track_label]',
|
945 |
array(
|
946 |
'label' => __( 'Track Header', 'woo-advanced-shipment-tracking' ),
|
947 |
+
'description' => '',
|
948 |
'section' => 'ast_tracking_general_section',
|
949 |
'type' => 'checkbox',
|
950 |
'active_callback' => array( $this, 'active_callback_for_table_layout_tracking_link' ),
|
963 |
$wp_customize->add_control( 'tracking_info_settings[track_header_text]',
|
964 |
array(
|
965 |
'label' => __( 'Track header text', 'woo-advanced-shipment-tracking' ),
|
966 |
+
'description' => '',
|
967 |
'section' => 'ast_tracking_general_section',
|
968 |
'type' => 'text',
|
969 |
'input_attrs' => array(
|
1013 |
}
|
1014 |
|
1015 |
|
1016 |
+
public function active_callback_for_hide_trackig_header() {
|
1017 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1018 |
+
$hide_trackig_header = $ast->get_option_value_from_array( 'tracking_info_settings', 'hide_trackig_header', '' );
|
1019 |
return ( !$hide_trackig_header ) ? true : false ;
|
1020 |
}
|
1021 |
|
1022 |
+
public function active_callback_for_table_layout() {
|
1023 |
|
1024 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1025 |
+
if ( $fluid_template ) {
|
1026 |
+
return false;
|
1027 |
+
}
|
1028 |
|
1029 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1030 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1031 |
|
1032 |
+
return ( 'default_table' == $select_tracking_template ) ? true : false ;
|
1033 |
}
|
1034 |
|
1035 |
+
public function active_callback_for_table_layout_table_header() {
|
1036 |
|
1037 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1038 |
+
if ( $fluid_template ) {
|
1039 |
+
return false;
|
1040 |
+
}
|
1041 |
|
1042 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1043 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1044 |
+
$hide_table_header = $ast->get_option_value_from_array( 'tracking_info_settings', 'hide_table_header', '' );
|
1045 |
|
1046 |
+
return ( 'default_table' == $select_tracking_template && !$hide_table_header ) ? true : false ;
|
1047 |
}
|
1048 |
|
1049 |
+
public function active_callback_for_table_layout_tracking_link() {
|
1050 |
|
1051 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1052 |
+
if ( $fluid_template ) {
|
1053 |
+
return false;
|
1054 |
+
}
|
1055 |
|
1056 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1057 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1058 |
+
$tracking_number_link = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_number_link', '' );
|
1059 |
|
1060 |
+
return ( 'default_table' == $select_tracking_template && !$tracking_number_link ) ? true : false ;
|
1061 |
}
|
1062 |
|
1063 |
+
public function active_callback_for_table_layout_tracking_link_track_header() {
|
1064 |
|
1065 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1066 |
+
if ( $fluid_template ) {
|
1067 |
+
return false;
|
1068 |
+
}
|
1069 |
|
1070 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1071 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1072 |
+
$tracking_number_link = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_number_link', '' );
|
1073 |
+
$show_track_label = $ast->get_option_value_from_array( 'tracking_info_settings', 'show_track_label', '' );
|
1074 |
|
1075 |
+
return ( 'default_table' == $select_tracking_template && !$tracking_number_link && $show_track_label ) ? true : false ;
|
1076 |
}
|
1077 |
|
1078 |
+
public function active_callback_for_simple_layout() {
|
1079 |
|
1080 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1081 |
+
if ( $fluid_template ) {
|
1082 |
+
return false;
|
1083 |
+
}
|
1084 |
|
1085 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1086 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1087 |
|
1088 |
+
return ( 'simple_list' == $select_tracking_template ) ? true : false ;
|
1089 |
}
|
1090 |
|
1091 |
+
public function active_callback_for_simple_layout_show_provider_border() {
|
1092 |
|
1093 |
$fluid_template = apply_filters( 'check_if_fluid_template_exist', false );
|
1094 |
+
if ( $fluid_template ) {
|
1095 |
+
return false;
|
1096 |
+
}
|
1097 |
|
1098 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
1099 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $this->defaults['select_tracking_template'] );
|
1100 |
+
$show_provider_border = $ast->get_option_value_from_array( 'tracking_info_settings', 'show_provider_border', $this->defaults['show_provider_border'] );
|
1101 |
|
1102 |
+
return ( 'simple_list' == $select_tracking_template && $show_provider_border ) ? true : false ;
|
1103 |
}
|
1104 |
|
1105 |
/**
|
1106 |
* Set up preview
|
1107 |
+
*
|
|
|
1108 |
* @return void
|
1109 |
*/
|
1110 |
public function set_up_preview() {
|
1111 |
// Make sure this is own preview request.
|
1112 |
+
if ( ! $this->is_own_preview_request() ) {
|
1113 |
+
return;
|
1114 |
+
}
|
1115 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/preview.php';
|
1116 |
+
exit;
|
1117 |
}
|
1118 |
|
1119 |
/**
|
1120 |
+
* Code for preview of tracking info in email
|
1121 |
*/
|
1122 |
+
public function preview_completed_email() {
|
1123 |
|
1124 |
$ast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
1125 |
|
1126 |
$tracking_info_settings = get_option('tracking_info_settings');
|
1127 |
|
1128 |
+
if ( 'after_order' == $tracking_info_settings['display_tracking_info_at'] ) {
|
1129 |
add_action( 'woocommerce_email_order_meta', array( $ast, 'email_display' ), 0, 4 );
|
1130 |
+
} else {
|
1131 |
add_action( 'woocommerce_email_before_order_table', array( $ast, 'email_display' ), 0, 4 );
|
1132 |
}
|
1133 |
|
1138 |
$preview_id = get_theme_mod('wcast_preview_order_id');
|
1139 |
$email_type = 'WC_Email_Customer_Completed_Order';
|
1140 |
|
1141 |
+
if ( false === $email_type ) {
|
1142 |
+
return false;
|
1143 |
+
}
|
1144 |
|
1145 |
+
$order_status = 'completed';
|
|
|
|
|
|
|
|
|
|
|
1146 |
|
1147 |
// Reference email.
|
1148 |
if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
|
1174 |
if ( 'plain' === $email->email_type ) {
|
1175 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . str_replace( "\n", '<br/>', $content ) . '</div>';
|
1176 |
}
|
1177 |
+
echo wp_kses_post( $content );
|
1178 |
}
|
1179 |
|
1180 |
/**
|
1181 |
* Get WooCommerce order for preview
|
1182 |
*
|
|
|
1183 |
* @param string $order_status
|
1184 |
* @return object
|
1185 |
*/
|
1204 |
'billing_country' => 'GB',
|
1205 |
'billing_email' => 'sherlock@holmes.co.uk',
|
1206 |
'billing_phone' => '02079304832',
|
1207 |
+
'date_created' => gmdate( 'Y-m-d H:i:s' ),
|
1208 |
'total' => 24.90,
|
1209 |
) );
|
1210 |
|
1235 |
* Initialise our Customizer settings
|
1236 |
*/
|
1237 |
|
1238 |
+
$wcast_customizer_settings = new Wcast_Initialise_Customizer_Settings();
|
includes/customizer/class-wc-tracking-page-customizer.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
private static $order_ids = null;
|
13 |
|
@@ -19,7 +19,9 @@ class ts_tracking_page_customizer {
|
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
23 |
|
24 |
// Register our sections
|
25 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -43,7 +45,7 @@ class ts_tracking_page_customizer {
|
|
43 |
|
44 |
|
45 |
/**
|
46 |
-
*
|
47 |
*/
|
48 |
public function enqueue_preview_scripts() {
|
49 |
wp_enqueue_script('wcast-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
@@ -66,8 +68,7 @@ class ts_tracking_page_customizer {
|
|
66 |
|
67 |
/**
|
68 |
* Checks to see if we are opening our custom customizer preview
|
69 |
-
*
|
70 |
-
* @access public
|
71 |
* @return bool
|
72 |
*/
|
73 |
public function is_own_preview_request() {
|
@@ -76,12 +77,11 @@ class ts_tracking_page_customizer {
|
|
76 |
|
77 |
/**
|
78 |
* Checks to see if we are opening our custom customizer controls
|
79 |
-
*
|
80 |
-
* @access public
|
81 |
* @return bool
|
82 |
*/
|
83 |
public function is_own_customizer_request() {
|
84 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
85 |
}
|
86 |
|
87 |
/**
|
@@ -100,16 +100,15 @@ class ts_tracking_page_customizer {
|
|
100 |
|
101 |
/**
|
102 |
* Get WooCommerce email settings page URL
|
103 |
-
*
|
104 |
-
* @access public
|
105 |
* @return string
|
106 |
*/
|
107 |
public function get_email_settings_page_url( $return_tab ) {
|
108 |
-
return admin_url( 'admin.php?page=trackship-for-woocommerce&tab='
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
-
*
|
113 |
*/
|
114 |
public function wcast_generate_defaults() {
|
115 |
$customizer_defaults = array(
|
@@ -137,7 +136,7 @@ class ts_tracking_page_customizer {
|
|
137 |
|
138 |
$font_size_array[ '' ] = __( 'Select', 'woocommerce' );
|
139 |
for ( $i = 10; $i <= 30; $i++ ) {
|
140 |
-
$font_size_array[ $i ] = $i.
|
141 |
}
|
142 |
|
143 |
$wp_customize->add_setting( 'wc_ast_select_tracking_page_layout',
|
@@ -257,4 +256,4 @@ class ts_tracking_page_customizer {
|
|
257 |
* Initialise our Customizer settings
|
258 |
*/
|
259 |
|
260 |
-
$ts_tracking_page_customizer = new
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Ts_Tracking_Page_Customizer {
|
11 |
// Get our default values
|
12 |
private static $order_ids = null;
|
13 |
|
19 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
|
21 |
// Only proceed if this is own request.
|
22 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
|
26 |
// Register our sections
|
27 |
add_action( 'customize_register', array( ts_customizer(), 'wcast_add_customizer_sections' ) );
|
45 |
|
46 |
|
47 |
/**
|
48 |
+
* Add css and js for preview
|
49 |
*/
|
50 |
public function enqueue_preview_scripts() {
|
51 |
wp_enqueue_script('wcast-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
68 |
|
69 |
/**
|
70 |
* Checks to see if we are opening our custom customizer preview
|
71 |
+
*
|
|
|
72 |
* @return bool
|
73 |
*/
|
74 |
public function is_own_preview_request() {
|
77 |
|
78 |
/**
|
79 |
* Checks to see if we are opening our custom customizer controls
|
80 |
+
*
|
|
|
81 |
* @return bool
|
82 |
*/
|
83 |
public function is_own_customizer_request() {
|
84 |
+
return isset( $_REQUEST['email'] ) && 'ast_tracking_page_section' === $_REQUEST['email'];
|
85 |
}
|
86 |
|
87 |
/**
|
100 |
|
101 |
/**
|
102 |
* Get WooCommerce email settings page URL
|
103 |
+
*
|
|
|
104 |
* @return string
|
105 |
*/
|
106 |
public function get_email_settings_page_url( $return_tab ) {
|
107 |
+
return admin_url( 'admin.php?page=trackship-for-woocommerce&tab=' . $return_tab );
|
108 |
}
|
109 |
|
110 |
/**
|
111 |
+
* Code for initialize default value for customizer
|
112 |
*/
|
113 |
public function wcast_generate_defaults() {
|
114 |
$customizer_defaults = array(
|
136 |
|
137 |
$font_size_array[ '' ] = __( 'Select', 'woocommerce' );
|
138 |
for ( $i = 10; $i <= 30; $i++ ) {
|
139 |
+
$font_size_array[ $i ] = $i . 'px';
|
140 |
}
|
141 |
|
142 |
$wp_customize->add_setting( 'wc_ast_select_tracking_page_layout',
|
256 |
* Initialise our Customizer settings
|
257 |
*/
|
258 |
|
259 |
+
$ts_tracking_page_customizer = new Ts_Tracking_Page_Customizer();
|
includes/customizer/class-wc-updated-tracking-email-customizer.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
-
class
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
@@ -17,7 +17,9 @@ class wcast_updated_tracking_customizer_email {
|
|
17 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
18 |
|
19 |
// Only proceed if this is own request.
|
20 |
-
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() )
|
|
|
|
|
21 |
|
22 |
// Register our sections
|
23 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
@@ -63,8 +65,7 @@ class wcast_updated_tracking_customizer_email {
|
|
63 |
|
64 |
/**
|
65 |
* Checks to see if we are opening our custom customizer preview
|
66 |
-
*
|
67 |
-
* @access public
|
68 |
* @return bool
|
69 |
*/
|
70 |
public function is_own_preview_request() {
|
@@ -73,12 +74,11 @@ class wcast_updated_tracking_customizer_email {
|
|
73 |
|
74 |
/**
|
75 |
* Checks to see if we are opening our custom customizer controls
|
76 |
-
*
|
77 |
-
* @access public
|
78 |
* @return bool
|
79 |
*/
|
80 |
public function is_own_customizer_request() {
|
81 |
-
return isset( $_REQUEST['email'] ) && $_REQUEST['email']
|
82 |
}
|
83 |
|
84 |
/**
|
@@ -99,7 +99,6 @@ class wcast_updated_tracking_customizer_email {
|
|
99 |
/**
|
100 |
* Get WooCommerce email settings page URL
|
101 |
*
|
102 |
-
* @access public
|
103 |
* @return string
|
104 |
*/
|
105 |
public function get_email_settings_page_url() {
|
@@ -107,7 +106,7 @@ class wcast_updated_tracking_customizer_email {
|
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
-
*
|
111 |
*/
|
112 |
public function wcast_generate_defaults() {
|
113 |
$customizer_defaults = array(
|
@@ -141,7 +140,7 @@ class wcast_updated_tracking_customizer_email {
|
|
141 |
$wp_customize->add_control( 'customizer_updated_tracking_order_settings_enabled',
|
142 |
array(
|
143 |
'label' => __( 'Enable Updated Tracking order status email', 'woo-advanced-shipment-tracking' ),
|
144 |
-
'description' =>
|
145 |
'section' => 'custom_order_status_email',
|
146 |
'type' => 'checkbox',
|
147 |
'active_callback' => array( $this, 'active_callback' ),
|
@@ -160,7 +159,7 @@ class wcast_updated_tracking_customizer_email {
|
|
160 |
$wp_customize->add_control( 'woocommerce_customer_updated_tracking_order_settings[subject]',
|
161 |
array(
|
162 |
'label' => __( 'Subject', 'woocommerce' ),
|
163 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
164 |
'section' => 'custom_order_status_email',
|
165 |
'type' => 'text',
|
166 |
'input_attrs' => array(
|
@@ -184,7 +183,7 @@ class wcast_updated_tracking_customizer_email {
|
|
184 |
$wp_customize->add_control( 'woocommerce_customer_updated_tracking_order_settings[heading]',
|
185 |
array(
|
186 |
'label' => __( 'Email heading', 'woocommerce' ),
|
187 |
-
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
188 |
'section' => 'custom_order_status_email',
|
189 |
'type' => 'text',
|
190 |
'input_attrs' => array(
|
@@ -209,7 +208,7 @@ class wcast_updated_tracking_customizer_email {
|
|
209 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_updated_tracking_order_settings[wcast_updated_tracking_email_content]',
|
210 |
array(
|
211 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
212 |
-
'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
|
213 |
'section' => 'custom_order_status_email',
|
214 |
'input_attrs' => array(
|
215 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
@@ -237,42 +236,44 @@ class wcast_updated_tracking_customizer_email {
|
|
237 |
) );
|
238 |
}
|
239 |
|
240 |
-
public function active_callback(){
|
241 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
* Set up preview
|
246 |
-
*
|
247 |
-
* @access public
|
248 |
* @return void
|
249 |
*/
|
250 |
public function set_up_preview() {
|
251 |
// Make sure this is own preview request.
|
252 |
-
if ( ! $this->is_own_preview_request() )
|
253 |
-
|
|
|
|
|
|
|
254 |
}
|
255 |
|
256 |
/**
|
257 |
-
*
|
258 |
*/
|
259 |
-
public function preview_updated_tracking_email(){
|
260 |
// Load WooCommerce emails.
|
261 |
$wc_emails = WC_Emails::instance();
|
262 |
$emails = $wc_emails->get_emails();
|
263 |
$preview_id = get_theme_mod('wcast_email_preview_order_id');
|
264 |
|
265 |
-
if(
|
266 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
267 |
-
echo $content;
|
268 |
return;
|
269 |
}
|
270 |
|
271 |
$order = wc_get_order( $preview_id );
|
272 |
|
273 |
-
if(!$order){
|
274 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
275 |
-
echo $content;
|
276 |
return;
|
277 |
}
|
278 |
|
@@ -313,13 +314,12 @@ class wcast_updated_tracking_customizer_email {
|
|
313 |
$content = $email->style_inline( $content );
|
314 |
$content = apply_filters( 'woocommerce_mail_content', $content );
|
315 |
|
316 |
-
echo $content;
|
317 |
}
|
318 |
|
319 |
/**
|
320 |
* Get WooCommerce order for preview
|
321 |
*
|
322 |
-
* @access public
|
323 |
* @param string $order_status
|
324 |
* @return object
|
325 |
*/
|
@@ -345,7 +345,7 @@ class wcast_updated_tracking_customizer_email {
|
|
345 |
'billing_country' => 'GB',
|
346 |
'billing_email' => 'sherlock@holmes.co.uk',
|
347 |
'billing_phone' => '02079304832',
|
348 |
-
'date_created' =>
|
349 |
'total' => 24.90,
|
350 |
) );
|
351 |
|
@@ -386,7 +386,7 @@ function ut_customizer() {
|
|
386 |
static $instance;
|
387 |
|
388 |
if ( ! isset( $instance ) ) {
|
389 |
-
$instance = new
|
390 |
}
|
391 |
|
392 |
return $instance;
|
@@ -405,14 +405,16 @@ add_action( 'customize_save_customizer_updated_tracking_order_settings_enabled',
|
|
405 |
* Update Delivered order email enable/disable
|
406 |
*
|
407 |
*/
|
408 |
-
function woocommerce_customer_updated_tracking_order_settings_fun($data){
|
409 |
-
|
|
|
|
|
410 |
$updated_tracking_order_settings = get_option( 'woocommerce_customer_updated_tracking_order_settings');
|
411 |
|
412 |
-
if(isset($post_values['customizer_updated_tracking_order_settings_enabled']) && ($post_values['customizer_updated_tracking_order_settings_enabled']
|
413 |
$updated_tracking_order_settings['enabled'] = 'yes';
|
414 |
-
} else{
|
415 |
$updated_tracking_order_settings['enabled'] = 'no';
|
416 |
}
|
417 |
-
update_option( 'woocommerce_customer_updated_tracking_order_settings'
|
418 |
-
}
|
7 |
/**
|
8 |
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
*/
|
10 |
+
class Wcast_Updated_Tracking_Customizer_Email {
|
11 |
// Get our default values
|
12 |
public function __construct() {
|
13 |
// Get our Customizer defaults
|
17 |
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
18 |
|
19 |
// Only proceed if this is own request.
|
20 |
+
if ( ! $this->is_own_customizer_request() && ! $this->is_own_preview_request() ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
|
24 |
// Register our sections
|
25 |
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
65 |
|
66 |
/**
|
67 |
* Checks to see if we are opening our custom customizer preview
|
68 |
+
*
|
|
|
69 |
* @return bool
|
70 |
*/
|
71 |
public function is_own_preview_request() {
|
74 |
|
75 |
/**
|
76 |
* Checks to see if we are opening our custom customizer controls
|
77 |
+
*
|
|
|
78 |
* @return bool
|
79 |
*/
|
80 |
public function is_own_customizer_request() {
|
81 |
+
return isset( $_REQUEST['email'] ) && 'custom_order_status_email' === $_REQUEST['email'];
|
82 |
}
|
83 |
|
84 |
/**
|
99 |
/**
|
100 |
* Get WooCommerce email settings page URL
|
101 |
*
|
|
|
102 |
* @return string
|
103 |
*/
|
104 |
public function get_email_settings_page_url() {
|
106 |
}
|
107 |
|
108 |
/**
|
109 |
+
* Code for initialize default value for customizer
|
110 |
*/
|
111 |
public function wcast_generate_defaults() {
|
112 |
$customizer_defaults = array(
|
140 |
$wp_customize->add_control( 'customizer_updated_tracking_order_settings_enabled',
|
141 |
array(
|
142 |
'label' => __( 'Enable Updated Tracking order status email', 'woo-advanced-shipment-tracking' ),
|
143 |
+
'description' => '',
|
144 |
'section' => 'custom_order_status_email',
|
145 |
'type' => 'checkbox',
|
146 |
'active_callback' => array( $this, 'active_callback' ),
|
159 |
$wp_customize->add_control( 'woocommerce_customer_updated_tracking_order_settings[subject]',
|
160 |
array(
|
161 |
'label' => __( 'Subject', 'woocommerce' ),
|
162 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
163 |
'section' => 'custom_order_status_email',
|
164 |
'type' => 'text',
|
165 |
'input_attrs' => array(
|
183 |
$wp_customize->add_control( 'woocommerce_customer_updated_tracking_order_settings[heading]',
|
184 |
array(
|
185 |
'label' => __( 'Email heading', 'woocommerce' ),
|
186 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {order_number}',
|
187 |
'section' => 'custom_order_status_email',
|
188 |
'type' => 'text',
|
189 |
'input_attrs' => array(
|
208 |
$wp_customize->add_control( new AST_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_updated_tracking_order_settings[wcast_updated_tracking_email_content]',
|
209 |
array(
|
210 |
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
211 |
+
'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ) . ' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
|
212 |
'section' => 'custom_order_status_email',
|
213 |
'input_attrs' => array(
|
214 |
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
236 |
) );
|
237 |
}
|
238 |
|
239 |
+
public function active_callback() {
|
240 |
return ( $this->is_own_preview_request() ) ? true : false ;
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
* Set up preview
|
245 |
+
*
|
|
|
246 |
* @return void
|
247 |
*/
|
248 |
public function set_up_preview() {
|
249 |
// Make sure this is own preview request.
|
250 |
+
if ( ! $this->is_own_preview_request() ) {
|
251 |
+
return;
|
252 |
+
}
|
253 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/updated_tracking_preview.php';
|
254 |
+
exit;
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
+
* Code for preview of delivered order status email
|
259 |
*/
|
260 |
+
public function preview_updated_tracking_email() {
|
261 |
// Load WooCommerce emails.
|
262 |
$wc_emails = WC_Emails::instance();
|
263 |
$emails = $wc_emails->get_emails();
|
264 |
$preview_id = get_theme_mod('wcast_email_preview_order_id');
|
265 |
|
266 |
+
if ( '' == $preview_id || 'mockup' == $preview_id ) {
|
267 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
268 |
+
echo wp_kses_post( $content );
|
269 |
return;
|
270 |
}
|
271 |
|
272 |
$order = wc_get_order( $preview_id );
|
273 |
|
274 |
+
if ( !$order ) {
|
275 |
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
276 |
+
echo wp_kses_post( $content );
|
277 |
return;
|
278 |
}
|
279 |
|
314 |
$content = $email->style_inline( $content );
|
315 |
$content = apply_filters( 'woocommerce_mail_content', $content );
|
316 |
|
317 |
+
echo wp_kses_post( $content );
|
318 |
}
|
319 |
|
320 |
/**
|
321 |
* Get WooCommerce order for preview
|
322 |
*
|
|
|
323 |
* @param string $order_status
|
324 |
* @return object
|
325 |
*/
|
345 |
'billing_country' => 'GB',
|
346 |
'billing_email' => 'sherlock@holmes.co.uk',
|
347 |
'billing_phone' => '02079304832',
|
348 |
+
'date_created' => gmdate( 'Y-m-d H:i:s' ),
|
349 |
'total' => 24.90,
|
350 |
) );
|
351 |
|
386 |
static $instance;
|
387 |
|
388 |
if ( ! isset( $instance ) ) {
|
389 |
+
$instance = new Wcast_Updated_Tracking_Customizer_Email();
|
390 |
}
|
391 |
|
392 |
return $instance;
|
405 |
* Update Delivered order email enable/disable
|
406 |
*
|
407 |
*/
|
408 |
+
function woocommerce_customer_updated_tracking_order_settings_fun( $data ) {
|
409 |
+
|
410 |
+
$customized = isset( $_POST['customized'] ) ? wc_clean( $_POST['customized'] ) : '';
|
411 |
+
$post_values = json_decode( wp_unslash( $customized ), true );
|
412 |
$updated_tracking_order_settings = get_option( 'woocommerce_customer_updated_tracking_order_settings');
|
413 |
|
414 |
+
if ( isset( $post_values[ 'customizer_updated_tracking_order_settings_enabled' ] ) && ( 1 == $post_values[ 'customizer_updated_tracking_order_settings_enabled' ] ) ) {
|
415 |
$updated_tracking_order_settings['enabled'] = 'yes';
|
416 |
+
} else {
|
417 |
$updated_tracking_order_settings['enabled'] = 'no';
|
418 |
}
|
419 |
+
update_option( 'woocommerce_customer_updated_tracking_order_settings', $updated_tracking_order_settings );
|
420 |
+
}
|
includes/customizer/class-wcast-customizer.php
CHANGED
@@ -15,8 +15,8 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
-
|
19 |
-
|
20 |
|
21 |
/**
|
22 |
* Register the Customizer sections
|
@@ -33,13 +33,13 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
33 |
$wp_customize->add_section( 'custom_order_status_email',
|
34 |
array(
|
35 |
'title' => __( 'Custom order status email', 'woo-advanced-shipment-tracking' ),
|
36 |
-
'description' =>
|
37 |
)
|
38 |
);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
43 |
*/
|
44 |
public function enqueue_preview_scripts() {
|
45 |
|
@@ -61,20 +61,22 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
-
*
|
65 |
*/
|
66 |
-
public function enqueue_customizer_scripts(){
|
67 |
|
68 |
-
if(isset( $_REQUEST['wcast-customizer'] ) && '1' === $_REQUEST['wcast-customizer']){
|
69 |
wp_enqueue_style( 'wp-color-picker' );
|
70 |
wp_enqueue_style('wcast-customizer-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer-styles.css', array(), wc_advanced_shipment_tracking()->version );
|
71 |
wp_enqueue_script('wcast-customizer-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer-scripts.js', array('jquery', 'customize-controls','wp-color-picker'), wc_advanced_shipment_tracking()->version, true);
|
72 |
|
73 |
-
$email_type = ( isset($_REQUEST['order_status']) ) ? $_REQUEST['order_status'] : 'partially_shipped';
|
74 |
-
$shipment_status = ( isset($_REQUEST['shipment_status']) ) ? $_REQUEST['shipment_status'] : 'in_transit';
|
75 |
-
|
|
|
76 |
// Send variables to Javascript
|
77 |
wp_localize_script('wcast-customizer-scripts', 'wcast_customizer', array(
|
|
|
78 |
'ajax_url' => admin_url('admin-ajax.php'),
|
79 |
'email_preview_url' => $this->get_email_preview_url(),
|
80 |
'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
|
@@ -92,7 +94,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
92 |
'customer_delivered_preview_url' => $this->get_customer_delivered_preview_url(),
|
93 |
'customer_returntosender_preview_url' => $this->get_customer_returntosender_preview_url(),
|
94 |
'customer_availableforpickup_preview_url' => $this->get_customer_availableforpickup_preview_url(),
|
95 |
-
'trigger_click' => '#accordion-section-'
|
96 |
'customizer_title' => 'Shipment Tracking',
|
97 |
));
|
98 |
|
@@ -131,7 +133,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
131 |
* Get Customizer URL
|
132 |
*
|
133 |
*/
|
134 |
-
public function get_shipped_email_preview_url(){
|
135 |
return add_query_arg( array(
|
136 |
'wcast-shipped-email-customizer-preview' => '1',
|
137 |
), home_url( '' ) );
|
@@ -191,7 +193,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
191 |
* Get Exception Shipment status preview URL
|
192 |
*
|
193 |
*/
|
194 |
-
public function get_customer_exception_preview_url(){
|
195 |
return add_query_arg( array(
|
196 |
'wcast-exception-email-customizer-preview' => '1',
|
197 |
), home_url( '' ) );
|
@@ -258,48 +260,45 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
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 |
-
* Remove unrelated sections
|
283 |
-
*
|
284 |
-
* @access public
|
285 |
-
* @param bool $active
|
286 |
-
* @param object $section
|
287 |
-
* @return bool
|
288 |
-
*/
|
289 |
-
public function remove_unrelated_sections( $active, $section ) {
|
290 |
-
// Check if current section is own section
|
291 |
-
if ( ! $this->is_own_section( $section->id ) ) {
|
292 |
-
return false;
|
293 |
-
}
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
/**
|
300 |
* Check if current component is own component
|
301 |
-
*
|
302 |
-
* @access public
|
303 |
* @param string $component
|
304 |
* @return bool
|
305 |
*/
|
@@ -309,14 +308,13 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
309 |
|
310 |
/**
|
311 |
* Check if current section is own section
|
312 |
-
*
|
313 |
-
* @access public
|
314 |
* @param string $key
|
315 |
* @return bool
|
316 |
*/
|
317 |
public function is_own_section( $key ) {
|
318 |
|
319 |
-
if (
|
320 |
return true;
|
321 |
}
|
322 |
|
@@ -344,8 +342,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
344 |
|
345 |
/**
|
346 |
* Get Order Ids
|
347 |
-
*
|
348 |
-
* @access public
|
349 |
* @return array
|
350 |
*/
|
351 |
public function get_order_ids() {
|
@@ -361,12 +358,12 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
361 |
));
|
362 |
|
363 |
foreach ( $orders as $order ) {
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
return $order_array;
|
371 |
}
|
372 |
}
|
@@ -393,4 +390,4 @@ function wcast_customizer() {
|
|
393 |
*
|
394 |
* Backward compatibility.
|
395 |
*/
|
396 |
-
wcast_customizer();
|
15 |
/**
|
16 |
* Initialize the main plugin function
|
17 |
*/
|
18 |
+
public function __construct() {
|
19 |
+
}
|
20 |
|
21 |
/**
|
22 |
* Register the Customizer sections
|
33 |
$wp_customize->add_section( 'custom_order_status_email',
|
34 |
array(
|
35 |
'title' => __( 'Custom order status email', 'woo-advanced-shipment-tracking' ),
|
36 |
+
'description' => '',
|
37 |
)
|
38 |
);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* Add css and js for preview
|
43 |
*/
|
44 |
public function enqueue_preview_scripts() {
|
45 |
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
+
* Add css and js for customizer
|
65 |
*/
|
66 |
+
public function enqueue_customizer_scripts() {
|
67 |
|
68 |
+
if ( isset( $_REQUEST['wcast-customizer'] ) && '1' === $_REQUEST['wcast-customizer'] ) {
|
69 |
wp_enqueue_style( 'wp-color-picker' );
|
70 |
wp_enqueue_style('wcast-customizer-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer-styles.css', array(), wc_advanced_shipment_tracking()->version );
|
71 |
wp_enqueue_script('wcast-customizer-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer-scripts.js', array('jquery', 'customize-controls','wp-color-picker'), wc_advanced_shipment_tracking()->version, true);
|
72 |
|
73 |
+
$email_type = ( isset($_REQUEST['order_status']) ) ? wc_clean( $_REQUEST['order_status'] ) : 'partially_shipped';
|
74 |
+
$shipment_status = ( isset($_REQUEST['shipment_status']) ) ? wc_clean( $_REQUEST['shipment_status'] ) : 'in_transit';
|
75 |
+
$email = ( isset($_REQUEST['email']) ) ? wc_clean( $_REQUEST['email'] ) : '';
|
76 |
+
|
77 |
// Send variables to Javascript
|
78 |
wp_localize_script('wcast-customizer-scripts', 'wcast_customizer', array(
|
79 |
+
'customizer_nonce' => wp_create_nonce( 'ast_customizer' ),
|
80 |
'ajax_url' => admin_url('admin-ajax.php'),
|
81 |
'email_preview_url' => $this->get_email_preview_url(),
|
82 |
'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
|
94 |
'customer_delivered_preview_url' => $this->get_customer_delivered_preview_url(),
|
95 |
'customer_returntosender_preview_url' => $this->get_customer_returntosender_preview_url(),
|
96 |
'customer_availableforpickup_preview_url' => $this->get_customer_availableforpickup_preview_url(),
|
97 |
+
'trigger_click' => '#accordion-section-' . $email . ' h3',
|
98 |
'customizer_title' => 'Shipment Tracking',
|
99 |
));
|
100 |
|
133 |
* Get Customizer URL
|
134 |
*
|
135 |
*/
|
136 |
+
public function get_shipped_email_preview_url() {
|
137 |
return add_query_arg( array(
|
138 |
'wcast-shipped-email-customizer-preview' => '1',
|
139 |
), home_url( '' ) );
|
193 |
* Get Exception Shipment status preview URL
|
194 |
*
|
195 |
*/
|
196 |
+
public function get_customer_exception_preview_url() {
|
197 |
return add_query_arg( array(
|
198 |
'wcast-exception-email-customizer-preview' => '1',
|
199 |
), home_url( '' ) );
|
260 |
}
|
261 |
|
262 |
/**
|
263 |
+
* Remove unrelated components
|
264 |
+
*
|
265 |
+
* @param array $components
|
266 |
+
* @param object $wp_customize
|
267 |
+
* @return array
|
268 |
+
*/
|
269 |
+
public function remove_unrelated_components( $components, $wp_customize ) {
|
270 |
+
// Iterate over components
|
271 |
+
foreach ( $components as $component_key => $component ) {
|
272 |
+
// Check if current component is own component
|
273 |
+
if ( ! $this->is_own_component( $component ) ) {
|
274 |
+
unset($components[$component_key]);
|
275 |
+
}
|
276 |
+
}
|
|
|
277 |
|
278 |
+
// Return remaining components
|
279 |
+
return $components;
|
280 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
+
/**
|
283 |
+
* Remove unrelated sections
|
284 |
+
*
|
285 |
+
* @param bool $active
|
286 |
+
* @param object $section
|
287 |
+
* @return bool
|
288 |
+
*/
|
289 |
+
public function remove_unrelated_sections( $active, $section ) {
|
290 |
+
// Check if current section is own section
|
291 |
+
if ( ! $this->is_own_section( $section->id ) ) {
|
292 |
+
return false;
|
293 |
+
}
|
294 |
+
|
295 |
+
// We can override $active completely since this runs only on own Customizer requests
|
296 |
+
return true;
|
297 |
+
}
|
298 |
|
299 |
/**
|
300 |
* Check if current component is own component
|
301 |
+
*
|
|
|
302 |
* @param string $component
|
303 |
* @return bool
|
304 |
*/
|
308 |
|
309 |
/**
|
310 |
* Check if current section is own section
|
311 |
+
*
|
|
|
312 |
* @param string $key
|
313 |
* @return bool
|
314 |
*/
|
315 |
public function is_own_section( $key ) {
|
316 |
|
317 |
+
if ( 'ast_tracking_general_section' === $key || 'custom_order_status_email' === $key ) {
|
318 |
return true;
|
319 |
}
|
320 |
|
342 |
|
343 |
/**
|
344 |
* Get Order Ids
|
345 |
+
*
|
|
|
346 |
* @return array
|
347 |
*/
|
348 |
public function get_order_ids() {
|
358 |
));
|
359 |
|
360 |
foreach ( $orders as $order ) {
|
361 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
362 |
+
$tracking_items = $ast->get_tracking_items( $order->get_id(), true );
|
363 |
+
if ( $tracking_items ) {
|
364 |
+
$order_array[ $order->get_id() ] = $order->get_id() . ' - ' . $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
|
365 |
+
}
|
366 |
+
}
|
367 |
return $order_array;
|
368 |
}
|
369 |
}
|
390 |
*
|
391 |
* Backward compatibility.
|
392 |
*/
|
393 |
+
wcast_customizer();
|
includes/customizer/custom-controls.php
CHANGED
@@ -9,23 +9,23 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
9 |
public function render_content() {
|
10 |
?>
|
11 |
<label>
|
12 |
-
<h3 class="control_heading"><?php
|
13 |
<?php if ( ! empty( $this->description ) ) : ?>
|
14 |
-
<span class="description customize-control-description"><?php
|
15 |
<?php endif; ?>
|
16 |
</label>
|
17 |
<?php
|
18 |
}
|
19 |
}
|
20 |
|
21 |
-
class
|
22 |
|
23 |
public function render_content() {
|
24 |
?>
|
25 |
<label>
|
26 |
-
<h3 class="customize-control-title"><?php
|
27 |
<?php if ( ! empty( $this->description ) ) : ?>
|
28 |
-
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
29 |
<?php endif; ?>
|
30 |
</label>
|
31 |
<?php
|
@@ -37,7 +37,7 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
37 |
*/
|
38 |
class AST_Custom_Control extends WP_Customize_Control {
|
39 |
protected function get_skyrocket_resource_url() {
|
40 |
-
if( strpos( wp_normalize_path( __DIR__ ), wp_normalize_path( WP_PLUGIN_DIR ) ) === 0 ) {
|
41 |
// We're in a plugin directory and need to determine the url accordingly.
|
42 |
return plugin_dir_url( __DIR__ );
|
43 |
}
|
@@ -65,9 +65,9 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
65 |
* Render the control in the customizer
|
66 |
*/
|
67 |
public function render_content() {
|
68 |
-
|
69 |
<div class="slider-custom-control">
|
70 |
-
<span class="customize-control-title"><?php
|
71 |
<div class="slider" slider-min-value="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" slider-max-value="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" slider-step-value="<?php echo esc_attr( $this->input_attrs['step'] ); ?>">
|
72 |
</div>
|
73 |
<span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="<?php echo esc_attr( $this->input_attrs['default'] ); ?>"></span>
|
@@ -105,22 +105,22 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
105 |
*/
|
106 |
public function render_content() {
|
107 |
$defaultValue = $this->value();
|
108 |
-
|
109 |
<div class="dropdown_select_control">
|
110 |
-
<?php if( !empty( $this->label ) ) { ?>
|
111 |
<label for="<?php echo esc_attr( $this->id ); ?>" class="customize-control-title">
|
112 |
<?php echo esc_html( $this->label ); ?>
|
113 |
</label>
|
114 |
<?php } ?>
|
115 |
-
<?php if( !empty( $this->description ) ) { ?>
|
116 |
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
117 |
<?php } ?>
|
118 |
-
<select name="<?php echo esc_attr( $this->id ); ?>" id="<?php echo esc_attr( $this->id ); ?>" <?php $this->link(); ?> class="<?php
|
119 |
-
<?php
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
</select>
|
125 |
</div>
|
126 |
<?php
|
@@ -130,7 +130,7 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
130 |
/**
|
131 |
* TinyMCE Custom Control
|
132 |
*/
|
133 |
-
class
|
134 |
/**
|
135 |
* The type of control being rendered
|
136 |
*/
|
@@ -138,7 +138,7 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
138 |
/**
|
139 |
* Enqueue our scripts and styles
|
140 |
*/
|
141 |
-
public function enqueue(){
|
142 |
wp_enqueue_script( 'ast-custom-controls-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer.js', array( 'jquery', 'jquery-ui-core' ), wc_advanced_shipment_tracking()->version, true );
|
143 |
wp_enqueue_style( 'ast-custom-controls-css', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer.css', array(), wc_advanced_shipment_tracking()->version, 'all' );
|
144 |
wp_enqueue_editor();
|
@@ -150,16 +150,16 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
150 |
parent::to_json();
|
151 |
$this->json['asttinymcetoolbar1'] = isset( $this->input_attrs['toolbar1'] ) ? esc_attr( $this->input_attrs['toolbar1'] ) : 'bold italic bullist numlist alignleft aligncenter alignright link';
|
152 |
$this->json['asttinymcetoolbar2'] = isset( $this->input_attrs['toolbar2'] ) ? esc_attr( $this->input_attrs['toolbar2'] ) : '';
|
153 |
-
$this->json['astmediabuttons'] = isset( $this->input_attrs['mediaButtons'] ) && ( $this->input_attrs['mediaButtons']
|
154 |
}
|
155 |
/**
|
156 |
* Render the control in the customizer
|
157 |
*/
|
158 |
-
public function render_content(){
|
159 |
-
|
160 |
<div class="tinymce-control">
|
161 |
-
<span class="customize-control-title"><?php
|
162 |
-
<?php if( !empty( $this->description ) ) { ?>
|
163 |
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
164 |
<?php } ?>
|
165 |
<textarea id="<?php echo esc_attr( $this->id ); ?>" placeholder="<?php echo esc_attr( $this->input_attrs['placeholder'] ); ?>" class="" <?php $this->link(); ?>><?php echo esc_attr( $this->value() ); ?></textarea>
|
@@ -167,4 +167,4 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
167 |
<?php
|
168 |
}
|
169 |
}
|
170 |
-
}
|
9 |
public function render_content() {
|
10 |
?>
|
11 |
<label>
|
12 |
+
<h3 class="control_heading"><?php esc_html_e( $this->label, 'woo-advanced-shipment-tracking' ); ?></h3>
|
13 |
<?php if ( ! empty( $this->description ) ) : ?>
|
14 |
+
<span class="description customize-control-description"><?php esc_html_e( $this->description ); ?></span>
|
15 |
<?php endif; ?>
|
16 |
</label>
|
17 |
<?php
|
18 |
}
|
19 |
}
|
20 |
|
21 |
+
class WP_Customize_Codeinfoblock_Control extends WP_Customize_Control {
|
22 |
|
23 |
public function render_content() {
|
24 |
?>
|
25 |
<label>
|
26 |
+
<h3 class="customize-control-title"><?php esc_html_e( $this->label, 'woo-advanced-shipment-tracking' ); ?></h3>
|
27 |
<?php if ( ! empty( $this->description ) ) : ?>
|
28 |
+
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
|
29 |
<?php endif; ?>
|
30 |
</label>
|
31 |
<?php
|
37 |
*/
|
38 |
class AST_Custom_Control extends WP_Customize_Control {
|
39 |
protected function get_skyrocket_resource_url() {
|
40 |
+
if ( strpos( wp_normalize_path( __DIR__ ), wp_normalize_path( WP_PLUGIN_DIR ) ) === 0 ) {
|
41 |
// We're in a plugin directory and need to determine the url accordingly.
|
42 |
return plugin_dir_url( __DIR__ );
|
43 |
}
|
65 |
* Render the control in the customizer
|
66 |
*/
|
67 |
public function render_content() {
|
68 |
+
?>
|
69 |
<div class="slider-custom-control">
|
70 |
+
<span class="customize-control-title"><?php esc_html_e( $this->label, 'woo-advanced-shipment-tracking' ); ?></span>
|
71 |
<div class="slider" slider-min-value="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" slider-max-value="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" slider-step-value="<?php echo esc_attr( $this->input_attrs['step'] ); ?>">
|
72 |
</div>
|
73 |
<span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="<?php echo esc_attr( $this->input_attrs['default'] ); ?>"></span>
|
105 |
*/
|
106 |
public function render_content() {
|
107 |
$defaultValue = $this->value();
|
108 |
+
?>
|
109 |
<div class="dropdown_select_control">
|
110 |
+
<?php if ( !empty( $this->label ) ) { ?>
|
111 |
<label for="<?php echo esc_attr( $this->id ); ?>" class="customize-control-title">
|
112 |
<?php echo esc_html( $this->label ); ?>
|
113 |
</label>
|
114 |
<?php } ?>
|
115 |
+
<?php if ( !empty( $this->description ) ) { ?>
|
116 |
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
117 |
<?php } ?>
|
118 |
+
<select name="<?php echo esc_attr( $this->id ); ?>" id="<?php echo esc_attr( $this->id ); ?>" <?php $this->link(); ?> class="<?php esc_html_e( $this->input_attrs['class'] ); ?>" data-placeholder="<?php esc_html_e( $this->placeholder ); ?>">
|
119 |
+
<?php
|
120 |
+
foreach ( $this->choices as $key => $value ) {
|
121 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $key ), $defaultValue, false ) . '>' . esc_attr( $value ) . '</option>';
|
122 |
+
}
|
123 |
+
?>
|
124 |
</select>
|
125 |
</div>
|
126 |
<?php
|
130 |
/**
|
131 |
* TinyMCE Custom Control
|
132 |
*/
|
133 |
+
class AST_TinyMCE_Custom_Control extends AST_Custom_Control {
|
134 |
/**
|
135 |
* The type of control being rendered
|
136 |
*/
|
138 |
/**
|
139 |
* Enqueue our scripts and styles
|
140 |
*/
|
141 |
+
public function enqueue() {
|
142 |
wp_enqueue_script( 'ast-custom-controls-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer.js', array( 'jquery', 'jquery-ui-core' ), wc_advanced_shipment_tracking()->version, true );
|
143 |
wp_enqueue_style( 'ast-custom-controls-css', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer.css', array(), wc_advanced_shipment_tracking()->version, 'all' );
|
144 |
wp_enqueue_editor();
|
150 |
parent::to_json();
|
151 |
$this->json['asttinymcetoolbar1'] = isset( $this->input_attrs['toolbar1'] ) ? esc_attr( $this->input_attrs['toolbar1'] ) : 'bold italic bullist numlist alignleft aligncenter alignright link';
|
152 |
$this->json['asttinymcetoolbar2'] = isset( $this->input_attrs['toolbar2'] ) ? esc_attr( $this->input_attrs['toolbar2'] ) : '';
|
153 |
+
$this->json['astmediabuttons'] = isset( $this->input_attrs['mediaButtons'] ) && ( true === $this->input_attrs['mediaButtons'] ) ? true : false;
|
154 |
}
|
155 |
/**
|
156 |
* Render the control in the customizer
|
157 |
*/
|
158 |
+
public function render_content() {
|
159 |
+
?>
|
160 |
<div class="tinymce-control">
|
161 |
+
<span class="customize-control-title"><?php esc_html_e( $this->label, 'woo-advanced-shipment-tracking' ); ?></span>
|
162 |
+
<?php if ( !empty( $this->description ) ) { ?>
|
163 |
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
164 |
<?php } ?>
|
165 |
<textarea id="<?php echo esc_attr( $this->id ); ?>" placeholder="<?php echo esc_attr( $this->input_attrs['placeholder'] ); ?>" class="" <?php $this->link(); ?>><?php echo esc_attr( $this->value() ); ?></textarea>
|
167 |
<?php
|
168 |
}
|
169 |
}
|
170 |
+
}
|
includes/customizer/preview/availableforpickup_preview.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php $this->preview_availableforpickup_email(); ?>
|
20 |
</div>
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body class="ast_preview_body">
|
17 |
<div id="overlay"></div>
|
18 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
19 |
<?php $this->preview_availableforpickup_email(); ?>
|
20 |
</div>
|
21 |
+
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
+
wp_footer();
|
25 |
+
?>
|
26 |
+
|
27 |
+
</body>
|
28 |
|
29 |
+
</html>
|
includes/customizer/preview/delivered_status_preview.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php $this->preview_delivered_email(); ?>
|
20 |
</div>
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body class="ast_preview_body">
|
17 |
<div id="overlay"></div>
|
18 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
19 |
<?php $this->preview_delivered_email(); ?>
|
20 |
</div>
|
21 |
+
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
+
wp_footer();
|
25 |
+
?>
|
26 |
+
|
27 |
+
</body>
|
28 |
|
29 |
+
</html>
|
includes/customizer/preview/exception_preview.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php $this->preview_exception_email(); ?>
|
20 |
</div>
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body class="ast_preview_body">
|
17 |
<div id="overlay"></div>
|
18 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
19 |
<?php $this->preview_exception_email(); ?>
|
20 |
</div>
|
21 |
+
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
+
wp_footer();
|
25 |
+
?>
|
26 |
+
|
27 |
+
</body>
|
28 |
|
29 |
+
</html>
|
includes/customizer/preview/failure_preview.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
-
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
<div id="overlay"></div>
|
17 |
-
|
18 |
<?php $this->preview_failure_email(); ?>
|
19 |
</div>
|
20 |
-
|
21 |
<?php
|
22 |
do_action( 'woomail_footer' );
|
23 |
-
wp_footer();
|
24 |
-
|
25 |
-
|
|
|
26 |
|
27 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
10 |
+
<meta name="viewport" content="width=device-width" />
|
11 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
12 |
+
</head>
|
13 |
+
|
14 |
+
<body class="ast_preview_body">
|
15 |
<div id="overlay"></div>
|
16 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
17 |
<?php $this->preview_failure_email(); ?>
|
18 |
</div>
|
19 |
+
|
20 |
<?php
|
21 |
do_action( 'woomail_footer' );
|
22 |
+
wp_footer();
|
23 |
+
?>
|
24 |
+
|
25 |
+
</body>
|
26 |
|
27 |
+
</html>
|
includes/customizer/preview/intransit_preview.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
-
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
<div id="overlay"></div>
|
17 |
-
|
18 |
<?php $this->preview_intransit_email(); ?>
|
19 |
</div>
|
20 |
-
|
21 |
<?php
|
22 |
do_action( 'woomail_footer' );
|
23 |
-
wp_footer();
|
24 |
-
|
25 |
-
|
|
|
26 |
|
27 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
10 |
+
<meta name="viewport" content="width=device-width" />
|
11 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
12 |
+
</head>
|
13 |
+
|
14 |
+
<body class="ast_preview_body">
|
15 |
<div id="overlay"></div>
|
16 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
17 |
<?php $this->preview_intransit_email(); ?>
|
18 |
</div>
|
19 |
+
|
20 |
<?php
|
21 |
do_action( 'woomail_footer' );
|
22 |
+
wp_footer();
|
23 |
+
?>
|
24 |
+
|
25 |
+
</body>
|
26 |
|
27 |
+
</html>
|
includes/customizer/preview/late_shipments_preview.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
<?php
|
25 |
do_action( 'woomail_footer' );
|
26 |
-
wp_footer();
|
27 |
-
|
28 |
-
|
|
|
29 |
|
30 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
+
|
10 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
+
<meta name="viewport" content="width=device-width" />
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body class="ast_preview_body">
|
16 |
<div id="overlay"></div>
|
17 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
18 |
+
|
19 |
+
<?php wcast_late_shipments_customizer_email::preview_late_shipments_email(); ?>
|
20 |
+
|
21 |
+
</div>
|
22 |
+
|
23 |
<?php
|
24 |
do_action( 'woomail_footer' );
|
25 |
+
wp_footer();
|
26 |
+
?>
|
27 |
+
|
28 |
+
</body>
|
29 |
|
30 |
+
</html>
|
includes/customizer/preview/onhold_preview.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
<head>
|
9 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
10 |
-
|
11 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
<div id="overlay"></div>
|
16 |
-
|
17 |
<?php $this->preview_onhold_email(); ?>
|
18 |
</div>
|
19 |
<?php
|
20 |
do_action( 'woomail_footer' );
|
21 |
-
wp_footer();
|
|
|
22 |
</body>
|
23 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
<head>
|
8 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
9 |
+
<meta name="viewport" content="width=device-width" />
|
10 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
11 |
+
</head>
|
12 |
+
|
13 |
+
<body class="ast_preview_body">
|
14 |
<div id="overlay"></div>
|
15 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
16 |
<?php $this->preview_onhold_email(); ?>
|
17 |
</div>
|
18 |
<?php
|
19 |
do_action( 'woomail_footer' );
|
20 |
+
wp_footer();
|
21 |
+
?>
|
22 |
</body>
|
23 |
+
</html>
|
includes/customizer/preview/outfordelivery_preview.php
CHANGED
@@ -1,27 +1,26 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
-
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
<div id="overlay"></div>
|
17 |
-
|
18 |
<?php $this->preview_outfordelivery_email(); ?>
|
19 |
</div>
|
20 |
-
|
21 |
<?php
|
22 |
do_action( 'woomail_footer' );
|
23 |
-
wp_footer();
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
<meta charset="<?php bloginfo('charset'); ?>" />
|
10 |
+
<meta name="viewport" content="width=device-width" />
|
11 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
12 |
+
</head>
|
13 |
+
|
14 |
+
<body class="ast_preview_body">
|
15 |
<div id="overlay"></div>
|
16 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
17 |
<?php $this->preview_outfordelivery_email(); ?>
|
18 |
</div>
|
19 |
+
|
20 |
<?php
|
21 |
do_action( 'woomail_footer' );
|
22 |
+
wp_footer();
|
23 |
+
?>
|
24 |
+
|
25 |
+
</body>
|
26 |
+
</html>
|
includes/customizer/preview/partial_shipped_preview.php
CHANGED
@@ -1,30 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
<?php
|
25 |
do_action( 'woomail_footer' );
|
26 |
-
wp_footer();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
+
|
10 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
+
<meta name="viewport" content="width=device-width" />
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body class="ast_preview_body">
|
16 |
<div id="overlay"></div>
|
17 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
18 |
+
|
19 |
+
<?php wcast_partial_shipped_customizer_email::preview_partial_shipped_email(); ?>
|
20 |
+
|
21 |
+
</div>
|
22 |
+
|
23 |
<?php
|
24 |
do_action( 'woomail_footer' );
|
25 |
+
wp_footer();
|
26 |
+
?>
|
27 |
+
|
28 |
+
</body>
|
29 |
+
</html>
|
includes/customizer/preview/preview.php
CHANGED
@@ -1,30 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
<?php
|
25 |
do_action( 'woomail_footer' );
|
26 |
-
wp_footer();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
+
|
10 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
+
<meta name="viewport" content="width=device-width" />
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body class="ast_preview_body">
|
16 |
<div id="overlay"></div>
|
17 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
18 |
+
|
19 |
+
<?php wcast_initialise_customizer_settings::preview_completed_email(); ?>
|
20 |
+
|
21 |
+
</div>
|
22 |
+
|
23 |
<?php
|
24 |
do_action( 'woomail_footer' );
|
25 |
+
wp_footer();
|
26 |
+
?>
|
27 |
+
|
28 |
+
</body>
|
29 |
+
</html>
|
includes/customizer/preview/returntosender_preview.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
-
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php $this->preview_returntosender_email(); ?>
|
20 |
-
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
|
|
6 |
?>
|
7 |
+
|
8 |
+
<head>
|
9 |
+
|
10 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
11 |
+
<meta name="viewport" content="width=device-width" />
|
12 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body class="ast_preview_body">
|
16 |
<div id="overlay"></div>
|
17 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
18 |
<?php $this->preview_returntosender_email(); ?>
|
19 |
+
</div>
|
20 |
+
|
21 |
<?php
|
22 |
do_action( 'woomail_footer' );
|
23 |
+
wp_footer();
|
24 |
+
?>
|
25 |
+
|
26 |
+
</body>
|
27 |
|
28 |
+
</html>
|
includes/customizer/preview/tracking_page_preview.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
wp_head();
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php //ts_tracking_page_customizer::preview_tracking_page(); ?>
|
20 |
</div>
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
6 |
wp_head();
|
7 |
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body class="ast_preview_body">
|
17 |
<div id="overlay"></div>
|
18 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
19 |
<?php //ts_tracking_page_customizer::preview_tracking_page(); ?>
|
20 |
</div>
|
21 |
+
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
+
wp_footer();
|
25 |
+
?>
|
26 |
+
|
27 |
+
</body>
|
28 |
|
29 |
+
</html>
|
includes/customizer/preview/updated_tracking_preview.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
-
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
<div id="overlay"></div>
|
18 |
-
|
19 |
<?php $this->preview_updated_tracking_email(); ?>
|
20 |
-
|
21 |
-
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
-
wp_footer();
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
</html>
|
1 |
<?php
|
2 |
// Exit if accessed directly
|
3 |
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
}
|
6 |
|
7 |
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
<style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body class="ast_preview_body">
|
17 |
<div id="overlay"></div>
|
18 |
+
<div id="ast_preview_wrapper" style="display: block;">
|
19 |
<?php $this->preview_updated_tracking_email(); ?>
|
20 |
+
</div>
|
21 |
+
|
22 |
<?php
|
23 |
do_action( 'woomail_footer' );
|
24 |
+
wp_footer();
|
25 |
+
?>
|
26 |
+
|
27 |
+
</body>
|
28 |
|
29 |
+
</html>
|
includes/email-manager.php
CHANGED
@@ -14,25 +14,25 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
14 |
if (!defined( 'AST_TEMPLATE_PATH' ) ) {
|
15 |
define( 'AST_TEMPLATE_PATH', SHIPMENT_TRACKING_PATH . '/templates/' );
|
16 |
}
|
17 |
-
|
18 |
add_filter( 'woocommerce_email_classes', array( $this, 'custom_init_emails' ) );
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
*/
|
24 |
public function custom_init_emails( $emails ) {
|
25 |
|
26 |
// Include the email class file if it's not included already
|
27 |
$partial_shipped_status = get_option( 'wc_ast_status_partial_shipped', 0 );
|
28 |
-
if( true == $partial_shipped_status ) {
|
29 |
if ( ! isset( $emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] ) ) {
|
30 |
$emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] = include_once( 'emails/class-shipment-partial-shipped-email.php' );
|
31 |
}
|
32 |
}
|
33 |
|
34 |
$updated_tracking_status = get_option( 'wc_ast_status_updated_tracking', 0 );
|
35 |
-
if( true == $updated_tracking_status ) {
|
36 |
if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
|
37 |
$emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
|
38 |
}
|
@@ -41,7 +41,7 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
*
|
45 |
*/
|
46 |
public function email_content( $email_content, $order_id, $order ) {
|
47 |
|
@@ -65,7 +65,7 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
65 |
if ( isset( $company_name ) ) {
|
66 |
$email_content = str_replace( '{customer_company_name}', $company_name, $email_content );
|
67 |
} else {
|
68 |
-
$email_content = str_replace( '{customer_company_name}','', $email_content );
|
69 |
}
|
70 |
|
71 |
if ( isset( $username ) ) {
|
@@ -113,4 +113,4 @@ function wc_advanced_shipment_tracking_email_class() {
|
|
113 |
*
|
114 |
* Backward compatibility.
|
115 |
*/
|
116 |
-
wc_advanced_shipment_tracking_email_class();
|
14 |
if (!defined( 'AST_TEMPLATE_PATH' ) ) {
|
15 |
define( 'AST_TEMPLATE_PATH', SHIPMENT_TRACKING_PATH . '/templates/' );
|
16 |
}
|
17 |
+
// hook for when order status is changed
|
18 |
add_filter( 'woocommerce_email_classes', array( $this, 'custom_init_emails' ) );
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
+
* Code for include delivered email class
|
23 |
*/
|
24 |
public function custom_init_emails( $emails ) {
|
25 |
|
26 |
// Include the email class file if it's not included already
|
27 |
$partial_shipped_status = get_option( 'wc_ast_status_partial_shipped', 0 );
|
28 |
+
if ( true == $partial_shipped_status ) {
|
29 |
if ( ! isset( $emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] ) ) {
|
30 |
$emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] = include_once( 'emails/class-shipment-partial-shipped-email.php' );
|
31 |
}
|
32 |
}
|
33 |
|
34 |
$updated_tracking_status = get_option( 'wc_ast_status_updated_tracking', 0 );
|
35 |
+
if ( true == $updated_tracking_status ) {
|
36 |
if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
|
37 |
$emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
|
38 |
}
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
+
* Code for format email content
|
45 |
*/
|
46 |
public function email_content( $email_content, $order_id, $order ) {
|
47 |
|
65 |
if ( isset( $company_name ) ) {
|
66 |
$email_content = str_replace( '{customer_company_name}', $company_name, $email_content );
|
67 |
} else {
|
68 |
+
$email_content = str_replace( '{customer_company_name}', '', $email_content );
|
69 |
}
|
70 |
|
71 |
if ( isset( $username ) ) {
|
113 |
*
|
114 |
* Backward compatibility.
|
115 |
*/
|
116 |
+
wc_advanced_shipment_tracking_email_class();
|
includes/emails/class-shipment-partial-shipped-email.php
CHANGED
@@ -100,7 +100,7 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
100 |
public function get_content_html() {
|
101 |
$template = $this->get_template( 'template_html' );
|
102 |
$local_file = $this->get_theme_template_file( $template );
|
103 |
-
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
104 |
return wc_get_template_html(
|
105 |
$this->template_html,
|
106 |
array(
|
@@ -112,7 +112,7 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
112 |
'email' => $this,
|
113 |
)
|
114 |
);
|
115 |
-
} else if( class_exists('ast_pro') ){
|
116 |
return wc_get_template_html(
|
117 |
'emails/customer-partial-shipped-order.php',
|
118 |
array(
|
@@ -126,7 +126,7 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
126 |
'woocommerce-advanced-shipment-tracking/',
|
127 |
ast_pro()->get_plugin_path() . '/templates/'
|
128 |
);
|
129 |
-
} else{
|
130 |
return wc_get_template_html(
|
131 |
'emails/customer-partial-shipped-order.php',
|
132 |
array(
|
@@ -151,7 +151,7 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
151 |
public function get_content_plain() {
|
152 |
$template = $this->get_template( 'template_html' );
|
153 |
$local_file = $this->get_theme_template_file( $template );
|
154 |
-
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
155 |
//echo $local_file;exit;
|
156 |
return wc_get_template_html(
|
157 |
$this->template_html,
|
@@ -164,7 +164,7 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
164 |
'email' => $this,
|
165 |
)
|
166 |
);
|
167 |
-
} else{
|
168 |
return wc_get_template_html(
|
169 |
'emails/customer-partial-shipped-order.php',
|
170 |
array(
|
@@ -194,4 +194,4 @@ if ( ! class_exists( 'WC_Email_Customer_Partial_Shipped_Order', false ) ) :
|
|
194 |
|
195 |
endif;
|
196 |
|
197 |
-
return new WC_Email_Customer_Partial_Shipped_Order();
|
100 |
public function get_content_html() {
|
101 |
$template = $this->get_template( 'template_html' );
|
102 |
$local_file = $this->get_theme_template_file( $template );
|
103 |
+
if ( file_exists( $local_file ) && is_writable( $local_file )) {
|
104 |
return wc_get_template_html(
|
105 |
$this->template_html,
|
106 |
array(
|
112 |
'email' => $this,
|
113 |
)
|
114 |
);
|
115 |
+
} else if ( class_exists('ast_pro') ) {
|
116 |
return wc_get_template_html(
|
117 |
'emails/customer-partial-shipped-order.php',
|
118 |
array(
|
126 |
'woocommerce-advanced-shipment-tracking/',
|
127 |
ast_pro()->get_plugin_path() . '/templates/'
|
128 |
);
|
129 |
+
} else {
|
130 |
return wc_get_template_html(
|
131 |
'emails/customer-partial-shipped-order.php',
|
132 |
array(
|
151 |
public function get_content_plain() {
|
152 |
$template = $this->get_template( 'template_html' );
|
153 |
$local_file = $this->get_theme_template_file( $template );
|
154 |
+
if ( file_exists( $local_file ) && is_writable( $local_file )) {
|
155 |
//echo $local_file;exit;
|
156 |
return wc_get_template_html(
|
157 |
$this->template_html,
|
164 |
'email' => $this,
|
165 |
)
|
166 |
);
|
167 |
+
} else {
|
168 |
return wc_get_template_html(
|
169 |
'emails/customer-partial-shipped-order.php',
|
170 |
array(
|
194 |
|
195 |
endif;
|
196 |
|
197 |
+
return new WC_Email_Customer_Partial_Shipped_Order();
|
includes/emails/class-shipment-updated-tracking-email.php
CHANGED
@@ -100,7 +100,7 @@ if ( ! class_exists( 'WC_Email_Customer_Updated_Tracking_Order', false ) ) :
|
|
100 |
public function get_content_html() {
|
101 |
$template = $this->get_template( 'template_html' );
|
102 |
$local_file = $this->get_theme_template_file( $template );
|
103 |
-
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
104 |
//echo $local_file;exit;
|
105 |
return wc_get_template_html(
|
106 |
$this->template_html,
|
@@ -113,7 +113,7 @@ if ( ! class_exists( 'WC_Email_Customer_Updated_Tracking_Order', false ) ) :
|
|
113 |
'email' => $this,
|
114 |
)
|
115 |
);
|
116 |
-
} else{
|
117 |
return wc_get_template_html(
|
118 |
'emails/customer-updated-tracking-order.php',
|
119 |
array(
|
@@ -138,7 +138,7 @@ if ( ! class_exists( 'WC_Email_Customer_Updated_Tracking_Order', false ) ) :
|
|
138 |
public function get_content_plain() {
|
139 |
$template = $this->get_template( 'template_html' );
|
140 |
$local_file = $this->get_theme_template_file( $template );
|
141 |
-
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
142 |
//echo $local_file;exit;
|
143 |
return wc_get_template_html(
|
144 |
$this->template_html,
|
@@ -151,7 +151,7 @@ if ( ! class_exists( 'WC_Email_Customer_Updated_Tracking_Order', false ) ) :
|
|
151 |
'email' => $this,
|
152 |
)
|
153 |
);
|
154 |
-
} else{
|
155 |
return wc_get_template_html(
|
156 |
'emails/customer-updated-tracking-order.php',
|
157 |
array(
|
@@ -181,4 +181,4 @@ if ( ! class_exists( 'WC_Email_Customer_Updated_Tracking_Order', false ) ) :
|
|
181 |
|
182 |
endif;
|
183 |
|
184 |
-
return new WC_Email_Customer_Updated_Tracking_Order();
|
100 |
public function get_content_html() {
|
101 |
$template = $this->get_template( 'template_html' );
|
102 |
$local_file = $this->get_theme_template_file( $template );
|
103 |
+
if ( file_exists( $local_file ) && is_writable( $local_file )) {
|
104 |
//echo $local_file;exit;
|
105 |
return wc_get_template_html(
|
106 |
$this->template_html,
|
113 |
'email' => $this,
|
114 |
)
|
115 |
);
|
116 |
+
} else {
|
117 |
return wc_get_template_html(
|
118 |
'emails/customer-updated-tracking-order.php',
|
119 |
array(
|
138 |
public function get_content_plain() {
|
139 |
$template = $this->get_template( 'template_html' );
|
140 |
$local_file = $this->get_theme_template_file( $template );
|
141 |
+
if ( file_exists( $local_file ) && is_writable( $local_file )) {
|
142 |
//echo $local_file;exit;
|
143 |
return wc_get_template_html(
|
144 |
$this->template_html,
|
151 |
'email' => $this,
|
152 |
)
|
153 |
);
|
154 |
+
} else {
|
155 |
return wc_get_template_html(
|
156 |
'emails/customer-updated-tracking-order.php',
|
157 |
array(
|
181 |
|
182 |
endif;
|
183 |
|
184 |
+
return new WC_Email_Customer_Updated_Tracking_Order();
|
includes/tracking-info.php
CHANGED
@@ -71,9 +71,7 @@ if ( !function_exists( 'ast_get_product_id_by_sku' ) ) {
|
|
71 |
}
|
72 |
|
73 |
$product_id = $wpdb->get_var(
|
74 |
-
$wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value
|
75 |
-
$sku)
|
76 |
-
);
|
77 |
|
78 |
if ( $product_id ) {
|
79 |
return $product_id;
|
@@ -81,4 +79,4 @@ if ( !function_exists( 'ast_get_product_id_by_sku' ) ) {
|
|
81 |
|
82 |
return null;
|
83 |
}
|
84 |
-
}
|
71 |
}
|
72 |
|
73 |
$product_id = $wpdb->get_var(
|
74 |
+
$wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value=%s LIMIT 1", $sku ) );
|
|
|
|
|
75 |
|
76 |
if ( $product_id ) {
|
77 |
return $product_id;
|
79 |
|
80 |
return null;
|
81 |
}
|
82 |
+
}
|
includes/trackship-email-manager.php
CHANGED
@@ -13,17 +13,17 @@ class WC_TrackShip_Email_Manager {
|
|
13 |
}
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*/
|
18 |
-
public function shippment_status_email_trigger( $order_id, $order, $old_status, $new_status
|
19 |
|
20 |
-
$status = str_replace(
|
21 |
$status_class = 'wcast_' . $status . '_customizer_email';
|
22 |
$status_customizer = new $status_class();
|
23 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
24 |
|
25 |
$enable = $ast->get_checkbox_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_enable_' . $status . '_email', '' );
|
26 |
-
if( !$enable ) {
|
27 |
return;
|
28 |
}
|
29 |
|
@@ -31,7 +31,7 @@ class WC_TrackShip_Email_Manager {
|
|
31 |
$subject = $this->email_subject( $email_subject, $order_id, $order );
|
32 |
|
33 |
$email_to = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_to', $status_customizer->defaults[ 'wcast_' . $status . '_email_to' ] );
|
34 |
-
$email_to = explode(
|
35 |
|
36 |
$email_heading = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_heading', $status_customizer->defaults[ 'wcast_' . $status . '_email_heading' ] );
|
37 |
$email_content = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_content', $status_customizer->defaults[ 'wcast_' . $status . '_email_content' ] );
|
@@ -52,7 +52,7 @@ class WC_TrackShip_Email_Manager {
|
|
52 |
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
53 |
}
|
54 |
|
55 |
-
if( $wcast_show_shipping_address ) {
|
56 |
$message .= $ast->order_shipping_details_template( $order );
|
57 |
}
|
58 |
|
@@ -70,20 +70,20 @@ class WC_TrackShip_Email_Manager {
|
|
70 |
$email_send = wp_mail( $recipient, $subject, $message, $email->get_headers() );
|
71 |
$logger = wc_get_logger();
|
72 |
$context = array( 'source' => 'trackship_shipment_status_email_log' );
|
73 |
-
$logger->error(
|
74 |
}
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
-
*
|
79 |
*/
|
80 |
public function delivered_shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status ) {
|
81 |
|
82 |
$delivered_customizer = new wcast_delivered_customizer_email();
|
83 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
84 |
|
85 |
-
$enable = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_enable_delivered_status_email'
|
86 |
-
if( !$enable ) {
|
87 |
return;
|
88 |
}
|
89 |
|
@@ -91,7 +91,7 @@ class WC_TrackShip_Email_Manager {
|
|
91 |
$subject = $this->email_subject( $email_subject, $order_id, $order );
|
92 |
|
93 |
$email_to = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_to', $delivered_customizer->defaults[ 'wcast_delivered_status_email_to' ] );
|
94 |
-
$email_to = explode(
|
95 |
|
96 |
$email_heading = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_heading', $delivered_customizer->defaults[ 'wcast_delivered_status_email_heading' ] );
|
97 |
$email_heading = $this->email_heading( $email_heading, $order_id, $order );
|
@@ -136,13 +136,13 @@ class WC_TrackShip_Email_Manager {
|
|
136 |
$email_send = wp_mail( $recipient, $subject, $message, $email->get_headers() );
|
137 |
$logger = wc_get_logger();
|
138 |
$context = array( 'source' => 'trackship_shipment_status_email_log' );
|
139 |
-
$logger->error(
|
140 |
}
|
141 |
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
-
*
|
146 |
*/
|
147 |
public function email_subject( $string, $order_id, $order ) {
|
148 |
|
@@ -172,7 +172,7 @@ class WC_TrackShip_Email_Manager {
|
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
-
*
|
176 |
*/
|
177 |
public function email_heading( $string, $order_id, $order ) {
|
178 |
|
@@ -202,7 +202,7 @@ class WC_TrackShip_Email_Manager {
|
|
202 |
}
|
203 |
|
204 |
/**
|
205 |
-
*
|
206 |
*/
|
207 |
public function email_to( $string, $order, $order_id ) {
|
208 |
$customer_email = $order->get_billing_email();
|
@@ -213,7 +213,7 @@ class WC_TrackShip_Email_Manager {
|
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
-
*
|
217 |
*/
|
218 |
public function email_content( $email_content, $order_id, $order ) {
|
219 |
|
@@ -243,7 +243,7 @@ class WC_TrackShip_Email_Manager {
|
|
243 |
if ( isset( $company_name ) ) {
|
244 |
$email_content = str_replace( '{customer_company_name}', $company_name, $email_content );
|
245 |
} else {
|
246 |
-
$email_content = str_replace( '{customer_company_name}','', $email_content );
|
247 |
}
|
248 |
|
249 |
if ( isset( $username ) ) {
|
@@ -262,11 +262,11 @@ class WC_TrackShip_Email_Manager {
|
|
262 |
}
|
263 |
|
264 |
/**
|
265 |
-
*
|
266 |
*/
|
267 |
public function append_analytics_link( $message, $status ) {
|
268 |
|
269 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
270 |
|
271 |
if ( 'delivered_status' == $status ) {
|
272 |
$analytics_link = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_analytics_link', '' );
|
@@ -276,20 +276,20 @@ class WC_TrackShip_Email_Manager {
|
|
276 |
|
277 |
if ( $analytics_link ) {
|
278 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
279 |
-
$message = preg_replace_callback($regex, function($match) use ($status){
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
}
|
288 |
return $message;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
-
*
|
293 |
*/
|
294 |
public function get_est_delivery_date( $order_id, $order ) {
|
295 |
|
@@ -310,8 +310,8 @@ class WC_TrackShip_Email_Manager {
|
|
310 |
if ( isset( $shipment_status[ $key ][ 'est_delivery_date' ] ) && '' != $shipment_status[ $key ][ 'est_delivery_date' ] ) {
|
311 |
$est_delivery_date = $shipment_status[$key]['est_delivery_date'];
|
312 |
$unixTimestamp = strtotime($est_delivery_date);
|
313 |
-
$day =
|
314 |
-
$html .= '<div>Estimated Delivery Date for Tracking Number - ' . $tracking_number . '</div><h3 style="margin:0 0 10px;">' . $day . ', '.
|
315 |
}
|
316 |
}
|
317 |
}
|
@@ -372,4 +372,4 @@ function wc_trackship_email_manager() {
|
|
372 |
*
|
373 |
* Backward compatibility.
|
374 |
*/
|
375 |
-
wc_trackship_email_manager();
|
13 |
}
|
14 |
|
15 |
/**
|
16 |
+
* Code for send shipment status email
|
17 |
*/
|
18 |
+
public function shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status ) {
|
19 |
|
20 |
+
$status = str_replace( '_', '', $new_status );
|
21 |
$status_class = 'wcast_' . $status . '_customizer_email';
|
22 |
$status_customizer = new $status_class();
|
23 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
24 |
|
25 |
$enable = $ast->get_checkbox_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_enable_' . $status . '_email', '' );
|
26 |
+
if ( !$enable ) {
|
27 |
return;
|
28 |
}
|
29 |
|
31 |
$subject = $this->email_subject( $email_subject, $order_id, $order );
|
32 |
|
33 |
$email_to = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_to', $status_customizer->defaults[ 'wcast_' . $status . '_email_to' ] );
|
34 |
+
$email_to = explode( ',', $email_to );
|
35 |
|
36 |
$email_heading = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_heading', $status_customizer->defaults[ 'wcast_' . $status . '_email_heading' ] );
|
37 |
$email_content = $ast->get_option_value_from_array( 'wcast_' . $status . '_email_settings', 'wcast_' . $status . '_email_content', $status_customizer->defaults[ 'wcast_' . $status . '_email_content' ] );
|
52 |
$message .= $ast->order_details_template( $order, $hide_shipping_item_price );
|
53 |
}
|
54 |
|
55 |
+
if ( $wcast_show_shipping_address ) {
|
56 |
$message .= $ast->order_shipping_details_template( $order );
|
57 |
}
|
58 |
|
70 |
$email_send = wp_mail( $recipient, $subject, $message, $email->get_headers() );
|
71 |
$logger = wc_get_logger();
|
72 |
$context = array( 'source' => 'trackship_shipment_status_email_log' );
|
73 |
+
$logger->error( 'Order_Id: ' . $order_id . ' Shipment_Status: ' . $new_status . ' Email_Sent: ' . $email_send, $context );
|
74 |
}
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
+
* Code for send delivered shipment status email
|
79 |
*/
|
80 |
public function delivered_shippment_status_email_trigger( $order_id, $order, $old_status, $new_status, $tracking_item, $shipment_status ) {
|
81 |
|
82 |
$delivered_customizer = new wcast_delivered_customizer_email();
|
83 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
84 |
|
85 |
+
$enable = $ast->get_checkbox_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_enable_delivered_status_email', $delivered_customizer->defaults['wcast_enable_delivered_status_email'] );
|
86 |
+
if ( !$enable ) {
|
87 |
return;
|
88 |
}
|
89 |
|
91 |
$subject = $this->email_subject( $email_subject, $order_id, $order );
|
92 |
|
93 |
$email_to = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_to', $delivered_customizer->defaults[ 'wcast_delivered_status_email_to' ] );
|
94 |
+
$email_to = explode( ',', $email_to );
|
95 |
|
96 |
$email_heading = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_email_heading', $delivered_customizer->defaults[ 'wcast_delivered_status_email_heading' ] );
|
97 |
$email_heading = $this->email_heading( $email_heading, $order_id, $order );
|
136 |
$email_send = wp_mail( $recipient, $subject, $message, $email->get_headers() );
|
137 |
$logger = wc_get_logger();
|
138 |
$context = array( 'source' => 'trackship_shipment_status_email_log' );
|
139 |
+
$logger->error( 'Order_Id: ' . $order_id . ' Shipment_Status: ' . $new_status . ' Email_Sent: ' . $email_send, $context );
|
140 |
}
|
141 |
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
+
* Code for format email subject
|
146 |
*/
|
147 |
public function email_subject( $string, $order_id, $order ) {
|
148 |
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
+
* Code for format email heading
|
176 |
*/
|
177 |
public function email_heading( $string, $order_id, $order ) {
|
178 |
|
202 |
}
|
203 |
|
204 |
/**
|
205 |
+
* Code for format recipients
|
206 |
*/
|
207 |
public function email_to( $string, $order, $order_id ) {
|
208 |
$customer_email = $order->get_billing_email();
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
+
* Code for format email content
|
217 |
*/
|
218 |
public function email_content( $email_content, $order_id, $order ) {
|
219 |
|
243 |
if ( isset( $company_name ) ) {
|
244 |
$email_content = str_replace( '{customer_company_name}', $company_name, $email_content );
|
245 |
} else {
|
246 |
+
$email_content = str_replace( '{customer_company_name}', '', $email_content );
|
247 |
}
|
248 |
|
249 |
if ( isset( $username ) ) {
|
262 |
}
|
263 |
|
264 |
/**
|
265 |
+
* Code for append analytics link
|
266 |
*/
|
267 |
public function append_analytics_link( $message, $status ) {
|
268 |
|
269 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
270 |
|
271 |
if ( 'delivered_status' == $status ) {
|
272 |
$analytics_link = $ast->get_option_value_from_array( 'wcast_delivered_email_settings', 'wcast_delivered_status_analytics_link', '' );
|
276 |
|
277 |
if ( $analytics_link ) {
|
278 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
279 |
+
$message = preg_replace_callback ( $regex, function ( $match ) use ( $status ) {
|
280 |
+
$url = $match[2];
|
281 |
+
if (strpos($url, '?') === false) {
|
282 |
+
$url .= '?';
|
283 |
+
}
|
284 |
+
$url .= $analytics_link;
|
285 |
+
return $match[1] . $url . $match[3];
|
286 |
+
}, $message );
|
287 |
}
|
288 |
return $message;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
+
* Code for get estimate delivery date
|
293 |
*/
|
294 |
public function get_est_delivery_date( $order_id, $order ) {
|
295 |
|
310 |
if ( isset( $shipment_status[ $key ][ 'est_delivery_date' ] ) && '' != $shipment_status[ $key ][ 'est_delivery_date' ] ) {
|
311 |
$est_delivery_date = $shipment_status[$key]['est_delivery_date'];
|
312 |
$unixTimestamp = strtotime($est_delivery_date);
|
313 |
+
$day = gmdate( 'l', $unixTimestamp );
|
314 |
+
$html .= '<div>Estimated Delivery Date for Tracking Number - ' . $tracking_number . '</div><h3 style="margin:0 0 10px;">' . $day . ', ' . gmdate( 'M d', strtotime($est_delivery_date) ) . '</h3>';
|
315 |
}
|
316 |
}
|
317 |
}
|
372 |
*
|
373 |
* Backward compatibility.
|
374 |
*/
|
375 |
+
wc_trackship_email_manager();
|
includes/views/admin_options_addons.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
6 |
?>
|
@@ -21,10 +21,11 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
21 |
} elseif ( class_exists( 'paypal_tracking_add_on' ) ) {
|
22 |
$show_addons_tab = true;
|
23 |
}
|
24 |
-
$addons = isset( $_GET['addons'] ) ? sanitize_text_field($_GET['addons']) : 'addons';
|
|
|
25 |
|
26 |
<?php do_action('ast_addon_license_form'); ?>
|
27 |
-
<?php if(!class_exists('ast_pro')){ ?>
|
28 |
<div class="section-content trackship_addon_section">
|
29 |
<div class="ast-row">
|
30 |
<div class="as-col-6">
|
@@ -33,41 +34,43 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
33 |
<ul class="ast_pro_features_list">
|
34 |
<li>Premium Support</li>
|
35 |
<li>Tracking per item</li>
|
36 |
-
<li>
|
37 |
<li>Custom order status "Shipped"</li>
|
38 |
-
<li>Custom email templates</li>
|
39 |
-
<li>
|
|
|
40 |
<li>Auto-detect shipping providers</li>
|
41 |
-
<li>
|
42 |
</ul>
|
43 |
<a href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/" class="button-primary btn_ast2 btn_large" target="_blank">UPGRADE NOW</a>
|
44 |
</div>
|
45 |
</div>
|
46 |
<div class="as-col-6">
|
47 |
<div class="ts_col_inner ast_ts_landing_banner">
|
48 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/ast-pro-banner.png">
|
49 |
</div>
|
50 |
</div>
|
51 |
</div>
|
52 |
</div>
|
53 |
<?php } ?>
|
54 |
|
55 |
-
<h1 class="tab_section_heading clear_spacing" style="margin: 20px 0 0;"><?php
|
56 |
|
57 |
<div class="plugins_section free_plugin_section">
|
58 |
<div class="single_plugin as-col-4">
|
59 |
<div class="free_plugin_inner">
|
60 |
<div class="paid_plugin_image">
|
61 |
-
<img style="width: 150px;height: auto;" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/trackship-logo.png">
|
62 |
</div>
|
63 |
<div class="paid_plugin_description">
|
64 |
<h3 class="plugin_title">TrackShip for WooCommerce</h3>
|
65 |
<p>Auto-Track all your shipments and provide a superior Post-Purchase Experience to your Customers</p>
|
66 |
<?php
|
67 |
-
if ( is_plugin_active('trackship-for-woocommerce/trackship-for-woocommerce.php' ) ) {
|
|
|
68 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
69 |
-
<?php } else{ ?>
|
70 |
-
<a href="https://wordpress.org/plugins/trackship-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php
|
71 |
<?php } ?>
|
72 |
</div>
|
73 |
</div>
|
@@ -75,16 +78,17 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
75 |
<div class="single_plugin as-col-4">
|
76 |
<div class="free_plugin_inner">
|
77 |
<div class="paid_plugin_image">
|
78 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/paypal-addon-banner.png">
|
79 |
</div>
|
80 |
<div class="paid_plugin_description">
|
81 |
<h3 class="plugin_title">PayPal Tracking for WooCommerce</h3>
|
82 |
<p>This add-on extends the Advanced shipment tracking plugin and will automatically send tracking numbers and associated information from WooCommerce to PayPal using the PayPal API.</p>
|
83 |
<?php
|
84 |
-
if ( is_plugin_active('paypal-tracking-add-on-for-ast/paypal-tracking-add-on-for-ast.php' ) ) {
|
|
|
85 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
86 |
-
<?php } else{ ?>
|
87 |
-
<a href="https://www.zorem.com/product/paypal-tracking-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php
|
88 |
<?php } ?>
|
89 |
</div>
|
90 |
</div>
|
@@ -92,16 +96,17 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
92 |
<div class="single_plugin as-col-4">
|
93 |
<div class="free_plugin_inner">
|
94 |
<div class="paid_plugin_image">
|
95 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/smswoo-icon.png">
|
96 |
</div>
|
97 |
<div class="paid_plugin_description">
|
98 |
<h3 class="plugin_title">SMSWOO - SMS for WooCommerce</h3>
|
99 |
<p>Keep your customers informed by sending them automated SMS text messages with order & delivery updates. You can send SMS notifications to customers when the order status is updated or when the shipment is out for delivery and more…</p>
|
100 |
<?php
|
101 |
-
if ( is_plugin_active('sms-for-woocommerce/sms-for-woocommerce.php' ) ) {
|
|
|
102 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
103 |
-
<?php } else{ ?>
|
104 |
-
<a href="https://www.zorem.com/product/sms-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php
|
105 |
<?php } ?>
|
106 |
</div>
|
107 |
</div>
|
@@ -109,16 +114,17 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
109 |
<div class="single_plugin as-col-4">
|
110 |
<div class="free_plugin_inner">
|
111 |
<div class="paid_plugin_image">
|
112 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/alp-icon.png">
|
113 |
</div>
|
114 |
<div class="paid_plugin_description">
|
115 |
<h3 class="plugin_title">Advanced Local Pickup Pro</h3>
|
116 |
<p>The Advanced Local Pickup (ALP) helps you manage the local pickup orders workflow more conveniently by extending the WooCommerce Local Pickup shipping method. The Pro you set up multiple pickup locations, , split the business hours, apply discounts by pickup location, display local pickup message on the products pages, allow customers to choose pickup location per product, force products to be local pickup only and more…</p>
|
117 |
<?php
|
118 |
-
if ( is_plugin_active('advanced-local-pickup-pro/advanced-local-pickup-pro.php' ) ) {
|
|
|
119 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
120 |
-
<?php } else{ ?>
|
121 |
-
<a href="https://www.zorem.com/product/advanced-local-pickup-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php
|
122 |
<?php } ?>
|
123 |
</div>
|
124 |
</div>
|
@@ -126,20 +132,21 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
126 |
<div class="single_plugin as-col-4">
|
127 |
<div class="free_plugin_inner">
|
128 |
<div class="paid_plugin_image">
|
129 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/cbr-icon.png">
|
130 |
</div>
|
131 |
<div class="paid_plugin_description">
|
132 |
<h3 class="plugin_title">Country Based Restrictions Pro</h3>
|
133 |
<p>The country-based restrictions plugin by zorem works by the WooCommerce Geolocation or the shipping country added by the customer and allows you to restrict products on your store to sell or not to sell to specific countries.</p>
|
134 |
<?php
|
135 |
-
if ( is_plugin_active('country-base-restrictions-pro-addon/country-base-restrictions-pro-addon.php' ) ) {
|
|
|
136 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
137 |
-
<?php } else{ ?>
|
138 |
-
<a href="https://www.zorem.com/product/country-based-restriction-pro/" class="button button-primary btn_ast2" target="blank"><?php
|
139 |
<?php } ?>
|
140 |
</div>
|
141 |
</div>
|
142 |
</div>
|
143 |
</div>
|
144 |
</div>
|
145 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for tools tab
|
4 |
*/
|
5 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
6 |
?>
|
21 |
} elseif ( class_exists( 'paypal_tracking_add_on' ) ) {
|
22 |
$show_addons_tab = true;
|
23 |
}
|
24 |
+
$addons = isset( $_GET['addons'] ) ? sanitize_text_field( $_GET['addons'] ) : 'addons';
|
25 |
+
?>
|
26 |
|
27 |
<?php do_action('ast_addon_license_form'); ?>
|
28 |
+
<?php if ( !class_exists( 'ast_pro' ) ) { ?>
|
29 |
<div class="section-content trackship_addon_section">
|
30 |
<div class="ast-row">
|
31 |
<div class="as-col-6">
|
34 |
<ul class="ast_pro_features_list">
|
35 |
<li>Premium Support</li>
|
36 |
<li>Tracking per item</li>
|
37 |
+
<li>Fully customizable responsive tracking widget</li>
|
38 |
<li>Custom order status "Shipped"</li>
|
39 |
+
<li>Custom email templates</li>
|
40 |
+
<li>PayPal tracking integration</li>
|
41 |
+
<li>Fulfillment dashboard</li>
|
42 |
<li>Auto-detect shipping providers</li>
|
43 |
+
<li>Tracking automation - Built-in integrations with ShipStation, Ordoro, WooCommerce Shipping and more..</li>
|
44 |
</ul>
|
45 |
<a href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/" class="button-primary btn_ast2 btn_large" target="_blank">UPGRADE NOW</a>
|
46 |
</div>
|
47 |
</div>
|
48 |
<div class="as-col-6">
|
49 |
<div class="ts_col_inner ast_ts_landing_banner">
|
50 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/ast-pro-banner.png">
|
51 |
</div>
|
52 |
</div>
|
53 |
</div>
|
54 |
</div>
|
55 |
<?php } ?>
|
56 |
|
57 |
+
<h1 class="tab_section_heading clear_spacing" style="margin: 20px 0 0;"><?php esc_html_e('Other Products by zorem', 'ast-pro'); ?></h1>
|
58 |
|
59 |
<div class="plugins_section free_plugin_section">
|
60 |
<div class="single_plugin as-col-4">
|
61 |
<div class="free_plugin_inner">
|
62 |
<div class="paid_plugin_image">
|
63 |
+
<img style="width: 150px;height: auto;" src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/trackship-logo.png">
|
64 |
</div>
|
65 |
<div class="paid_plugin_description">
|
66 |
<h3 class="plugin_title">TrackShip for WooCommerce</h3>
|
67 |
<p>Auto-Track all your shipments and provide a superior Post-Purchase Experience to your Customers</p>
|
68 |
<?php
|
69 |
+
if ( is_plugin_active('trackship-for-woocommerce/trackship-for-woocommerce.php' ) ) {
|
70 |
+
?>
|
71 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
72 |
+
<?php } else { ?>
|
73 |
+
<a href="https://wordpress.org/plugins/trackship-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php esc_html_e('More Info', 'ast-pro'); ?></a>
|
74 |
<?php } ?>
|
75 |
</div>
|
76 |
</div>
|
78 |
<div class="single_plugin as-col-4">
|
79 |
<div class="free_plugin_inner">
|
80 |
<div class="paid_plugin_image">
|
81 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/paypal-addon-banner.png">
|
82 |
</div>
|
83 |
<div class="paid_plugin_description">
|
84 |
<h3 class="plugin_title">PayPal Tracking for WooCommerce</h3>
|
85 |
<p>This add-on extends the Advanced shipment tracking plugin and will automatically send tracking numbers and associated information from WooCommerce to PayPal using the PayPal API.</p>
|
86 |
<?php
|
87 |
+
if ( is_plugin_active( 'paypal-tracking-add-on-for-ast/paypal-tracking-add-on-for-ast.php' ) ) {
|
88 |
+
?>
|
89 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
90 |
+
<?php } else { ?>
|
91 |
+
<a href="https://www.zorem.com/product/paypal-tracking-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php esc_html_e('More Info', 'ast-pro'); ?></a>
|
92 |
<?php } ?>
|
93 |
</div>
|
94 |
</div>
|
96 |
<div class="single_plugin as-col-4">
|
97 |
<div class="free_plugin_inner">
|
98 |
<div class="paid_plugin_image">
|
99 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/smswoo-icon.png">
|
100 |
</div>
|
101 |
<div class="paid_plugin_description">
|
102 |
<h3 class="plugin_title">SMSWOO - SMS for WooCommerce</h3>
|
103 |
<p>Keep your customers informed by sending them automated SMS text messages with order & delivery updates. You can send SMS notifications to customers when the order status is updated or when the shipment is out for delivery and more…</p>
|
104 |
<?php
|
105 |
+
if ( is_plugin_active('sms-for-woocommerce/sms-for-woocommerce.php' ) ) {
|
106 |
+
?>
|
107 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
108 |
+
<?php } else { ?>
|
109 |
+
<a href="https://www.zorem.com/product/sms-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php esc_html_e('More Info', 'ast-pro'); ?></a>
|
110 |
<?php } ?>
|
111 |
</div>
|
112 |
</div>
|
114 |
<div class="single_plugin as-col-4">
|
115 |
<div class="free_plugin_inner">
|
116 |
<div class="paid_plugin_image">
|
117 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/alp-icon.png">
|
118 |
</div>
|
119 |
<div class="paid_plugin_description">
|
120 |
<h3 class="plugin_title">Advanced Local Pickup Pro</h3>
|
121 |
<p>The Advanced Local Pickup (ALP) helps you manage the local pickup orders workflow more conveniently by extending the WooCommerce Local Pickup shipping method. The Pro you set up multiple pickup locations, , split the business hours, apply discounts by pickup location, display local pickup message on the products pages, allow customers to choose pickup location per product, force products to be local pickup only and more…</p>
|
122 |
<?php
|
123 |
+
if ( is_plugin_active('advanced-local-pickup-pro/advanced-local-pickup-pro.php' ) ) {
|
124 |
+
?>
|
125 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
126 |
+
<?php } else { ?>
|
127 |
+
<a href="https://www.zorem.com/product/advanced-local-pickup-for-woocommerce/" class="button button-primary btn_ast2" target="blank"><?php esc_html_e('More Info', 'ast-pro'); ?></a>
|
128 |
<?php } ?>
|
129 |
</div>
|
130 |
</div>
|
132 |
<div class="single_plugin as-col-4">
|
133 |
<div class="free_plugin_inner">
|
134 |
<div class="paid_plugin_image">
|
135 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/cbr-icon.png">
|
136 |
</div>
|
137 |
<div class="paid_plugin_description">
|
138 |
<h3 class="plugin_title">Country Based Restrictions Pro</h3>
|
139 |
<p>The country-based restrictions plugin by zorem works by the WooCommerce Geolocation or the shipping country added by the customer and allows you to restrict products on your store to sell or not to sell to specific countries.</p>
|
140 |
<?php
|
141 |
+
if ( is_plugin_active('country-base-restrictions-pro-addon/country-base-restrictions-pro-addon.php' ) ) {
|
142 |
+
?>
|
143 |
<button type="button" class="button button button-primary btn_green2">Active</button>
|
144 |
+
<?php } else { ?>
|
145 |
+
<a href="https://www.zorem.com/product/country-based-restriction-pro/" class="button button-primary btn_ast2" target="blank"><?php esc_html_e('More Info', 'ast-pro'); ?></a>
|
146 |
<?php } ?>
|
147 |
</div>
|
148 |
</div>
|
149 |
</div>
|
150 |
</div>
|
151 |
</div>
|
152 |
+
</section>
|
includes/views/admin_options_bulk_upload.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content4" class="tab_section">
|
@@ -8,12 +8,12 @@
|
|
8 |
<!-- progressbar -->
|
9 |
<section class="woocommerce-progress-form-wrapper" style="display:block;">
|
10 |
<div class="csv_heading_section">
|
11 |
-
<p><?php
|
12 |
</div>
|
13 |
<ol class="wc-progress-steps">
|
14 |
-
<li class="progress_step1 active"><?php
|
15 |
-
<li class="progress_step2"><?php
|
16 |
-
<li class="progress_step3"><?php
|
17 |
</ol>
|
18 |
<form method="post" id="wc_ast_upload_csv_form" action="" enctype="multipart/form-data" style="text-align:left;">
|
19 |
<div class="upload_csv_div">
|
@@ -22,7 +22,7 @@
|
|
22 |
<tbody>
|
23 |
<tr valign="top" class="border-bottom-1">
|
24 |
<th scope="row" class="">
|
25 |
-
<label for=""><?php
|
26 |
</th>
|
27 |
<td scope="row" class="input_file_cl">
|
28 |
<input type="file" name="trcking_csv_file" id="trcking_csv_file">
|
@@ -30,21 +30,21 @@
|
|
30 |
</tr>
|
31 |
<tr valign="top" class="border-bottom-1">
|
32 |
<th scope="row" class="">
|
33 |
-
<label for=""><?php
|
34 |
</th>
|
35 |
<td scope="row" class="">
|
36 |
-
<?php $date_format = get_option('date_format_for_csv_import','d-m-Y'); ?>
|
37 |
<label class="ast_radio_label" for="date_format_ddmmyy">
|
38 |
-
<input type="radio" <?php
|
39 |
</label>
|
40 |
<label class="ast_radio_label" for="date_format_mmddyy">
|
41 |
-
<input type="radio" <?php
|
42 |
</label>
|
43 |
</td>
|
44 |
</tr>
|
45 |
<tr valign="top" class="">
|
46 |
<th scope="row" class="">
|
47 |
-
<label for=""><?php
|
48 |
</th>
|
49 |
<td scope="row" class="">
|
50 |
<input type="checkbox" id="replace_tracking_info" name="replace_tracking_info" class="" value="1"/>
|
@@ -53,9 +53,9 @@
|
|
53 |
<tr valign="top" class="">
|
54 |
<td scope="row" class="button-column" colspan="2">
|
55 |
<div class="submit">
|
56 |
-
<button name="save" class="button-primary btn_ast2" type="submit" value="Save"><?php
|
57 |
<div class="spinner" style="float:none"></div>
|
58 |
-
<div class="success_msg" style="display:none;"><?php
|
59 |
<div class="error_msg" style="display:none;"></div>
|
60 |
<input type="hidden" name="action" value="wc_ast_upload_csv_form_update">
|
61 |
</div>
|
@@ -72,7 +72,7 @@
|
|
72 |
<tbody>
|
73 |
<tr valign="top" class="bulk_upload_status_heading_tr">
|
74 |
<td scope="row" class="input_file_cl bulk_upload_status_td" colspan="2">
|
75 |
-
<h2><?php
|
76 |
</td>
|
77 |
</tr>
|
78 |
<tr valign="top" class="bulk_upload_status_overview_tr">
|
@@ -83,7 +83,7 @@
|
|
83 |
<tr valign="top" class="bulk_upload_status_overview_tr">
|
84 |
<td scope="row" class="bulk_upload_status_overview_td csv_fail_msg" colspan="2">
|
85 |
<span></span>
|
86 |
-
<a href="javascript:void(0);" class="view_csv_error_details"><?php
|
87 |
</td>
|
88 |
</tr>
|
89 |
<tr valign="top" class="bulk_upload_status_detail_error_tr">
|
@@ -104,20 +104,20 @@
|
|
104 |
</tr>
|
105 |
<tr valign="top" class="bulk_upload_status_action" style="display:none;">
|
106 |
<td>
|
107 |
-
<a class="button-primary btn_ast2" href="<?php echo admin_url( 'edit.php?post_type=shop_order' ); ?>"><?php
|
108 |
-
<a href="javascript:void(0)" class="csv_upload_again button-primary btn_ast2"><?php
|
109 |
</td>
|
110 |
</tr>
|
111 |
</tbody>
|
112 |
</table>
|
113 |
</div>
|
114 |
</div>
|
115 |
-
<input type="hidden" id="nonce_csv_import" value="<?php esc_html_e( wp_create_nonce( 'nonce_csv_import' ) )
|
116 |
</form>
|
117 |
<ul class="bulk_upload_documentation_ul">
|
118 |
-
<li><span class="dashicons dashicons-download"></span><a class="" href="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>/assets/tracking.csv"><?php
|
119 |
-
<li><span class="dashicons dashicons-media-document"></span><a target="blank" href="https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/bulk-import-shipment-tracking/"><?php
|
120 |
</ul>
|
121 |
</section>
|
122 |
</div>
|
123 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for bulk upload tab
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content4" class="tab_section">
|
8 |
<!-- progressbar -->
|
9 |
<section class="woocommerce-progress-form-wrapper" style="display:block;">
|
10 |
<div class="csv_heading_section">
|
11 |
+
<p><?php esc_html_e('Use our CSV Import Tool to bulk Import tracking info to orders from a CSV file', 'woo-advanced-shipment-tracking'); ?></p>
|
12 |
</div>
|
13 |
<ol class="wc-progress-steps">
|
14 |
+
<li class="progress_step1 active"><?php esc_html_e('Upload CSV file', 'woocommerce'); ?></li>
|
15 |
+
<li class="progress_step2"><?php esc_html_e('Import', 'woocommerce'); ?></li>
|
16 |
+
<li class="progress_step3"><?php esc_html_e('Done!', 'woocommerce'); ?></li>
|
17 |
</ol>
|
18 |
<form method="post" id="wc_ast_upload_csv_form" action="" enctype="multipart/form-data" style="text-align:left;">
|
19 |
<div class="upload_csv_div">
|
22 |
<tbody>
|
23 |
<tr valign="top" class="border-bottom-1">
|
24 |
<th scope="row" class="">
|
25 |
+
<label for=""><?php esc_html_e('Upload a CSV file from your computer:', 'woo-advanced-shipment-tracking'); ?></label>
|
26 |
</th>
|
27 |
<td scope="row" class="input_file_cl">
|
28 |
<input type="file" name="trcking_csv_file" id="trcking_csv_file">
|
30 |
</tr>
|
31 |
<tr valign="top" class="border-bottom-1">
|
32 |
<th scope="row" class="">
|
33 |
+
<label for=""><?php esc_html_e('Choose the Shipped Date format', 'woo-advanced-shipment-tracking'); ?></label>
|
34 |
</th>
|
35 |
<td scope="row" class="">
|
36 |
+
<?php $date_format = get_option( 'date_format_for_csv_import', 'd-m-Y' ); ?>
|
37 |
<label class="ast_radio_label" for="date_format_ddmmyy">
|
38 |
+
<input type="radio" <?php esc_html_e( ( 'd-m-Y' == $date_format ) ? 'checked' : '' ); ?> id="date_format_ddmmyy" name="date_format_for_csv_import" class="" value="d-m-Y"/> dd/mm/YYYY
|
39 |
</label>
|
40 |
<label class="ast_radio_label" for="date_format_mmddyy">
|
41 |
+
<input type="radio" <?php esc_html_e( ( 'm-d-Y' == $date_format ) ? 'checked' : '' ); ?> id="date_format_mmddyy" name="date_format_for_csv_import" class="" value="m-d-Y"/> mm/dd/YYYY
|
42 |
</label>
|
43 |
</td>
|
44 |
</tr>
|
45 |
<tr valign="top" class="">
|
46 |
<th scope="row" class="">
|
47 |
+
<label for=""><?php esc_html_e('Replace tracking information?', 'woo-advanced-shipment-tracking'); ?><span class="woocommerce-help-tip tipTip" data-tip="<?php esc_html_e('Keep unchecked for the tracking info to be added to any existing tracking info added to the orders.', 'woo-advanced-shipment-tracking'); ?>"></span></label>
|
48 |
</th>
|
49 |
<td scope="row" class="">
|
50 |
<input type="checkbox" id="replace_tracking_info" name="replace_tracking_info" class="" value="1"/>
|
53 |
<tr valign="top" class="">
|
54 |
<td scope="row" class="button-column" colspan="2">
|
55 |
<div class="submit">
|
56 |
+
<button name="save" class="button-primary btn_ast2" type="submit" value="Save"><?php esc_html_e('Continue', 'woo-advanced-shipment-tracking'); ?></button>
|
57 |
<div class="spinner" style="float:none"></div>
|
58 |
+
<div class="success_msg" style="display:none;"><?php esc_html_e('Settings Saved.', 'woo-advanced-shipment-tracking'); ?></div>
|
59 |
<div class="error_msg" style="display:none;"></div>
|
60 |
<input type="hidden" name="action" value="wc_ast_upload_csv_form_update">
|
61 |
</div>
|
72 |
<tbody>
|
73 |
<tr valign="top" class="bulk_upload_status_heading_tr">
|
74 |
<td scope="row" class="input_file_cl bulk_upload_status_td" colspan="2">
|
75 |
+
<h2><?php esc_html_e('Import in Progress', 'woo-advanced-shipment-tracking'); ?><span class="spinner is-active"></span></h2>
|
76 |
</td>
|
77 |
</tr>
|
78 |
<tr valign="top" class="bulk_upload_status_overview_tr">
|
83 |
<tr valign="top" class="bulk_upload_status_overview_tr">
|
84 |
<td scope="row" class="bulk_upload_status_overview_td csv_fail_msg" colspan="2">
|
85 |
<span></span>
|
86 |
+
<a href="javascript:void(0);" class="view_csv_error_details"><?php esc_html_e('view details', 'woo-advanced-shipment-tracking'); ?></a>
|
87 |
</td>
|
88 |
</tr>
|
89 |
<tr valign="top" class="bulk_upload_status_detail_error_tr">
|
104 |
</tr>
|
105 |
<tr valign="top" class="bulk_upload_status_action" style="display:none;">
|
106 |
<td>
|
107 |
+
<a class="button-primary btn_ast2" href="<?php echo esc_url( admin_url( 'edit.php?post_type=shop_order' ) ); ?>"><?php esc_html_e('View Orders', 'woo-advanced-shipment-tracking'); ?></a>
|
108 |
+
<a href="javascript:void(0)" class="csv_upload_again button-primary btn_ast2"><?php esc_html_e('Upload again', 'woo-advanced-shipment-tracking'); ?></a>
|
109 |
</td>
|
110 |
</tr>
|
111 |
</tbody>
|
112 |
</table>
|
113 |
</div>
|
114 |
</div>
|
115 |
+
<input type="hidden" id="nonce_csv_import" value="<?php esc_html_e( wp_create_nonce( 'nonce_csv_import' ) ); ?>">
|
116 |
</form>
|
117 |
<ul class="bulk_upload_documentation_ul">
|
118 |
+
<li><span class="dashicons dashicons-download"></span><a class="" href="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>/assets/tracking.csv"><?php esc_html_e('Download sample csv', 'woo-advanced-shipment-tracking'); ?></a></li>
|
119 |
+
<li><span class="dashicons dashicons-media-document"></span><a target="blank" href="https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/bulk-import-shipment-tracking/"><?php esc_html_e('How to import tracking number from CSV files?', 'woo-advanced-shipment-tracking'); ?></a></li>
|
120 |
</ul>
|
121 |
</section>
|
122 |
</div>
|
123 |
+
</section>
|
includes/views/admin_options_osm.php
CHANGED
@@ -4,38 +4,40 @@
|
|
4 |
<tr valign="top">
|
5 |
<td class="forminp">
|
6 |
<input type="hidden" name="wc_ast_status_shipped" value="0"/>
|
7 |
-
<input class="ast-tgl ast-tgl-flat" id="wc_ast_status_shipped" name="wc_ast_status_shipped" type="checkbox" <?php
|
8 |
<label class="ast-tgl-btn" for="wc_ast_status_shipped"></label>
|
9 |
</td>
|
10 |
<td colspan="2" class="status_shipped_label">
|
11 |
-
<?php
|
12 |
</td>
|
13 |
</tr>
|
14 |
|
15 |
-
<?php
|
16 |
-
|
|
|
17 |
$checked = ( get_option( $data['id'] ) ) ? 'checked' : '';
|
18 |
$disable_row = ( !get_option( $data['id'] ) ) ? 'disable_row' : '';
|
19 |
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped' );
|
20 |
-
if( $wc_ast_status_shipped &&
|
21 |
$checked = '';
|
22 |
$disable_row = 'disable_row';
|
23 |
}
|
24 |
?>
|
25 |
-
<tr valign="top" class="<?php echo $
|
26 |
<td class="forminp">
|
27 |
-
<input type="hidden" name="<?php echo $data['id']
|
28 |
-
<input class="ast-tgl ast-tgl-flat order_status_toggle" id="<?php echo $data['id']
|
29 |
-
<label class="ast-tgl-btn" for="<?php echo $data['id']
|
30 |
</td>
|
31 |
<td class="forminp status-label-column">
|
32 |
-
<span class="order-label <?php echo $data['label_class']
|
33 |
<?php
|
34 |
if ( get_option( $data['id'] ) ) {
|
35 |
-
|
36 |
-
} else{
|
37 |
-
echo $data['label'];
|
38 |
-
}
|
|
|
39 |
</span>
|
40 |
</td>
|
41 |
<td class="forminp">
|
@@ -44,30 +46,32 @@
|
|
44 |
|
45 |
$checked = '';
|
46 |
|
47 |
-
if(isset( $ast_enable_email['enabled'] )){
|
48 |
-
if( $ast_enable_email['enabled']
|
49 |
$checked = 'checked';
|
50 |
}
|
51 |
}
|
52 |
|
53 |
?>
|
54 |
<fieldset>
|
55 |
-
<input class="input-text regular-input color_input" type="text" name="<?php echo $data['label_color_field']; ?>" id="<?php echo $data['label_color_field']; ?>" style="" value="<?php
|
56 |
-
<select class="select custom_order_color_select" id="<?php echo $data['font_color_field']; ?>" name="<?php echo $data['font_color_field']; ?>">
|
57 |
-
<option value="#fff" <?php
|
58 |
-
<option value="#000" <?php
|
59 |
</select>
|
60 |
<label class="send_email_label">
|
61 |
-
<input type="hidden" name="<?php echo $data['email_field']; ?>" value="0"/>
|
62 |
-
<input type="checkbox" name="<?php echo $data['email_field']; ?>" id="<?php echo $data['email_field']; ?>"class="enable_order_status_email_input" <?php
|
63 |
-
<a class='settings_edit' href="<?php echo $data['edit_email']; ?>"><?php
|
64 |
</fieldset>
|
65 |
</td>
|
66 |
</tr>
|
67 |
-
<?php
|
68 |
-
|
|
|
|
|
69 |
</tbody>
|
70 |
</table>
|
71 |
-
<?php wp_nonce_field( 'wc_ast_order_status_form', 'wc_ast_order_status_form_nonce' )
|
72 |
<input type="hidden" name="action" value="wc_ast_custom_order_status_form_update">
|
73 |
-
</div>
|
4 |
<tr valign="top">
|
5 |
<td class="forminp">
|
6 |
<input type="hidden" name="wc_ast_status_shipped" value="0"/>
|
7 |
+
<input class="ast-tgl ast-tgl-flat" id="wc_ast_status_shipped" name="wc_ast_status_shipped" type="checkbox" <?php ( get_option( 'wc_ast_status_shipped', 1 ) ) ? esc_html_e( 'checked' ) : ''; ?> value="1"/>
|
8 |
<label class="ast-tgl-btn" for="wc_ast_status_shipped"></label>
|
9 |
</td>
|
10 |
<td colspan="2" class="status_shipped_label">
|
11 |
+
<?php esc_html_e( 'Rename the “Completed” Order status label to “Shipped”', 'woo-advanced-shipment-tracking' ); ?>
|
12 |
</td>
|
13 |
</tr>
|
14 |
|
15 |
+
<?php
|
16 |
+
$osm_data = $this->get_osm_data();
|
17 |
+
foreach ( $osm_data as $o_status => $data ) {
|
18 |
$checked = ( get_option( $data['id'] ) ) ? 'checked' : '';
|
19 |
$disable_row = ( !get_option( $data['id'] ) ) ? 'disable_row' : '';
|
20 |
$wc_ast_status_shipped = get_option( 'wc_ast_status_shipped' );
|
21 |
+
if ( $wc_ast_status_shipped && 'shipped' == $o_status ) {
|
22 |
$checked = '';
|
23 |
$disable_row = 'disable_row';
|
24 |
}
|
25 |
?>
|
26 |
+
<tr valign="top" class="<?php echo esc_html( $o_status ); ?>_row <?php echo esc_html( $disable_row ); ?>">
|
27 |
<td class="forminp">
|
28 |
+
<input type="hidden" name="<?php echo esc_html( $data['id'] ); ?>" value="0"/>
|
29 |
+
<input class="ast-tgl ast-tgl-flat order_status_toggle" id="<?php echo esc_html( $data['id'] ); ?>" name="<?php echo esc_html( $data['id'] ); ?>" type="checkbox" value="1" <?php echo esc_html( $checked ); ?> />
|
30 |
+
<label class="ast-tgl-btn" for="<?php echo esc_html( $data['id'] ); ?>"></label>
|
31 |
</td>
|
32 |
<td class="forminp status-label-column">
|
33 |
+
<span class="order-label <?php echo esc_html( $data['label_class'] ); ?>">
|
34 |
<?php
|
35 |
if ( get_option( $data['id'] ) ) {
|
36 |
+
esc_html_e( wc_get_order_status_name( $data['slug'] ), 'woo-advanced-shipment-tracking' );
|
37 |
+
} else {
|
38 |
+
echo esc_html( $data['label'] );
|
39 |
+
}
|
40 |
+
?>
|
41 |
</span>
|
42 |
</td>
|
43 |
<td class="forminp">
|
46 |
|
47 |
$checked = '';
|
48 |
|
49 |
+
if ( isset( $ast_enable_email['enabled'] ) ) {
|
50 |
+
if ( 'yes' == $ast_enable_email['enabled'] || 1 == $ast_enable_email['enabled'] ) {
|
51 |
$checked = 'checked';
|
52 |
}
|
53 |
}
|
54 |
|
55 |
?>
|
56 |
<fieldset>
|
57 |
+
<input class="input-text regular-input color_input" type="text" name="<?php echo esc_html( $data['label_color_field'] ); ?>" id="<?php echo esc_html( $data['label_color_field'] ); ?>" style="" value="<?php esc_html_e( get_option( $data['label_color_field'], '#1e73be' ) ); ?>" placeholder="">
|
58 |
+
<select class="select custom_order_color_select" id="<?php echo esc_html( $data['font_color_field'] ); ?>" name="<?php echo esc_html( $data['font_color_field'] ); ?>">
|
59 |
+
<option value="#fff" <?php ( '#fff' == get_option( $data['font_color_field'], '#fff' ) ) ? esc_html_e( 'selected' ) : ''; ?>><?php esc_html_e( 'Light Font', 'woo-advanced-shipment-tracking' ); ?></option>
|
60 |
+
<option value="#000" <?php ( '#000' == get_option( $data['font_color_field'], '#fff' ) ) ? esc_html_e( 'selected' ) : ''; ?>><?php esc_html_e( 'Dark Font', 'woo-advanced-shipment-tracking' ); ?></option>
|
61 |
</select>
|
62 |
<label class="send_email_label">
|
63 |
+
<input type="hidden" name="<?php echo esc_html( $data['email_field'] ); ?>" value="0"/>
|
64 |
+
<input type="checkbox" name="<?php echo esc_html( $data['email_field'] ); ?>" id="<?php echo esc_html( $data['email_field'] ); ?>"class="enable_order_status_email_input" <?php esc_html_e( $checked ); ?> value="1"><?php esc_html_e( 'Send Email', 'woo-advanced-shipment-tracking' ); ?></label>
|
65 |
+
<a class='settings_edit' href="<?php echo esc_html( $data['edit_email'] ); ?>"><?php esc_html_e( 'edit email', 'woocommerce' ); ?></a>
|
66 |
</fieldset>
|
67 |
</td>
|
68 |
</tr>
|
69 |
+
<?php
|
70 |
+
}
|
71 |
+
do_action('ast_orders_status_column_end');
|
72 |
+
?>
|
73 |
</tbody>
|
74 |
</table>
|
75 |
+
<?php wp_nonce_field( 'wc_ast_order_status_form', 'wc_ast_order_status_form_nonce' ); ?>
|
76 |
<input type="hidden" name="action" value="wc_ast_custom_order_status_form_update">
|
77 |
+
</div>
|
includes/views/admin_options_settings.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content2" class="tab_section">
|
7 |
<form method="post" id="wc_ast_settings_form" action="" enctype="multipart/form-data">
|
8 |
|
9 |
-
<h1 class="tab_page_heading"><?php
|
10 |
|
11 |
-
<h2 class="tab_section_heading botton_border"><?php
|
12 |
-
<?php $this->get_html_ul( $this->get_add_tracking_options() )
|
13 |
|
14 |
<div class="tabs_inner_section">
|
15 |
-
<h1 class="tab_section_heading botton_border"><?php
|
16 |
-
<?php $this->get_html_ul( $this->get_customer_view_options() )
|
17 |
</div>
|
18 |
|
19 |
<div class="tabs_inner_section">
|
20 |
-
<h2 class="tab_section_heading botton_border"><?php
|
21 |
-
<?php $this->get_html_ul( $this->get_shipment_tracking_api_options() )
|
22 |
</div>
|
23 |
|
24 |
<div class="tabs_inner_section">
|
25 |
-
<h2 class="tab_section_heading botton_border"><?php
|
26 |
<?php require_once( 'admin_options_osm.php' ); ?>
|
27 |
</div>
|
28 |
|
29 |
-
<?php wp_nonce_field( 'wc_ast_settings_form', 'wc_ast_settings_form_nonce' )
|
30 |
<input type="hidden" name="action" value="wc_ast_settings_form_update">
|
31 |
</form>
|
32 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for settings tab
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content2" class="tab_section">
|
7 |
<form method="post" id="wc_ast_settings_form" action="" enctype="multipart/form-data">
|
8 |
|
9 |
+
<h1 class="tab_page_heading"><?php esc_html_e( 'Settings', 'woo-advanced-shipment-tracking'); ?></h1>
|
10 |
|
11 |
+
<h2 class="tab_section_heading botton_border"><?php esc_html_e( 'Add Tracking Options', 'woo-advanced-shipment-tracking'); ?></h2>
|
12 |
+
<?php $this->get_html_ul( $this->get_add_tracking_options() ); ?>
|
13 |
|
14 |
<div class="tabs_inner_section">
|
15 |
+
<h1 class="tab_section_heading botton_border"><?php esc_html_e( 'Customer View', 'woo-advanced-shipment-tracking'); ?></h1>
|
16 |
+
<?php $this->get_html_ul( $this->get_customer_view_options() ); ?>
|
17 |
</div>
|
18 |
|
19 |
<div class="tabs_inner_section">
|
20 |
+
<h2 class="tab_section_heading botton_border"><?php esc_html_e( 'Shipment Tracking API', 'woo-advanced-shipment-tracking'); ?></h2>
|
21 |
+
<?php $this->get_html_ul( $this->get_shipment_tracking_api_options() ); ?>
|
22 |
</div>
|
23 |
|
24 |
<div class="tabs_inner_section">
|
25 |
+
<h2 class="tab_section_heading botton_border"><?php esc_html_e( 'Custom Order Statuses', 'woo-advanced-shipment-tracking'); ?></h2>
|
26 |
<?php require_once( 'admin_options_osm.php' ); ?>
|
27 |
</div>
|
28 |
|
29 |
+
<?php wp_nonce_field( 'wc_ast_settings_form', 'wc_ast_settings_form_nonce' ); ?>
|
30 |
<input type="hidden" name="action" value="wc_ast_settings_form_update">
|
31 |
</form>
|
32 |
+
</section>
|
includes/views/admin_options_shipping_provider.php
CHANGED
@@ -1,95 +1,100 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
-
|
6 |
-
|
|
|
7 |
$upload_dir = wp_upload_dir();
|
8 |
$ast_directory = $upload_dir['baseurl'] . '/ast-shipping-providers/';
|
9 |
-
|
|
|
|
|
10 |
<script>
|
11 |
jQuery( document ).ready(function() {
|
12 |
jQuery('.sync_provider_popup').show();
|
13 |
});
|
14 |
</script>
|
15 |
-
<?php }
|
16 |
-
?>
|
17 |
<section id="content1" class="tab_section">
|
18 |
<div class="provider_top">
|
19 |
|
20 |
<div class="search_section">
|
21 |
-
<h1 class="tab_section_heading"><?php
|
22 |
<span class="dashicons dashicons-search search-icon"></span>
|
23 |
-
<input class="provider_search_bar
|
24 |
</div>
|
25 |
|
26 |
<div class="provider_settings">
|
27 |
-
<a href="javaScript:void(0);" class="provider_settings_icon
|
28 |
<a href="javaScript:void(0);" class="sync_providers provider_settings_icon"><span class="dashicons dashicons-update"></span></a>
|
29 |
<input class="ast-tgl ast-tgl-flat" id="reset_providers" name="reset_providers" type="checkbox" value="1"/>
|
30 |
<label class="ast-tgl-btn" for="reset_providers"></label>
|
31 |
</div>
|
32 |
</div>
|
33 |
<div class="provider_list">
|
34 |
-
<?php
|
35 |
-
|
36 |
-
|
|
|
|
|
37 |
</div>
|
38 |
|
39 |
-
<input type="hidden" id="nonce_shipping_provider" value="<?php esc_html_e( wp_create_nonce( 'nonce_shipping_provider' ) )
|
40 |
|
41 |
<div id="" class="popupwrapper edit_provider_popup" style="display:none;">
|
42 |
<div class="popuprow">
|
43 |
<div class="popup_header">
|
44 |
-
<h3 class="popup_title"><?php
|
45 |
<span class="dashicons dashicons-no-alt popup_close_icon"></span>
|
46 |
</div>
|
47 |
<div class="popup_body">
|
48 |
<form id="edit_provider_form" method="POST" class="edit_provider_form">
|
49 |
<div class="form-field form-50">
|
50 |
-
<label><?php
|
51 |
-
<input type="text" name="shipping_provider" class="shipping_provider" value="" placeholder="<?php
|
52 |
</div>
|
53 |
<div class="form-field form-50 margin-0">
|
54 |
-
<label><?php
|
55 |
-
<input type="text" name="shipping_display_name" class="shipping_display_name" value="" placeholder="<?php
|
56 |
</div>
|
57 |
<div class="form-field api_provider_name_container">
|
58 |
-
<label><?php
|
59 |
<div class="api_provider_div">
|
60 |
-
<input type="text" name="api_provider_name[]" class="api_provider_name" value="" placeholder="<?php
|
61 |
<?php do_action('add_more_api_provider'); ?>
|
62 |
</div>
|
63 |
</div>
|
64 |
<div class="form-field form-50">
|
65 |
-
<label><?php
|
66 |
<select class="select wcast_shipping_country shipping_country" name="shipping_country">
|
67 |
-
<option value=""><?php
|
68 |
-
<option value="Global"><?php
|
69 |
-
<?php foreach($countries as $key=>$val){ ?>
|
70 |
-
<option value="<?php
|
71 |
<?php } ?>
|
72 |
</select>
|
73 |
</div>
|
74 |
-
<!--div class="form-field form-50 margin-0">
|
75 |
-
<label><?php _e( 'Logo image', 'woo-advanced-shipment-tracking' ); ?></label>
|
76 |
-
<input type='text' placeholder='Image' name='thumb_url' class='image_path thumb_url' value=''>
|
77 |
-
<input type='hidden' name='thumb_id' class='image_id thumb_id' placeholder="Image" value=''>
|
78 |
-
<input type="button" class="button upload_image_button" value="<?php _e( 'Upload' , 'woo-advanced-shipment-tracking'); ?>" />
|
79 |
-
</div-->
|
80 |
<div class="form-field">
|
81 |
-
<label><?php
|
82 |
<input type="text" name="tracking_url" class="tracking_url" placeholder="Tracking URL">
|
83 |
</div>
|
84 |
<div class="form-field custom_provider_instruction">
|
85 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
</div>
|
87 |
<input type="hidden" name="action" value="update_custom_shipment_provider">
|
88 |
-
<input type="hidden" id="nonce_edit_shipping_provider" name="nonce_edit_shipping_provider" value="<?php esc_html_e( wp_create_nonce( 'nonce_edit_shipping_provider' ) )
|
89 |
<input type="hidden" name="provider_type" id="provider_type" value="">
|
90 |
<input type="hidden" name="provider_id" id="provider_id" value="">
|
91 |
-
<input type="submit" name="Submit" value="<?php
|
92 |
-
<a href="javascript:void(0);" class="reset_default_provider"><?php
|
93 |
</form>
|
94 |
</div>
|
95 |
</div>
|
@@ -99,25 +104,25 @@ if(isset($_GET['open']) && $_GET['open'] == 'synch_providers'){ ?>
|
|
99 |
<div id="" class="popupwrapper sync_provider_popup" style="display:none;">
|
100 |
<div class="popuprow">
|
101 |
<div class="popup_header">
|
102 |
-
<h3 class="popup_title"><?php
|
103 |
<span class="dashicons dashicons-no-alt popup_close_icon"></span>
|
104 |
</div>
|
105 |
<div class="popup_body">
|
106 |
-
<p class="sync_message"><?php
|
107 |
<ul class="synch_result">
|
108 |
-
<li class="providers_added"><?php
|
109 |
-
<li class="providers_updated"><?php
|
110 |
-
<li class="providers_deleted"><?php
|
111 |
</ul>
|
112 |
-
<p class="reset_db_message" style="display:none;"><?php
|
113 |
<fieldset class="reset_db_fieldset">
|
114 |
-
<label><input type="checkbox" id="reset_tracking_providers" name="reset_tracking_providers" value="1"><?php
|
115 |
</fieldset>
|
116 |
-
<button class="sync_providers_btn button-primary btn_ast2"><?php
|
117 |
-
<button class="close_synch_popup button-primary btn_ast2"><?php
|
118 |
<div class="spinner" style=""></div>
|
119 |
</div>
|
120 |
</div>
|
121 |
<div class="popupclose"></div>
|
122 |
</div>
|
123 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for shipping providers tab
|
4 |
*/
|
5 |
+
|
6 |
+
$wc_ast_api_key = get_option('wc_ast_api_key');
|
7 |
+
|
8 |
$upload_dir = wp_upload_dir();
|
9 |
$ast_directory = $upload_dir['baseurl'] . '/ast-shipping-providers/';
|
10 |
+
|
11 |
+
if ( isset( $_GET['open'] ) && 'synch_providers' == $_GET['open'] ) {
|
12 |
+
?>
|
13 |
<script>
|
14 |
jQuery( document ).ready(function() {
|
15 |
jQuery('.sync_provider_popup').show();
|
16 |
});
|
17 |
</script>
|
18 |
+
<?php } ?>
|
|
|
19 |
<section id="content1" class="tab_section">
|
20 |
<div class="provider_top">
|
21 |
|
22 |
<div class="search_section">
|
23 |
+
<h1 class="tab_section_heading"><?php esc_html_e( 'Shipping Providers', 'woo-advanced-shipment-tracking'); ?></h1>
|
24 |
<span class="dashicons dashicons-search search-icon"></span>
|
25 |
+
<input class="provider_search_bar" type="text" name="search_provider" id="search_provider" placeholder="<?php esc_html_e( 'Search by provider / country', 'woo-advanced-shipment-tracking'); ?>">
|
26 |
</div>
|
27 |
|
28 |
<div class="provider_settings">
|
29 |
+
<a href="javaScript:void(0);" class="provider_settings_icon upgrade_to_ast_pro"><span class="dashicons dashicons-plus-alt"></span></a>
|
30 |
<a href="javaScript:void(0);" class="sync_providers provider_settings_icon"><span class="dashicons dashicons-update"></span></a>
|
31 |
<input class="ast-tgl ast-tgl-flat" id="reset_providers" name="reset_providers" type="checkbox" value="1"/>
|
32 |
<label class="ast-tgl-btn" for="reset_providers"></label>
|
33 |
</div>
|
34 |
</div>
|
35 |
<div class="provider_list">
|
36 |
+
<?php
|
37 |
+
if ( $default_shippment_providers ) {
|
38 |
+
echo wp_kses_post( $this->get_provider_html( $default_shippment_providers, 'all' ) );
|
39 |
+
}
|
40 |
+
?>
|
41 |
</div>
|
42 |
|
43 |
+
<input type="hidden" id="nonce_shipping_provider" value="<?php esc_html_e( wp_create_nonce( 'nonce_shipping_provider' ) ); ?>">
|
44 |
|
45 |
<div id="" class="popupwrapper edit_provider_popup" style="display:none;">
|
46 |
<div class="popuprow">
|
47 |
<div class="popup_header">
|
48 |
+
<h3 class="popup_title"><?php esc_html_e( 'Edit Shipping Provider', 'woo-advanced-shipment-tracking'); ?></h2> - <h3 class="popup_title edit_provider_title"></h2>
|
49 |
<span class="dashicons dashicons-no-alt popup_close_icon"></span>
|
50 |
</div>
|
51 |
<div class="popup_body">
|
52 |
<form id="edit_provider_form" method="POST" class="edit_provider_form">
|
53 |
<div class="form-field form-50">
|
54 |
+
<label><?php esc_html_e( 'Provider Name', 'woo-advanced-shipment-tracking' ); ?></label>
|
55 |
+
<input type="text" name="shipping_provider" class="shipping_provider" value="" placeholder="<?php esc_html_e( 'Shipping Provider', 'woo-advanced-shipment-tracking' ); ?>">
|
56 |
</div>
|
57 |
<div class="form-field form-50 margin-0">
|
58 |
+
<label><?php esc_html_e( 'Custom display name', 'woo-advanced-shipment-tracking' ); ?> <span class="woocommerce-help-tip tipTip" data-tip="<?php esc_html_e( "The custom display name will show in the tracking info section on the customer order emails, my-account, and TrackShip's tracking page and email notifications", 'woo-advanced-shipment-tracking' ); ?>"></span> </label>
|
59 |
+
<input type="text" name="shipping_display_name" class="shipping_display_name" value="" placeholder="<?php esc_html_e( 'White Label Provider Name', 'woo-advanced-shipment-tracking' ); ?>">
|
60 |
</div>
|
61 |
<div class="form-field api_provider_name_container">
|
62 |
+
<label><?php esc_html_e( 'Custom API name', 'woo-advanced-shipment-tracking' ); ?> <span class="woocommerce-help-tip tipTip" data-tip="<?php esc_html_e( 'Add API name aliases to map Shipping providers names with the provider names that are updated in the shipment tracking API by external shipping services', 'woo-advanced-shipment-tracking' ); ?>"></span></label>
|
63 |
<div class="api_provider_div">
|
64 |
+
<input type="text" name="api_provider_name[]" class="api_provider_name" value="" placeholder="<?php esc_html_e( 'API Name', 'woo-advanced-shipment-tracking' ); ?>">
|
65 |
<?php do_action('add_more_api_provider'); ?>
|
66 |
</div>
|
67 |
</div>
|
68 |
<div class="form-field form-50">
|
69 |
+
<label><?php esc_html_e( 'Country', 'woo-advanced-shipment-tracking' ); ?></label>
|
70 |
<select class="select wcast_shipping_country shipping_country" name="shipping_country">
|
71 |
+
<option value=""><?php esc_html_e( 'Shipping Country', 'woo-advanced-shipment-tracking' ); ?></option>
|
72 |
+
<option value="Global"><?php esc_html_e( 'Global', 'woo-advanced-shipment-tracking' ); ?></option>
|
73 |
+
<?php foreach ( $countries as $key=>$val ) { ?>
|
74 |
+
<option value="<?php esc_html_e( $key ); ?>" ><?php esc_html_e( $val, 'woo-advanced-shipment-tracking'); ?></option>
|
75 |
<?php } ?>
|
76 |
</select>
|
77 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<div class="form-field">
|
79 |
+
<label><?php esc_html_e( 'Custom URL', 'woo-advanced-shipment-tracking' ); ?></label>
|
80 |
<input type="text" name="tracking_url" class="tracking_url" placeholder="Tracking URL">
|
81 |
</div>
|
82 |
<div class="form-field custom_provider_instruction">
|
83 |
+
<p>
|
84 |
+
<?php
|
85 |
+
/* translators: %s: search WooCommerce plugin link */
|
86 |
+
esc_html_e( 'You can use the variables %number%, %postal_code% and %country_code% in the URL, for more info, check our ', 'woo-advanced-shipment-tracking' );
|
87 |
+
/* translators: %s: search WooCommerce plugin link */
|
88 |
+
echo sprintf(__('<a href="%s" target="blank">documentation</a>', 'woo-advanced-shipment-tracking'), 'http://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/setting-shipping-providers/#adding-custom-shipping-provider');
|
89 |
+
?>
|
90 |
+
</p>
|
91 |
</div>
|
92 |
<input type="hidden" name="action" value="update_custom_shipment_provider">
|
93 |
+
<input type="hidden" id="nonce_edit_shipping_provider" name="nonce_edit_shipping_provider" value="<?php esc_html_e( wp_create_nonce( 'nonce_edit_shipping_provider' ) ); ?>">
|
94 |
<input type="hidden" name="provider_type" id="provider_type" value="">
|
95 |
<input type="hidden" name="provider_id" id="provider_id" value="">
|
96 |
+
<input type="submit" name="Submit" value="<?php esc_html_e( 'Update' , 'woo-advanced-shipment-tracking'); ?>" class="button-primary btn_ast2">
|
97 |
+
<a href="javascript:void(0);" class="reset_default_provider"><?php esc_html_e( 'Reset' , 'woo-advanced-shipment-tracking'); ?></a>
|
98 |
</form>
|
99 |
</div>
|
100 |
</div>
|
104 |
<div id="" class="popupwrapper sync_provider_popup" style="display:none;">
|
105 |
<div class="popuprow">
|
106 |
<div class="popup_header">
|
107 |
+
<h3 class="popup_title"><?php esc_html_e( 'Sync Shipping Providers', 'woo-advanced-shipment-tracking'); ?></h2>
|
108 |
<span class="dashicons dashicons-no-alt popup_close_icon"></span>
|
109 |
</div>
|
110 |
<div class="popup_body">
|
111 |
+
<p class="sync_message"><?php esc_html_e( 'Syncing the shipping providers list add or updates the pre-set shipping providers and will not effect custom shipping providers.', 'woo-advanced-shipment-tracking'); ?></p>
|
112 |
<ul class="synch_result">
|
113 |
+
<li class="providers_added"><?php esc_html_e( 'Providers Added', 'woo-advanced-shipment-tracking'); ?> - <span></span></li>
|
114 |
+
<li class="providers_updated"><?php esc_html_e( 'Providers Updated', 'woo-advanced-shipment-tracking'); ?> - <span></span></li>
|
115 |
+
<li class="providers_deleted"><?php esc_html_e( 'Providers Deleted', 'woo-advanced-shipment-tracking'); ?> - <span></span></li>
|
116 |
</ul>
|
117 |
+
<p class="reset_db_message" style="display:none;"><?php esc_html_e( 'Shipping providers database reset successfully.', 'woo-advanced-shipment-tracking'); ?></p>
|
118 |
<fieldset class="reset_db_fieldset">
|
119 |
+
<label><input type="checkbox" id="reset_tracking_providers" name="reset_tracking_providers" value="1"><?php esc_html_e( 'Reset providers database, it will reset all your shipping provider database', 'woo-advanced-shipment-tracking'); ?></label>
|
120 |
</fieldset>
|
121 |
+
<button class="sync_providers_btn button-primary btn_ast2"><?php esc_html_e( 'Sync Shipping Providers', 'woo-advanced-shipment-tracking'); ?></button>
|
122 |
+
<button class="close_synch_popup button-primary btn_ast2"><?php esc_html_e( 'Close', 'woocommerce'); ?></button>
|
123 |
<div class="spinner" style=""></div>
|
124 |
</div>
|
125 |
</div>
|
126 |
<div class="popupclose"></div>
|
127 |
</div>
|
128 |
+
</section>
|
includes/views/admin_options_tools.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content_tools" class="inner_tab_section">
|
7 |
<div class="tab_inner_container">
|
8 |
<div class="d_table" style="">
|
9 |
<div class="trackship-notice bulk_shipment_status_success" style="display:none;">
|
10 |
-
<p><?php
|
11 |
</div>
|
12 |
<div class="outer_form_table get_shipment_status_tool">
|
13 |
<table class="form-table heading-table">
|
14 |
<tbody>
|
15 |
<tr valign="top">
|
16 |
<td>
|
17 |
-
<h3 style=""><?php
|
18 |
-
<p class="get_shipment_status_tool_description"><?php
|
19 |
</td>
|
20 |
</tr>
|
21 |
</tbody>
|
@@ -24,8 +24,9 @@
|
|
24 |
<?php
|
25 |
$trackship = WC_Advanced_Shipment_Tracking_Trackship::get_instance();
|
26 |
$admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
27 |
-
$admin->get_html( $trackship->get_trackship_bulk_actions_data() );
|
|
|
28 |
</div>
|
29 |
</div>
|
30 |
</div>
|
31 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for tools tab
|
4 |
*/
|
5 |
?>
|
6 |
<section id="content_tools" class="inner_tab_section">
|
7 |
<div class="tab_inner_container">
|
8 |
<div class="d_table" style="">
|
9 |
<div class="trackship-notice bulk_shipment_status_success" style="display:none;">
|
10 |
+
<p><?php esc_html_e('Tracking info sent to Trackship for all Orders.', 'woo-advanced-shipment-tracking'); ?></p>
|
11 |
</div>
|
12 |
<div class="outer_form_table get_shipment_status_tool">
|
13 |
<table class="form-table heading-table">
|
14 |
<tbody>
|
15 |
<tr valign="top">
|
16 |
<td>
|
17 |
+
<h3 style=""><?php esc_html_e( 'Tools', 'woo-advanced-shipment-tracking' ); ?></h3>
|
18 |
+
<p class="get_shipment_status_tool_description"><?php esc_html_e( 'You can send all your orders from the last 30 days to get shipment status from TrackShip:', 'woo-advanced-shipment-tracking' ); ?></p>
|
19 |
</td>
|
20 |
</tr>
|
21 |
</tbody>
|
24 |
<?php
|
25 |
$trackship = WC_Advanced_Shipment_Tracking_Trackship::get_instance();
|
26 |
$admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
27 |
+
$admin->get_html( $trackship->get_trackship_bulk_actions_data() );
|
28 |
+
?>
|
29 |
</div>
|
30 |
</div>
|
31 |
</div>
|
32 |
+
</section>
|
includes/views/admin_options_trackship_integration.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
wp_enqueue_script( 'trackship_script' );
|
6 |
?>
|
@@ -14,10 +14,10 @@ wp_enqueue_script( 'trackship_script' );
|
|
14 |
<h3>Start for Free. 50 Free trackers for new accounts!</h3>
|
15 |
</div>
|
16 |
</div>
|
17 |
-
<a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ); ?>" target="_blank" class="button-primary btn_green2 btn_large"><span><?php
|
18 |
<div class="">
|
19 |
<div class="ts_col_inner ts_landing_banner">
|
20 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/ts-header-banner.png">
|
21 |
<span class="dashicons dashicons-video-alt3 open_ts_video"></span>
|
22 |
</div>
|
23 |
</div>
|
@@ -31,4 +31,4 @@ wp_enqueue_script( 'trackship_script' );
|
|
31 |
<div class="popupclose"></div>
|
32 |
</div>
|
33 |
</div>
|
34 |
-
</section>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Html code for trackship tab
|
4 |
*/
|
5 |
wp_enqueue_script( 'trackship_script' );
|
6 |
?>
|
14 |
<h3>Start for Free. 50 Free trackers for new accounts!</h3>
|
15 |
</div>
|
16 |
</div>
|
17 |
+
<a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ); ?>" target="_blank" class="button-primary btn_green2 btn_large"><span><?php esc_html_e('Install TrackShip for WooCommerce', 'woo-advanced-shipment-tracking'); ?></span><span class="dashicons dashicons-arrow-right-alt2"></span></a>
|
18 |
<div class="">
|
19 |
<div class="ts_col_inner ts_landing_banner">
|
20 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/ts-header-banner.png">
|
21 |
<span class="dashicons dashicons-video-alt3 open_ts_video"></span>
|
22 |
</div>
|
23 |
</div>
|
31 |
<div class="popupclose"></div>
|
32 |
</div>
|
33 |
</div>
|
34 |
+
</section>
|
includes/views/admin_status_notifications.php
CHANGED
@@ -2,38 +2,40 @@
|
|
2 |
<div class="tab_inner_container">
|
3 |
<div class="outer_form_table ts_notifications_outer_table">
|
4 |
<?php
|
5 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
6 |
|
7 |
-
$wcast_enable_late_shipments_admin_email = $ast->get_option_value_from_array('late_shipments_email_settings','wcast_enable_late_shipments_admin_email','');
|
8 |
|
9 |
-
$
|
10 |
|
11 |
$ts_notifications = $this->trackship_shipment_status_notifications_data();
|
12 |
?>
|
13 |
|
14 |
-
<input id="tab_email_notifications" type="radio" name="ts_notification_tabs" class="inner_tab_input" data-type="email" <?php
|
15 |
-
<label for="tab_email_notifications" class="inner_tab_label ts_tabs_label"><?php
|
16 |
|
17 |
-
<input id="tab_sms_notifications" type="radio" name="ts_notification_tabs" class="inner_tab_input" data-type="sms" <?php
|
18 |
-
<label for="tab_sms_notifications" class="inner_tab_label ts_tabs_label"><?php
|
19 |
|
20 |
<section class="inner_tab_section shipment-status-email-section">
|
21 |
<div class="custom_order_status_section">
|
22 |
<table class="form-table shipment-status-email-table">
|
23 |
<tbody>
|
24 |
-
<?php
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
<td class="forminp status-label-column">
|
28 |
<span class="shipment_status_toggle">
|
29 |
-
<input type="hidden" name="<?php
|
30 |
-
<input class="ast-tgl ast-tgl-flat" id="<?php
|
31 |
-
<label class="ast-tgl-btn ast-tgl-btn-green" for="<?php
|
32 |
</span>
|
33 |
-
<button class="button button-primary shipment-status-label <?php
|
34 |
</td>
|
35 |
<td class="forminp">
|
36 |
-
<a class="button-primary btn_ts_transparent edit_customizer_a" href="<?php
|
37 |
</td>
|
38 |
</tr>
|
39 |
<?php } ?>
|
@@ -49,24 +51,24 @@
|
|
49 |
<tbody>
|
50 |
<tr valign="top">
|
51 |
<td>
|
52 |
-
<h3 style=""><?php
|
53 |
</td>
|
54 |
</tr>
|
55 |
</tbody>
|
56 |
</table>
|
57 |
<table class="form-table shipment-status-email-table">
|
58 |
<tbody>
|
59 |
-
<tr class="<?php
|
60 |
<td class="forminp status-label-column">
|
61 |
<span class="shipment_status_toggle">
|
62 |
<input type="hidden" name="wcast_enable_late_shipments_admin_email" value="0"/>
|
63 |
-
<input class="ast-tgl ast-tgl-flat" id="wcast_enable_late_shipments_admin_email" name="wcast_enable_late_shipments_admin_email" data-settings="late_shipments_email_settings" type="checkbox" <?php
|
64 |
<label class="ast-tgl-btn ast-tgl-btn-green" for="wcast_enable_late_shipments_admin_email"></label>
|
65 |
</span>
|
66 |
-
<button type="button" class="button button-primary shipment-status-label late-shipments"><?php
|
67 |
</td>
|
68 |
<td class="forminp">
|
69 |
-
<a class="edit_customizer_a late_shipments_a button-primary btn_ts_transparent" href="javascript:void(0);"><?php
|
70 |
</td>
|
71 |
</tr>
|
72 |
</tbody>
|
@@ -79,83 +81,85 @@
|
|
79 |
$wcast_late_shipments_email_subject = isset( $late_shipments_email_settings['wcast_late_shipments_email_subject'] ) ? $late_shipments_email_settings['wcast_late_shipments_email_subject'] : '';
|
80 |
$wcast_late_shipments_email_content = isset( $late_shipments_email_settings['wcast_late_shipments_email_content'] ) ? $late_shipments_email_settings['wcast_late_shipments_email_content'] : '';
|
81 |
$wcast_late_shipments_trigger_alert = isset( $late_shipments_email_settings['wcast_late_shipments_trigger_alert'] ) ? $late_shipments_email_settings['wcast_late_shipments_trigger_alert'] : '';
|
82 |
-
$wcast_late_shipments_daily_digest_time = isset( $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] ) ? $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] : '';
|
|
|
83 |
<div class="custom_order_status_section">
|
84 |
<table class="form-table late-shipments-email-content-table hide_table">
|
85 |
<tr class="">
|
86 |
<th scope="row" class="titledesc">
|
87 |
-
<label for=""><?php
|
88 |
</th>
|
89 |
<td class="forminp">
|
90 |
<fieldset>
|
91 |
-
<input class="input-text" type="number" name="wcast_late_shipments_days" id="wcast_late_shipments_days" min="1" value="<?php
|
92 |
</fieldset>
|
93 |
</td>
|
94 |
</tr>
|
95 |
<tr class="">
|
96 |
<th scope="row" class="titledesc">
|
97 |
-
<label for=""><?php
|
98 |
</th>
|
99 |
<td class="forminp">
|
100 |
<fieldset>
|
101 |
-
<input class="input-text regular-input " type="text" name="wcast_late_shipments_email_to" id="wcast_late_shipments_email_to" placeholder="<?php
|
102 |
</fieldset>
|
103 |
</td>
|
104 |
</tr>
|
105 |
<tr class="">
|
106 |
<th scope="row" class="titledesc">
|
107 |
-
<label for=""><?php
|
108 |
</th>
|
109 |
<td class="forminp">
|
110 |
<fieldset>
|
111 |
-
<input class="input-text regular-input " type="text" name="wcast_late_shipments_email_subject" id="wcast_late_shipments_email_subject" placeholder="<?php
|
112 |
</fieldset>
|
113 |
</td>
|
114 |
</tr>
|
115 |
<tr class="">
|
116 |
<th scope="row" class="titledesc">
|
117 |
-
<label for=""><?php
|
118 |
</th>
|
119 |
<td class="forminp">
|
120 |
<fieldset>
|
121 |
-
<textarea name="wcast_late_shipments_email_content" id="wcast_late_shipments_email_content" placeholder="<?php
|
122 |
</fieldset>
|
123 |
-
<span><?php
|
124 |
</td>
|
125 |
</tr>
|
126 |
<?php
|
127 |
$send_time_array = array();
|
128 |
for ( $hour = 0; $hour < 24; $hour++ ) {
|
129 |
for ( $min = 0; $min < 60; $min = $min + 30 ) {
|
130 |
-
$this_time =
|
131 |
$send_time_array[ $this_time ] = $this_time;
|
132 |
}
|
133 |
-
}
|
|
|
134 |
<tr class="">
|
135 |
<th scope="row" class="titledesc">
|
136 |
-
<label for=""><?php
|
137 |
</th>
|
138 |
<td class="forminp">
|
139 |
<label class="" for="trigger_alert_as_it_happens">
|
140 |
-
<input type="radio" id="trigger_alert_as_it_happens" name="wcast_late_shipments_trigger_alert" value="as_it_happens" <?php
|
141 |
-
<span class=""><?php
|
142 |
</label>
|
143 |
<label class="" for="trigger_alert_daily_digest_on">
|
144 |
-
<input type="radio" id="trigger_alert_daily_digest_on" name="wcast_late_shipments_trigger_alert" value="daily_digest_on" <?php
|
145 |
-
<span class=""><?php
|
146 |
</label>
|
147 |
<select class="select daily_digest_time" name="wcast_late_shipments_daily_digest_time">
|
148 |
-
<?php foreach((array)$send_time_array as $key1 => $val1 ){ ?>
|
149 |
-
<option <?php
|
150 |
<?php } ?>
|
151 |
</select>
|
152 |
</td>
|
153 |
</tr>
|
154 |
<tr>
|
155 |
<td colspan="2">
|
156 |
-
<button name="save" class="button-primary woocommerce-save-button btn_green2 btn_large" type="submit" value="Save changes"><?php
|
157 |
<div class="spinner"></div>
|
158 |
-
<?php wp_nonce_field( 'ts_late_shipments_email_form', 'ts_late_shipments_email_form_nonce' )
|
159 |
<input type="hidden" name="action" value="ts_late_shipments_email_form_update">
|
160 |
</td>
|
161 |
</tr>
|
@@ -165,11 +169,12 @@
|
|
165 |
</section>
|
166 |
<section class="inner_tab_section shipment-status-sms-section">
|
167 |
<?php
|
168 |
-
if(!class_exists('SMS_for_WooCommerce')){
|
|
|
169 |
<div class="smswoo_notification_section">
|
170 |
<div class="ast-row">
|
171 |
<div class="ast-col as-col-4">
|
172 |
-
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/smswoo-addons-icon.jpg">
|
173 |
</div>
|
174 |
<div class="ast-col as-col-8">
|
175 |
<h3>SMSWOO – SMS for WooCommerce</h3>
|
@@ -178,10 +183,11 @@
|
|
178 |
</div>
|
179 |
</div>
|
180 |
</div>
|
181 |
-
<?php
|
|
|
182 |
do_action( 'shipment_status_sms_section' );
|
183 |
?>
|
184 |
</section>
|
185 |
</div>
|
186 |
</div>
|
187 |
-
</section>
|
2 |
<div class="tab_inner_container">
|
3 |
<div class="outer_form_table ts_notifications_outer_table">
|
4 |
<?php
|
5 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
6 |
|
7 |
+
$wcast_enable_late_shipments_admin_email = $ast->get_option_value_from_array( 'late_shipments_email_settings', 'wcast_enable_late_shipments_admin_email', '' );
|
8 |
|
9 |
+
$n_type = isset( $_GET['type'] ) ? sanitize_text_field($_GET['type']) : 'email';
|
10 |
|
11 |
$ts_notifications = $this->trackship_shipment_status_notifications_data();
|
12 |
?>
|
13 |
|
14 |
+
<input id="tab_email_notifications" type="radio" name="ts_notification_tabs" class="inner_tab_input" data-type="email" <?php esc_html_e( ( 'email' == $n_type ) ? 'checked' : '' ); ?>>
|
15 |
+
<label for="tab_email_notifications" class="inner_tab_label ts_tabs_label"><?php esc_html_e( 'Email Notifications', 'woo-advanced-shipment-tracking' ); ?></label>
|
16 |
|
17 |
+
<input id="tab_sms_notifications" type="radio" name="ts_notification_tabs" class="inner_tab_input" data-type="sms" <?php esc_html_e( ( 'sms' == $n_type ) ? 'checked' : '' ); ?>>
|
18 |
+
<label for="tab_sms_notifications" class="inner_tab_label ts_tabs_label"><?php esc_html_e( 'SMS Notifications', 'woo-advanced-shipment-tracking' ); ?></label>
|
19 |
|
20 |
<section class="inner_tab_section shipment-status-email-section">
|
21 |
<div class="custom_order_status_section">
|
22 |
<table class="form-table shipment-status-email-table">
|
23 |
<tbody>
|
24 |
+
<?php
|
25 |
+
foreach ( $ts_notifications as $key => $val ) {
|
26 |
+
$ast_enable_email = $ast->get_option_value_from_array( $val['option_name'], $val['enable_status_name'], '' );
|
27 |
+
?>
|
28 |
+
<tr class="<?php esc_html_e( ( 1 == $ast_enable_email ) ? 'enable' : 'disable' ); ?>">
|
29 |
<td class="forminp status-label-column">
|
30 |
<span class="shipment_status_toggle">
|
31 |
+
<input type="hidden" name="<?php esc_html_e( $val['enable_status_name'] ); ?>" value="0"/>
|
32 |
+
<input class="ast-tgl ast-tgl-flat" id="<?php esc_html_e( $val['enable_status_name'] ); ?>" name="<?php esc_html_e( $val['enable_status_name'] ); ?>" data-settings="<?php esc_html_e( $val['option_name'] ); ?>" type="checkbox" <?php esc_html_e( ( 1 == $ast_enable_email ) ? 'checked' : '' ); ?> value="yes"/>
|
33 |
+
<label class="ast-tgl-btn ast-tgl-btn-green" for="<?php esc_html_e( $val['enable_status_name'] ); ?>"></label>
|
34 |
</span>
|
35 |
+
<button class="button button-primary shipment-status-label <?php esc_html_e( $val['slug'] ); ?>"><?php esc_html_e( $val['title'] ); ?></button>
|
36 |
</td>
|
37 |
<td class="forminp">
|
38 |
+
<a class="button-primary btn_ts_transparent edit_customizer_a" href="<?php esc_html_e( $val['customizer_url'] ); ?>"><?php esc_html_e('Customize', 'woo-advanced-shipment-tracking'); ?></a>
|
39 |
</td>
|
40 |
</tr>
|
41 |
<?php } ?>
|
51 |
<tbody>
|
52 |
<tr valign="top">
|
53 |
<td>
|
54 |
+
<h3 style=""><?php esc_html_e( 'Admin Notifications', 'woo-advanced-shipment-tracking' ); ?></h3>
|
55 |
</td>
|
56 |
</tr>
|
57 |
</tbody>
|
58 |
</table>
|
59 |
<table class="form-table shipment-status-email-table">
|
60 |
<tbody>
|
61 |
+
<tr class="<?php esc_html_e( ( 1 == $wcast_enable_late_shipments_admin_email ) ? 'enable' : 'disable' ); ?>">
|
62 |
<td class="forminp status-label-column">
|
63 |
<span class="shipment_status_toggle">
|
64 |
<input type="hidden" name="wcast_enable_late_shipments_admin_email" value="0"/>
|
65 |
+
<input class="ast-tgl ast-tgl-flat" id="wcast_enable_late_shipments_admin_email" name="wcast_enable_late_shipments_admin_email" data-settings="late_shipments_email_settings" type="checkbox" <?php esc_html_e( ( 1 == $wcast_enable_late_shipments_admin_email ) ? 'checked' : '' ); ?> value="1"/>
|
66 |
<label class="ast-tgl-btn ast-tgl-btn-green" for="wcast_enable_late_shipments_admin_email"></label>
|
67 |
</span>
|
68 |
+
<button type="button" class="button button-primary shipment-status-label late-shipments"><?php esc_html_e('Late Shipments', 'woo-advanced-shipment-tracking'); ?></button>
|
69 |
</td>
|
70 |
<td class="forminp">
|
71 |
+
<a class="edit_customizer_a late_shipments_a button-primary btn_ts_transparent" href="javascript:void(0);"><?php esc_html_e('Customize', 'woo-advanced-shipment-tracking'); ?></a>
|
72 |
</td>
|
73 |
</tr>
|
74 |
</tbody>
|
81 |
$wcast_late_shipments_email_subject = isset( $late_shipments_email_settings['wcast_late_shipments_email_subject'] ) ? $late_shipments_email_settings['wcast_late_shipments_email_subject'] : '';
|
82 |
$wcast_late_shipments_email_content = isset( $late_shipments_email_settings['wcast_late_shipments_email_content'] ) ? $late_shipments_email_settings['wcast_late_shipments_email_content'] : '';
|
83 |
$wcast_late_shipments_trigger_alert = isset( $late_shipments_email_settings['wcast_late_shipments_trigger_alert'] ) ? $late_shipments_email_settings['wcast_late_shipments_trigger_alert'] : '';
|
84 |
+
$wcast_late_shipments_daily_digest_time = isset( $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] ) ? $late_shipments_email_settings['wcast_late_shipments_daily_digest_time'] : '';
|
85 |
+
?>
|
86 |
<div class="custom_order_status_section">
|
87 |
<table class="form-table late-shipments-email-content-table hide_table">
|
88 |
<tr class="">
|
89 |
<th scope="row" class="titledesc">
|
90 |
+
<label for=""><?php esc_html_e('Late Shipment Days', 'woo-advanced-shipment-tracking'); ?></label>
|
91 |
</th>
|
92 |
<td class="forminp">
|
93 |
<fieldset>
|
94 |
+
<input class="input-text" type="number" name="wcast_late_shipments_days" id="wcast_late_shipments_days" min="1" value="<?php esc_html_e( $wcast_late_shipments_days ); ?>">
|
95 |
</fieldset>
|
96 |
</td>
|
97 |
</tr>
|
98 |
<tr class="">
|
99 |
<th scope="row" class="titledesc">
|
100 |
+
<label for=""><?php esc_html_e('Recipient(s)', 'woocommerce'); ?></label>
|
101 |
</th>
|
102 |
<td class="forminp">
|
103 |
<fieldset>
|
104 |
+
<input class="input-text regular-input " type="text" name="wcast_late_shipments_email_to" id="wcast_late_shipments_email_to" placeholder="<?php esc_html_e('E.g. {admin_email}, admin@example.org', 'woo-advanced-shipment-tracking'); ?>" value="<?php esc_html_e( $wcast_late_shipments_email_to ); ?>">
|
105 |
</fieldset>
|
106 |
</td>
|
107 |
</tr>
|
108 |
<tr class="">
|
109 |
<th scope="row" class="titledesc">
|
110 |
+
<label for=""><?php esc_html_e('Subject', 'woocommerce'); ?></label>
|
111 |
</th>
|
112 |
<td class="forminp">
|
113 |
<fieldset>
|
114 |
+
<input class="input-text regular-input " type="text" name="wcast_late_shipments_email_subject" id="wcast_late_shipments_email_subject" placeholder="<?php esc_html_e('Late shipment for order #{order_number}', 'woo-advanced-shipment-tracking'); ?>" value="<?php esc_html_e( $wcast_late_shipments_email_subject ); ?>">
|
115 |
</fieldset>
|
116 |
</td>
|
117 |
</tr>
|
118 |
<tr class="">
|
119 |
<th scope="row" class="titledesc">
|
120 |
+
<label for=""><?php esc_html_e('Email content', 'woo-advanced-shipment-tracking'); ?></label>
|
121 |
</th>
|
122 |
<td class="forminp">
|
123 |
<fieldset>
|
124 |
+
<textarea name="wcast_late_shipments_email_content" id="wcast_late_shipments_email_content" placeholder="<?php esc_html_e('This order was shipped {shipment_length} days ago, the shipment status is {shipment_status} and its est. delivery date is {est_delivery_date}.', 'woo-advanced-shipment-tracking'); ?>"><?php esc_html_e( $wcast_late_shipments_email_content ); ?></textarea>
|
125 |
</fieldset>
|
126 |
+
<span><?php esc_html_e('Available variables:', 'woo-advanced-shipment-tracking'); ?> {site_title} {admin_email} {customer_first_name} {customer_last_name} {customer_company_name} {customer_username} {order_number} {shipment_length} {shipment_status} {est_delivery_date}</span>
|
127 |
</td>
|
128 |
</tr>
|
129 |
<?php
|
130 |
$send_time_array = array();
|
131 |
for ( $hour = 0; $hour < 24; $hour++ ) {
|
132 |
for ( $min = 0; $min < 60; $min = $min + 30 ) {
|
133 |
+
$this_time = gmdate( 'H:i', strtotime( "$hour:$min" ) );
|
134 |
$send_time_array[ $this_time ] = $this_time;
|
135 |
}
|
136 |
+
}
|
137 |
+
?>
|
138 |
<tr class="">
|
139 |
<th scope="row" class="titledesc">
|
140 |
+
<label for=""><?php esc_html_e('Trigger Alert', 'woo-advanced-shipment-tracking'); ?></label>
|
141 |
</th>
|
142 |
<td class="forminp">
|
143 |
<label class="" for="trigger_alert_as_it_happens">
|
144 |
+
<input type="radio" id="trigger_alert_as_it_happens" name="wcast_late_shipments_trigger_alert" value="as_it_happens" <?php esc_html_e( ( 'as_it_happens' == $wcast_late_shipments_trigger_alert ) ? 'checked' : '' ); ?>>
|
145 |
+
<span class=""><?php esc_html_e('As it Happens', 'woo-advanced-shipment-tracking'); ?></span>
|
146 |
</label>
|
147 |
<label class="" for="trigger_alert_daily_digest_on">
|
148 |
+
<input type="radio" id="trigger_alert_daily_digest_on" name="wcast_late_shipments_trigger_alert" value="daily_digest_on" <?php esc_html_e( ( 'daily_digest_on' == $wcast_late_shipments_trigger_alert ) ? 'checked' : '' ); ?>>
|
149 |
+
<span class=""><?php esc_html_e('Daily Digest on', 'woo-advanced-shipment-tracking'); ?></span>
|
150 |
</label>
|
151 |
<select class="select daily_digest_time" name="wcast_late_shipments_daily_digest_time">
|
152 |
+
<?php foreach ( (array) $send_time_array as $key1 => $val1 ) { ?>
|
153 |
+
<option <?php esc_html_e( ( $wcast_late_shipments_daily_digest_time == $key1 ) ? 'selected' : '' ); ?> value="<?php esc_html_e( $key1 ); ?>" ><?php esc_html_e( $val1 ); ?></option>
|
154 |
<?php } ?>
|
155 |
</select>
|
156 |
</td>
|
157 |
</tr>
|
158 |
<tr>
|
159 |
<td colspan="2">
|
160 |
+
<button name="save" class="button-primary woocommerce-save-button btn_green2 btn_large" type="submit" value="Save changes"><?php esc_html_e( 'Save Changes', 'woo-advanced-shipment-tracking' ); ?></button>
|
161 |
<div class="spinner"></div>
|
162 |
+
<?php wp_nonce_field( 'ts_late_shipments_email_form', 'ts_late_shipments_email_form_nonce' ); ?>
|
163 |
<input type="hidden" name="action" value="ts_late_shipments_email_form_update">
|
164 |
</td>
|
165 |
</tr>
|
169 |
</section>
|
170 |
<section class="inner_tab_section shipment-status-sms-section">
|
171 |
<?php
|
172 |
+
if ( !class_exists('SMS_for_WooCommerce') ) {
|
173 |
+
?>
|
174 |
<div class="smswoo_notification_section">
|
175 |
<div class="ast-row">
|
176 |
<div class="ast-col as-col-4">
|
177 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/smswoo-addons-icon.jpg">
|
178 |
</div>
|
179 |
<div class="ast-col as-col-8">
|
180 |
<h3>SMSWOO – SMS for WooCommerce</h3>
|
183 |
</div>
|
184 |
</div>
|
185 |
</div>
|
186 |
+
<?php
|
187 |
+
}
|
188 |
do_action( 'shipment_status_sms_section' );
|
189 |
?>
|
190 |
</section>
|
191 |
</div>
|
192 |
</div>
|
193 |
+
</section>
|
includes/views/admin_trackship_dashboard.php
CHANGED
@@ -1,14 +1,20 @@
|
|
1 |
<section id="content_trackship_dashboard" class="tab_section">
|
2 |
<div class="tab_inner_container">
|
3 |
<?php
|
4 |
-
if($completed_order_with_tracking > 0 || $completed_order_with_zero_balance > 0 || $completed_order_with_do_connection > 0){
|
5 |
-
|
|
|
6 |
<div class="trackship-notice">
|
7 |
-
<p
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
</div>
|
10 |
<div class="trackship-notice bulk_shipment_status_success" style="display:none;">
|
11 |
-
<p><?php
|
12 |
</div>
|
13 |
<?php } ?>
|
14 |
<div class="trackship_status_section first">
|
@@ -16,16 +22,16 @@
|
|
16 |
<table class="form-table heading-table">
|
17 |
<tbody>
|
18 |
<tr valign="top">
|
19 |
-
<td><h3 style=""><?php
|
20 |
</tr>
|
21 |
</tbody>
|
22 |
</table>
|
23 |
<table class="form-table trackship_status_table">
|
24 |
<tbody>
|
25 |
<tr valign="top">
|
26 |
-
<td scope="row" class="titledesc"><label><strong><?php
|
27 |
<td class="forminp">
|
28 |
-
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=sidebar&utm_campaign=upgrade" target="_blank" class="button-primary btn_green2 btn_icon api_connected"><span class="dashicons dashicons-yes"></span><?php
|
29 |
</td>
|
30 |
</tr>
|
31 |
</tbody>
|
@@ -38,7 +44,7 @@
|
|
38 |
<table class="form-table heading-table">
|
39 |
<tbody>
|
40 |
<tr valign="top">
|
41 |
-
<td><h3 style=""><?php
|
42 |
</tr>
|
43 |
</tbody>
|
44 |
</table>
|
@@ -46,11 +52,11 @@
|
|
46 |
<tbody>
|
47 |
<tr valign="top">
|
48 |
<td scope="row" class="titledesc">
|
49 |
-
<label><?php
|
50 |
-
<label><?php
|
51 |
</td>
|
52 |
<td class="forminp">
|
53 |
-
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=dashboard" class="button-primary btn_ts_transparent" target="blank"><?php
|
54 |
</td>
|
55 |
</tr>
|
56 |
</tbody>
|
@@ -67,8 +73,8 @@
|
|
67 |
<tbody>
|
68 |
<tr valign="top">
|
69 |
<td>
|
70 |
-
<h3 style=""><?php
|
71 |
-
<?php wp_nonce_field( 'wc_ast_trackship_form', 'wc_ast_trackship_form_nonce' )
|
72 |
<input type="hidden" name="action" value="wc_ast_trackship_form_update">
|
73 |
</td>
|
74 |
</tr>
|
@@ -84,8 +90,8 @@
|
|
84 |
<tbody>
|
85 |
<tr valign="top">
|
86 |
<td>
|
87 |
-
<h3 style=""><?php
|
88 |
-
<?php wp_nonce_field( 'wc_ast_trackship_automation_form', 'wc_ast_trackship_automation_form_nonce' )
|
89 |
<input type="hidden" name="action" value="wc_ast_trackship_automation_form_update">
|
90 |
</td>
|
91 |
</tr>
|
@@ -94,28 +100,29 @@
|
|
94 |
<div class="custom_order_status_section">
|
95 |
<table class="form-table order-status-table">
|
96 |
<tbody>
|
97 |
-
<tr valign="top" class="delivered_row <?php
|
98 |
<td class="forminp">
|
99 |
<input type="hidden" name="wc_ast_status_delivered" value="0"/>
|
100 |
-
<input class="ast-tgl ast-tgl-flat ts_order_status_toggle" id="wc_ast_status_delivered" name="wc_ast_status_delivered" type="checkbox" <?php
|
101 |
<label class="ast-tgl-btn ast-tgl-btn-green" for="wc_ast_status_delivered"></label>
|
102 |
</td>
|
103 |
<td class="forminp status-label-column">
|
104 |
<span class="order-label wc-delivered">
|
105 |
<?php
|
106 |
-
if(get_option('wc_ast_status_delivered')){
|
107 |
-
|
108 |
-
} else{
|
109 |
-
|
110 |
-
}
|
|
|
111 |
</span>
|
112 |
</td>
|
113 |
<td class="forminp">
|
114 |
<fieldset>
|
115 |
-
<input class="input-text regular-input color_input" type="text" name="wc_ast_status_label_color" id="wc_ast_status_label_color" style="" value="<?php
|
116 |
<select class="select ts_custom_order_color_select" id="wc_ast_status_label_font_color" name="wc_ast_status_label_font_color">
|
117 |
-
<option value="#fff" <?php
|
118 |
-
<option value="#000" <?php
|
119 |
</select>
|
120 |
</fieldset>
|
121 |
</td>
|
@@ -134,8 +141,8 @@
|
|
134 |
<tbody>
|
135 |
<tr valign="top">
|
136 |
<td>
|
137 |
-
<h3 style=""><?php
|
138 |
-
<?php wp_nonce_field( 'trackship_tracking_page_form', 'trackship_tracking_page_form_nonce' )
|
139 |
<input type="hidden" name="action" value="trackship_tracking_page_form_update">
|
140 |
</td>
|
141 |
</tr>
|
@@ -144,6 +151,5 @@
|
|
144 |
<?php $ast_admin->get_html_ul( $this->get_tracking_page_data() ); ?>
|
145 |
</div>
|
146 |
</form>
|
147 |
-
</div>
|
148 |
-
|
149 |
-
</section>
|
1 |
<section id="content_trackship_dashboard" class="tab_section">
|
2 |
<div class="tab_inner_container">
|
3 |
<?php
|
4 |
+
if ( $completed_order_with_tracking > 0 || $completed_order_with_zero_balance > 0 || $completed_order_with_do_connection > 0 ) {
|
5 |
+
$total_orders = $completed_order_with_tracking + $completed_order_with_zero_balance + $completed_order_with_do_connection;
|
6 |
+
?>
|
7 |
<div class="trackship-notice">
|
8 |
+
<p>
|
9 |
+
<?php
|
10 |
+
/* translators: %s: replace with total_orders */
|
11 |
+
echo sprintf( esc_html__( 'We detected %s Shipped orders from the last 30 days that were not sent to TrackShip, you can bulk send them to TrackShip', 'woo-advanced-shipment-tracking' ), esc_html( $total_orders ) );
|
12 |
+
?>
|
13 |
+
</p>
|
14 |
+
<button class="button-primary btn_green2 bulk_shipment_status_button" wp_nonce="<?php esc_html_e( wp_create_nonce( 'bulk_shipment_status' ) ); ?>" ><?php esc_html_e( 'Get Shipment Status', 'woo-advanced-shipment-tracking' ); ?></button>
|
15 |
</div>
|
16 |
<div class="trackship-notice bulk_shipment_status_success" style="display:none;">
|
17 |
+
<p><?php esc_html_e('Tracking info sent to Trackship for all Orders.', 'woo-advanced-shipment-tracking'); ?></p>
|
18 |
</div>
|
19 |
<?php } ?>
|
20 |
<div class="trackship_status_section first">
|
22 |
<table class="form-table heading-table">
|
23 |
<tbody>
|
24 |
<tr valign="top">
|
25 |
+
<td><h3 style=""><?php esc_html_e( 'TrackShip Connection Status', 'woo-advanced-shipment-tracking' ); ?></h3></td>
|
26 |
</tr>
|
27 |
</tbody>
|
28 |
</table>
|
29 |
<table class="form-table trackship_status_table">
|
30 |
<tbody>
|
31 |
<tr valign="top">
|
32 |
+
<td scope="row" class="titledesc"><label><strong><?php esc_html_e( 'Connection Status', 'woo-advanced-shipment-tracking' ); ?></strong></label></td>
|
33 |
<td class="forminp">
|
34 |
+
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=sidebar&utm_campaign=upgrade" target="_blank" class="button-primary btn_green2 btn_icon api_connected"><span class="dashicons dashicons-yes"></span><?php esc_html_e( 'Connected', 'woo-advanced-shipment-tracking' ); ?></a>
|
35 |
</td>
|
36 |
</tr>
|
37 |
</tbody>
|
44 |
<table class="form-table heading-table">
|
45 |
<tbody>
|
46 |
<tr valign="top">
|
47 |
+
<td><h3 style=""><?php esc_html_e( 'TrackShip Account', 'woo-advanced-shipment-tracking' ); ?></h3></td>
|
48 |
</tr>
|
49 |
</tbody>
|
50 |
</table>
|
52 |
<tbody>
|
53 |
<tr valign="top">
|
54 |
<td scope="row" class="titledesc">
|
55 |
+
<label><?php esc_html_e( 'Subscription: ', 'woo-advanced-shipment-tracking' ); ?></label><strong><?php esc_html_e( isset( $plan_data->subscription_plan ) ? $plan_data->subscription_plan : '' ); ?></strong></br>
|
56 |
+
<label><?php esc_html_e( 'Trackers Balance: ', 'woo-advanced-shipment-tracking' ); ?></label><strong><?php esc_html_e( get_option('trackers_balance') ); ?></strong>
|
57 |
</td>
|
58 |
<td class="forminp">
|
59 |
+
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=dashboard" class="button-primary btn_ts_transparent" target="blank"><?php esc_html_e( 'TrackShip Dashboard', 'woo-advanced-shipment-tracking' ); ?></a>
|
60 |
</td>
|
61 |
</tr>
|
62 |
</tbody>
|
73 |
<tbody>
|
74 |
<tr valign="top">
|
75 |
<td>
|
76 |
+
<h3 style=""><?php esc_html_e( 'General Settings', 'woo-advanced-shipment-tracking' ); ?></h3>
|
77 |
+
<?php wp_nonce_field( 'wc_ast_trackship_form', 'wc_ast_trackship_form_nonce' ); ?>
|
78 |
<input type="hidden" name="action" value="wc_ast_trackship_form_update">
|
79 |
</td>
|
80 |
</tr>
|
90 |
<tbody>
|
91 |
<tr valign="top">
|
92 |
<td>
|
93 |
+
<h3 style=""><?php esc_html_e( 'Automation', 'woo-advanced-shipment-tracking' ); ?></h3>
|
94 |
+
<?php wp_nonce_field( 'wc_ast_trackship_automation_form', 'wc_ast_trackship_automation_form_nonce' ); ?>
|
95 |
<input type="hidden" name="action" value="wc_ast_trackship_automation_form_update">
|
96 |
</td>
|
97 |
</tr>
|
100 |
<div class="custom_order_status_section">
|
101 |
<table class="form-table order-status-table">
|
102 |
<tbody>
|
103 |
+
<tr valign="top" class="delivered_row <?php esc_html_e( !get_option('wc_ast_status_delivered') ? 'disable_row' : '' ); ?>">
|
104 |
<td class="forminp">
|
105 |
<input type="hidden" name="wc_ast_status_delivered" value="0"/>
|
106 |
+
<input class="ast-tgl ast-tgl-flat ts_order_status_toggle" id="wc_ast_status_delivered" name="wc_ast_status_delivered" type="checkbox" <?php esc_html_e( get_option('wc_ast_status_delivered') ? 'checked' : '' ); ?> value="1"/>
|
107 |
<label class="ast-tgl-btn ast-tgl-btn-green" for="wc_ast_status_delivered"></label>
|
108 |
</td>
|
109 |
<td class="forminp status-label-column">
|
110 |
<span class="order-label wc-delivered">
|
111 |
<?php
|
112 |
+
if ( get_option('wc_ast_status_delivered') ) {
|
113 |
+
esc_html_e( wc_get_order_status_name( 'delivered' ), 'woo-advanced-shipment-tracking' );
|
114 |
+
} else {
|
115 |
+
esc_html_e( 'Delivered', 'woo-advanced-shipment-tracking' );
|
116 |
+
}
|
117 |
+
?>
|
118 |
</span>
|
119 |
</td>
|
120 |
<td class="forminp">
|
121 |
<fieldset>
|
122 |
+
<input class="input-text regular-input color_input" type="text" name="wc_ast_status_label_color" id="wc_ast_status_label_color" style="" value="<?php esc_html_e( get_option('wc_ast_status_label_color', '#59c889' ) ); ?>" placeholder="">
|
123 |
<select class="select ts_custom_order_color_select" id="wc_ast_status_label_font_color" name="wc_ast_status_label_font_color">
|
124 |
+
<option value="#fff" <?php esc_html_e( get_option('wc_ast_status_label_font_color', '#fff') == '#fff' ? 'selected' : '' ); ?>><?php esc_html_e( 'Light Font', 'woo-advanced-shipment-tracking' ); ?></option>
|
125 |
+
<option value="#000" <?php esc_html_e( get_option('wc_ast_status_label_font_color', '#fff') == '#000' ? 'selected' : '' ); ?>><?php esc_html_e( 'Dark Font', 'woo-advanced-shipment-tracking' ); ?></option>
|
126 |
</select>
|
127 |
</fieldset>
|
128 |
</td>
|
141 |
<tbody>
|
142 |
<tr valign="top">
|
143 |
<td>
|
144 |
+
<h3 style=""><?php esc_html_e( 'Tracking Page', 'woo-advanced-shipment-tracking' ); ?></h3>
|
145 |
+
<?php wp_nonce_field( 'trackship_tracking_page_form', 'trackship_tracking_page_form_nonce' ); ?>
|
146 |
<input type="hidden" name="action" value="trackship_tracking_page_form_update">
|
147 |
</td>
|
148 |
</tr>
|
151 |
<?php $ast_admin->get_html_ul( $this->get_tracking_page_data() ); ?>
|
152 |
</div>
|
153 |
</form>
|
154 |
+
</div>
|
155 |
+
</section>
|
|
includes/views/front/layout1_tracking_details.php
CHANGED
@@ -1,42 +1,75 @@
|
|
1 |
<?php
|
2 |
-
if($hide_tracking_events
|
|
|
|
|
3 |
?>
|
4 |
<div class="tracking-details" style="">
|
5 |
<?php
|
6 |
-
if($hide_tracking_events
|
7 |
-
|
|
|
8 |
|
9 |
<div class="shipment_progress_heading_div">
|
10 |
-
<h4 class="h4-heading text-uppercase"><?php
|
11 |
</div>
|
12 |
|
13 |
-
<?php if(!empty($trackind_destination_detail_by_status_rev)){ ?>
|
14 |
|
15 |
<div class="tracking_destination_details_by_date">
|
16 |
|
17 |
-
<h4 style=""><?php
|
18 |
<ul class="timeline new-details">
|
19 |
-
<?php
|
20 |
-
|
21 |
-
|
22 |
-
$
|
|
|
|
|
|
|
|
|
23 |
<li>
|
24 |
-
<strong
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</li>
|
27 |
<?php $a++; } ?>
|
28 |
</ul>
|
29 |
|
30 |
<ul class="timeline old-details" style="display:none;">
|
31 |
<?php
|
32 |
-
|
33 |
-
|
34 |
-
if( $a <= 2 ){
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<?php $a++; } ?>
|
41 |
</ul>
|
42 |
</div>
|
@@ -45,62 +78,107 @@ if($hide_tracking_events == 1)return;
|
|
45 |
|
46 |
<div class="tracking_details_by_date">
|
47 |
|
48 |
-
<?php if(!empty($trackind_destination_detail_by_status_rev)){ ?>
|
49 |
-
<h4 class="" style=""><?php
|
50 |
<?php } ?>
|
51 |
|
52 |
<ul class="timeline new-details">
|
53 |
-
<?php
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</li>
|
61 |
<?php $a++; } ?>
|
62 |
</ul>
|
63 |
|
64 |
<ul class="timeline old-details" style="display:none;">
|
65 |
<?php
|
66 |
-
|
67 |
-
|
68 |
-
if( $a <= 2 ){
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
<?php $a++; } ?>
|
75 |
</ul>
|
76 |
|
77 |
</div>
|
78 |
|
79 |
-
<a class="view_old_details" href="javaScript:void(0);" style="display: inline;"><?php
|
80 |
-
<a class="hide_old_details" href="javaScript:void(0);" style="display: none;"><?php
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
if(!empty($tracking_details_by_date)){ ?>
|
85 |
|
86 |
<div class="shipment_progress_heading_div">
|
87 |
-
<h4 class="h4-heading text-uppercase"><?php
|
88 |
</div>
|
89 |
|
90 |
-
<?php if(!empty($trackind_destination_detail_by_status_rev)){ ?>
|
91 |
|
92 |
<div class="tracking_destination_details_by_date">
|
93 |
|
94 |
-
<h4 style=""><?php
|
95 |
<ul class="timeline">
|
96 |
|
97 |
-
<?php
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
<
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
</ul>
|
106 |
</div>
|
@@ -109,21 +187,32 @@ if($hide_tracking_events == 1)return;
|
|
109 |
|
110 |
<div class="tracking_details_by_date">
|
111 |
|
112 |
-
<?php if(!empty($trackind_destination_detail_by_status_rev)){ ?>
|
113 |
-
<h4 class="" style=""><?php
|
114 |
<?php } ?>
|
115 |
|
116 |
<ul class="timeline">
|
117 |
-
<?php
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
<
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
<?php } ?>
|
125 |
</ul>
|
126 |
</div>
|
127 |
-
<?php }
|
128 |
-
|
129 |
-
</div>
|
1 |
<?php
|
2 |
+
if ( 1 == $hide_tracking_events ) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
?>
|
6 |
<div class="tracking-details" style="">
|
7 |
<?php
|
8 |
+
if ( 2 == $hide_tracking_events ) {
|
9 |
+
if ( !empty( $tracking_details_by_date ) ) {
|
10 |
+
?>
|
11 |
|
12 |
<div class="shipment_progress_heading_div">
|
13 |
+
<h4 class="h4-heading text-uppercase"><?php esc_html_e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
14 |
</div>
|
15 |
|
16 |
+
<?php if ( !empty( $trackind_destination_detail_by_status_rev ) ) { ?>
|
17 |
|
18 |
<div class="tracking_destination_details_by_date">
|
19 |
|
20 |
+
<h4 style=""><?php esc_html_e( 'Destination Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
21 |
<ul class="timeline new-details">
|
22 |
+
<?php
|
23 |
+
$a = 1;
|
24 |
+
foreach ( $trackind_destination_detail_by_status_rev as $key => $value ) {
|
25 |
+
if ( $a > 2 ) {
|
26 |
+
break;
|
27 |
+
}
|
28 |
+
$date = gmdate('Y-m-d', strtotime($value->datetime));
|
29 |
+
?>
|
30 |
<li>
|
31 |
+
<strong>
|
32 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
33 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
34 |
+
</strong>
|
35 |
+
<p>
|
36 |
+
<?php
|
37 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
38 |
+
if ( null != $value->tracking_location->city ) {
|
39 |
+
echo ' - ';
|
40 |
+
}
|
41 |
+
?>
|
42 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
43 |
+
</p>
|
44 |
</li>
|
45 |
<?php $a++; } ?>
|
46 |
</ul>
|
47 |
|
48 |
<ul class="timeline old-details" style="display:none;">
|
49 |
<?php
|
50 |
+
$a = 1;
|
51 |
+
foreach ( $trackind_destination_detail_by_status_rev as $key => $value ) {
|
52 |
+
if ( $a <= 2 ) {
|
53 |
+
$a++;
|
54 |
+
continue;
|
55 |
+
}
|
56 |
+
$date = gmdate('Y-m-d', strtotime($value->datetime));
|
57 |
+
?>
|
58 |
+
<li>
|
59 |
+
<strong>
|
60 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
61 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
62 |
+
</strong>
|
63 |
+
<p>
|
64 |
+
<?php
|
65 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
66 |
+
if ( null != $value->tracking_location->city ) {
|
67 |
+
echo ' - ';
|
68 |
+
}
|
69 |
+
?>
|
70 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
71 |
+
</p>
|
72 |
+
</li>
|
73 |
<?php $a++; } ?>
|
74 |
</ul>
|
75 |
</div>
|
78 |
|
79 |
<div class="tracking_details_by_date">
|
80 |
|
81 |
+
<?php if ( !empty( $trackind_destination_detail_by_status_rev ) ) { ?>
|
82 |
+
<h4 class="" style=""><?php esc_html_e( 'Origin Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
83 |
<?php } ?>
|
84 |
|
85 |
<ul class="timeline new-details">
|
86 |
+
<?php
|
87 |
+
$a = 1;
|
88 |
+
foreach ( $trackind_detail_by_status_rev as $key => $value ) {
|
89 |
+
if ( $a > 2) {
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
$date = gmdate( 'Y-m-d', strtotime( $value->datetime ) );
|
93 |
+
?>
|
94 |
+
<li>
|
95 |
+
<strong>
|
96 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
97 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
98 |
+
</strong>
|
99 |
+
<p>
|
100 |
+
<?php
|
101 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
102 |
+
if ( null != $value->tracking_location->city ) {
|
103 |
+
echo ' - ';
|
104 |
+
}
|
105 |
+
?>
|
106 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
107 |
+
</p>
|
108 |
</li>
|
109 |
<?php $a++; } ?>
|
110 |
</ul>
|
111 |
|
112 |
<ul class="timeline old-details" style="display:none;">
|
113 |
<?php
|
114 |
+
$a = 1;
|
115 |
+
foreach ( $trackind_detail_by_status_rev as $key => $value ) {
|
116 |
+
if ( $a <= 2 ) {
|
117 |
+
$a++;
|
118 |
+
continue;
|
119 |
+
}
|
120 |
+
$date = gmdate( 'Y-m-d', strtotime( $value->datetime ) );
|
121 |
+
?>
|
122 |
+
<li>
|
123 |
+
<strong>
|
124 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
125 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
126 |
+
</strong>
|
127 |
+
<p>
|
128 |
+
<?php
|
129 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
130 |
+
if ( null != $value->tracking_location->city ) {
|
131 |
+
echo ' - ';
|
132 |
+
}
|
133 |
+
?>
|
134 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
135 |
+
</p>
|
136 |
+
</li>
|
137 |
<?php $a++; } ?>
|
138 |
</ul>
|
139 |
|
140 |
</div>
|
141 |
|
142 |
+
<a class="view_old_details" href="javaScript:void(0);" style="display: inline;"><?php esc_html_e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
|
143 |
+
<a class="hide_old_details" href="javaScript:void(0);" style="display: none;"><?php esc_html_e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
|
144 |
+
<?php
|
145 |
+
}
|
146 |
+
} else {
|
147 |
|
148 |
+
if ( !empty( $tracking_details_by_date ) ) {
|
149 |
+
?>
|
|
|
150 |
|
151 |
<div class="shipment_progress_heading_div">
|
152 |
+
<h4 class="h4-heading text-uppercase"><?php esc_html_e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
153 |
</div>
|
154 |
|
155 |
+
<?php if ( !empty( $trackind_destination_detail_by_status_rev ) ) { ?>
|
156 |
|
157 |
<div class="tracking_destination_details_by_date">
|
158 |
|
159 |
+
<h4 style=""><?php esc_html_e( 'Destination Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
160 |
<ul class="timeline">
|
161 |
|
162 |
+
<?php
|
163 |
+
foreach ( $trackind_destination_detail_by_status_rev as $key => $value ) {
|
164 |
+
$date = gmdate('Y-m-d', strtotime($value->datetime));
|
165 |
+
?>
|
166 |
+
<li>
|
167 |
+
<strong>
|
168 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
169 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
170 |
+
</strong>
|
171 |
+
<p>
|
172 |
+
<?php
|
173 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
174 |
+
if ( null != $value->tracking_location->city ) {
|
175 |
+
echo ' - ';
|
176 |
+
}
|
177 |
+
?>
|
178 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
179 |
+
</p>
|
180 |
+
</li>
|
181 |
+
<?php } ?>
|
182 |
|
183 |
</ul>
|
184 |
</div>
|
187 |
|
188 |
<div class="tracking_details_by_date">
|
189 |
|
190 |
+
<?php if ( !empty( $trackind_destination_detail_by_status_rev ) ) { ?>
|
191 |
+
<h4 class="" style=""><?php esc_html_e( 'Origin Details', 'woo-advanced-shipment-tracking' ); ?></h4>
|
192 |
<?php } ?>
|
193 |
|
194 |
<ul class="timeline">
|
195 |
+
<?php
|
196 |
+
foreach ( $trackind_detail_by_status_rev as $key => $value ) {
|
197 |
+
$date = gmdate( 'Y-m-d', strtotime( $value->datetime ) );
|
198 |
+
?>
|
199 |
+
<li>
|
200 |
+
<strong>
|
201 |
+
<?php esc_html_e( date_i18n( get_option( 'date_format' ), strtotime($date) ) ); ?>
|
202 |
+
<?php esc_html_e( date_i18n( get_option( 'time_format' ), strtotime($value->datetime) ) ); ?>
|
203 |
+
</strong>
|
204 |
+
<p>
|
205 |
+
<?php
|
206 |
+
esc_html_e( apply_filters( 'trackship_tracking_event_description', $value->message ) );
|
207 |
+
if ( null != $value->tracking_location->city ) {
|
208 |
+
echo ' - ';
|
209 |
+
}
|
210 |
+
?>
|
211 |
+
<span><?php esc_html_e( apply_filters( 'trackship_tracking_event_location', $value->tracking_location->city ) ); ?></span>
|
212 |
+
</p>
|
213 |
+
</li>
|
214 |
<?php } ?>
|
215 |
</ul>
|
216 |
</div>
|
217 |
+
<?php } } ?>
|
218 |
+
</div>
|
|
includes/views/front/preview_tracking_page.php
CHANGED
@@ -7,24 +7,23 @@
|
|
7 |
margin: 50px auto 100px;
|
8 |
}
|
9 |
.customize-partial-edit-shortcut-button {display: none;}
|
10 |
-
<?php
|
11 |
-
if($border_color){ ?>
|
12 |
.col.tracking-detail{
|
13 |
-
border: 1px solid <?php
|
14 |
}
|
15 |
body .col.tracking-detail .shipment-header{
|
16 |
-
border-bottom: 1px solid <?php
|
17 |
}
|
18 |
body .col.tracking-detail .trackship_branding{
|
19 |
-
border-top: 1px solid <?php
|
20 |
}
|
21 |
<?php } ?>
|
22 |
-
<?php if($background_color){ ?>
|
23 |
body .col.tracking-detail{
|
24 |
-
background: <?php
|
25 |
}
|
26 |
-
<?php }
|
27 |
-
<?php if( $hide_tracking_provider_image ) { ?>
|
28 |
.provider_image_div{display:none;}
|
29 |
<?php } ?>
|
30 |
<?php if ( $wc_ast_link_to_shipping_provider ) { ?>
|
@@ -37,22 +36,22 @@
|
|
37 |
<div class="tracking-detail col">
|
38 |
|
39 |
<div class="shipment-header">
|
40 |
-
<p class="shipment_heading"><?php
|
41 |
-
<span><?php
|
42 |
</div>
|
43 |
|
44 |
<div class="tracking-header">
|
45 |
|
46 |
<div class="provider_image_div" style="">
|
47 |
-
<img class="provider_image" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/usps.png?v=3.1.1">
|
48 |
</div>
|
49 |
|
50 |
<div class="tracking_number_div">
|
51 |
<ul>
|
52 |
<li>
|
53 |
USPS:
|
54 |
-
|
55 |
-
|
56 |
</li>
|
57 |
</ul>
|
58 |
</div>
|
@@ -63,18 +62,18 @@
|
|
63 |
</div>
|
64 |
|
65 |
|
66 |
-
<div class="tracker-progress-bar <?php
|
67 |
<div class="progress">
|
68 |
<div class="progress-bar out_for_delivery" style="width: 67%;"></div>
|
69 |
</div>
|
70 |
</div>
|
71 |
|
72 |
-
<div class="tracking-details" style="<?php
|
73 |
|
74 |
<div class="shipment_progress_heading_div">
|
75 |
<h4 class="h4-heading text-uppercase">Tracking Details</h4>
|
76 |
</div>
|
77 |
-
<?php if($hide_tracking_events
|
78 |
<div class="tracking_details_by_date">
|
79 |
<ul class="timeline">
|
80 |
<li>
|
@@ -99,7 +98,7 @@
|
|
99 |
</li>
|
100 |
</ul>
|
101 |
</div>
|
102 |
-
<?php } elseif(
|
103 |
<div class="tracking_details_by_date">
|
104 |
<ul class="timeline new-details">
|
105 |
<li>
|
@@ -126,12 +125,12 @@
|
|
126 |
</li>
|
127 |
</ul>
|
128 |
</div>
|
129 |
-
<a class="view_old_details" href="javaScript:void(0);" style="display: inline;"><?php
|
130 |
-
<a class="hide_old_details" href="javaScript:void(0);" style="display: none;"><?php
|
131 |
<?php } ?>
|
132 |
|
133 |
</div>
|
134 |
<div class="trackship_branding" style="">
|
135 |
-
<p>Shipment Tracking info by <a href="https://trackship.info" title="TrackShip" target="blank"><img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/trackship-logo.png"></a></p>
|
136 |
</div>
|
137 |
-
</div>
|
7 |
margin: 50px auto 100px;
|
8 |
}
|
9 |
.customize-partial-edit-shortcut-button {display: none;}
|
10 |
+
<?php if ( $border_color ) { ?>
|
|
|
11 |
.col.tracking-detail{
|
12 |
+
border: 1px solid <?php esc_html_e( $border_color ); ?>;
|
13 |
}
|
14 |
body .col.tracking-detail .shipment-header{
|
15 |
+
border-bottom: 1px solid <?php esc_html_e( $border_color ); ?>;
|
16 |
}
|
17 |
body .col.tracking-detail .trackship_branding{
|
18 |
+
border-top: 1px solid <?php esc_html_e( $border_color ); ?>;
|
19 |
}
|
20 |
<?php } ?>
|
21 |
+
<?php if ( $background_color ) { ?>
|
22 |
body .col.tracking-detail{
|
23 |
+
background: <?php esc_html_e( $background_color ); ?>;
|
24 |
}
|
25 |
+
<?php } ?>
|
26 |
+
<?php if ( $hide_tracking_provider_image ) { ?>
|
27 |
.provider_image_div{display:none;}
|
28 |
<?php } ?>
|
29 |
<?php if ( $wc_ast_link_to_shipping_provider ) { ?>
|
36 |
<div class="tracking-detail col">
|
37 |
|
38 |
<div class="shipment-header">
|
39 |
+
<p class="shipment_heading"><?php esc_html_e( 'Shipment', 'woo-advanced-shipment-tracking' ); ?></p>
|
40 |
+
<span><?php esc_html_e( 'Order', 'woocommerce' ); ?> <strong>#14696 </strong></span>
|
41 |
</div>
|
42 |
|
43 |
<div class="tracking-header">
|
44 |
|
45 |
<div class="provider_image_div" style="">
|
46 |
+
<img class="provider_image" src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/usps.png?v=3.1.1">
|
47 |
</div>
|
48 |
|
49 |
<div class="tracking_number_div">
|
50 |
<ul>
|
51 |
<li>
|
52 |
USPS:
|
53 |
+
<a href="https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=9410803699300126968507" target="blank"><strong>9410803699300126968507</strong></a>
|
54 |
+
<strong>9410803699300126968507</strong>
|
55 |
</li>
|
56 |
</ul>
|
57 |
</div>
|
62 |
</div>
|
63 |
|
64 |
|
65 |
+
<div class="tracker-progress-bar <?php esc_html_e( ( 't_layout_1' == $tracking_page_layout ) ? 'tracking_layout_1' : '' ); ?>">
|
66 |
<div class="progress">
|
67 |
<div class="progress-bar out_for_delivery" style="width: 67%;"></div>
|
68 |
</div>
|
69 |
</div>
|
70 |
|
71 |
+
<div class="tracking-details" style="<?php esc_html_e( ( 1 == $hide_tracking_events ) ? 'display:none' : '' ); ?>">
|
72 |
|
73 |
<div class="shipment_progress_heading_div">
|
74 |
<h4 class="h4-heading text-uppercase">Tracking Details</h4>
|
75 |
</div>
|
76 |
+
<?php if ( 0 == $hide_tracking_events ) { ?>
|
77 |
<div class="tracking_details_by_date">
|
78 |
<ul class="timeline">
|
79 |
<li>
|
98 |
</li>
|
99 |
</ul>
|
100 |
</div>
|
101 |
+
<?php } elseif ( 2 == $hide_tracking_events ) { ?>
|
102 |
<div class="tracking_details_by_date">
|
103 |
<ul class="timeline new-details">
|
104 |
<li>
|
125 |
</li>
|
126 |
</ul>
|
127 |
</div>
|
128 |
+
<a class="view_old_details" href="javaScript:void(0);" style="display: inline;"><?php esc_html_e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
|
129 |
+
<a class="hide_old_details" href="javaScript:void(0);" style="display: none;"><?php esc_html_e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
|
130 |
<?php } ?>
|
131 |
|
132 |
</div>
|
133 |
<div class="trackship_branding" style="">
|
134 |
+
<p>Shipment Tracking info by <a href="https://trackship.info" title="TrackShip" target="blank"><img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/trackship-logo.png"></a></p>
|
135 |
</div>
|
136 |
+
</div>
|
includes/views/front/tracking_page_header.php
CHANGED
@@ -1,30 +1,32 @@
|
|
1 |
<div class="tracking-header">
|
2 |
-
<?php
|
3 |
-
<div class="provider_image_div" style="<?php
|
4 |
-
<img class="provider_image" src="<?php
|
5 |
</div>
|
6 |
<div class="tracking_number_div">
|
7 |
<ul>
|
8 |
<li>
|
9 |
-
<?php
|
10 |
-
<?php if (
|
11 |
-
<a href="<?php
|
12 |
-
<?php } else{ ?>
|
13 |
-
<strong><?php
|
14 |
<?php } ?>
|
15 |
</li>
|
16 |
</ul>
|
17 |
</div>
|
18 |
-
<h1 class="shipment_status_heading <?php
|
19 |
-
<?php
|
20 |
</h1>
|
21 |
<span class="est_delivery_date">
|
22 |
-
<?php
|
23 |
<?php
|
24 |
-
if($tracker->est_delivery_date){
|
25 |
-
echo date_i18n( 'l, M d', strtotime( $tracker->est_delivery_date ) );
|
26 |
-
} else{
|
27 |
echo 'N/A';
|
28 |
-
}
|
|
|
|
|
29 |
</span>
|
30 |
</div>
|
1 |
<div class="tracking-header">
|
2 |
+
<?php do_action( 'trackship_tracking_header_before', $order_id, $tracker, $item['formatted_tracking_provider'], $item['tracking_number'] ); ?>
|
3 |
+
<div class="provider_image_div" style="<?php esc_html_e( ( 1 == $hide_tracking_provider_image ) ? 'display:none' : '' ); ?>">
|
4 |
+
<img class="provider_image" src="<?php esc_html_e( $item['tracking_provider_image'] ); ?>">
|
5 |
</div>
|
6 |
<div class="tracking_number_div">
|
7 |
<ul>
|
8 |
<li>
|
9 |
+
<?php esc_html_e( apply_filters( 'ast_provider_title', esc_html( $item['formatted_tracking_provider'] ) ) ); ?>:</span>
|
10 |
+
<?php if ( 1 == $wc_ast_link_to_shipping_provider ) { ?>
|
11 |
+
<a href="<?php esc_html_e( $item['formatted_tracking_link'] ); ?>" target="blank"><strong><?php esc_html_e( $item['tracking_number'] ); ?></strong></a>
|
12 |
+
<?php } else { ?>
|
13 |
+
<strong><?php esc_html_e( $item['tracking_number'] ); ?></strong>
|
14 |
<?php } ?>
|
15 |
</li>
|
16 |
</ul>
|
17 |
</div>
|
18 |
+
<h1 class="shipment_status_heading <?php esc_html_e( $tracker->ep_status ); ?>">
|
19 |
+
<?php esc_html_e( apply_filters( 'trackship_status_filter', $tracker->ep_status ) ); ?>
|
20 |
</h1>
|
21 |
<span class="est_delivery_date">
|
22 |
+
<?php esc_html_e( 'Est. Delivery Date', 'woo-advanced-shipment-tracking' ); ?>: <strong>
|
23 |
<?php
|
24 |
+
if ( $tracker->est_delivery_date ) {
|
25 |
+
echo esc_html( date_i18n( 'l, M d', strtotime( $tracker->est_delivery_date ) ) );
|
26 |
+
} else {
|
27 |
echo 'N/A';
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
</strong>
|
31 |
</span>
|
32 |
</div>
|
includes/views/integrations_admin_options.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<section id="integrations_content" class="tab_section">
|
2 |
+
|
3 |
+
<h1 class="tab_section_heading clear_spacing"><?php esc_html_e( 'Integrations', 'woo-advanced-shipment-tracking' ); ?></h1>
|
4 |
+
<p><?php esc_html_e( 'Enable integrations with shipping services and plugins', 'woo-advanced-shipment-tracking' ); ?></p>
|
5 |
+
<div class="integration-grid-row">
|
6 |
+
<?php
|
7 |
+
foreach ( $this->integrations_settings_options() as $id => $array ) {
|
8 |
+
$tgl_class = isset( $array['tgl_color'] ) ? 'ast-tgl-btn-green' : '';
|
9 |
+
$disabled = isset( $array['disabled'] ) && true == $array['disabled'] ? 'disabled' : '';
|
10 |
+
?>
|
11 |
+
<div class="grid-item">
|
12 |
+
<div class="grid-item-wrapper">
|
13 |
+
<img src="<?php echo esc_url( wc_advanced_shipment_tracking()->plugin_dir_url() ); ?>assets/images/<?php esc_html_e( $array['img'] ); ?>"">
|
14 |
+
<div class="grid-img-bottom">
|
15 |
+
<span class="ast-tgl-btn-parent">
|
16 |
+
<input type="hidden" name="<?php esc_html_e( $id ); ?>" value="0"/>
|
17 |
+
<input class="ast-tgl ast-tgl-flat ast-settings-toggle" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $id ); ?>" type="checkbox" value="1" <?php esc_html_e( $disabled ); ?>/>
|
18 |
+
<label class="ast-tgl-btn <?php esc_html_e( $tgl_class ); ?> upgrade_to_ast_pro" for="<?php esc_html_e( $id ); ?>"></label>
|
19 |
+
</span>
|
20 |
+
<a class="integration-more-info" href="https://www.zorem.com/docs/ast-pro/integrations/" target="blank"><?php esc_html_e( 'more info', 'woo-advanced-shipment-tracking' ); ?></a>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
<?php } ?>
|
25 |
+
</div>
|
26 |
+
</section>
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: zorem
|
3 |
Tags: WooCommerce, delivery, shipping, shipment tracking, tracking
|
4 |
Requires at least: 5.3
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 7.0
|
7 |
Stable tag: 4.0.1
|
8 |
License: GPLv2
|
@@ -112,6 +112,11 @@ Yes, if you use external shipping services that work with the WooCommerce REST A
|
|
112 |
|
113 |
== Changelog ==
|
114 |
|
|
|
|
|
|
|
|
|
|
|
115 |
= 3.2.5 =
|
116 |
* Dev - Added condition for standalone pro version
|
117 |
* Enhancement - Updated settings page design
|
2 |
Contributors: zorem
|
3 |
Tags: WooCommerce, delivery, shipping, shipment tracking, tracking
|
4 |
Requires at least: 5.3
|
5 |
+
Tested up to: 5.8
|
6 |
Requires PHP: 7.0
|
7 |
Stable tag: 4.0.1
|
8 |
License: GPLv2
|
112 |
|
113 |
== Changelog ==
|
114 |
|
115 |
+
= 3.2.6 =
|
116 |
+
* Fix - Fixed shipping provider search issue in Shipping provider settings page
|
117 |
+
* Dev - Improve code quality and security
|
118 |
+
* Enhancement - Added go pro lightbox in shipping provider page and integration page
|
119 |
+
|
120 |
= 3.2.5 =
|
121 |
* Dev - Added condition for standalone pro version
|
122 |
* Enhancement - Updated settings page design
|
templates/emails/customer-partial-shipped-order.php
CHANGED
@@ -19,9 +19,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
exit;
|
20 |
}
|
21 |
$ps_settings = new wcast_partial_shipped_customizer_email();
|
22 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
23 |
|
24 |
-
$email_content = $ast->get_option_value_from_array('woocommerce_customer_partial_shipped_order_settings','wcast_partial_shipped_email_content'
|
25 |
$email_content = wc_advanced_shipment_tracking_email_class()->email_content( $email_content, $order->get_id(), $order );
|
26 |
|
27 |
/*
|
@@ -30,7 +30,7 @@ $email_content = wc_advanced_shipment_tracking_email_class()->email_content( $em
|
|
30 |
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
31 |
|
32 |
<?php /* translators: %s: Site title */ ?>
|
33 |
-
<p class="partial_email_content"><?php echo $email_content; ?></p>
|
34 |
<?php
|
35 |
|
36 |
/*
|
19 |
exit;
|
20 |
}
|
21 |
$ps_settings = new wcast_partial_shipped_customizer_email();
|
22 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
23 |
|
24 |
+
$email_content = $ast->get_option_value_from_array( 'woocommerce_customer_partial_shipped_order_settings', 'wcast_partial_shipped_email_content', $ps_settings->defaults['wcast_partial_shipped_email_content'] );
|
25 |
$email_content = wc_advanced_shipment_tracking_email_class()->email_content( $email_content, $order->get_id(), $order );
|
26 |
|
27 |
/*
|
30 |
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
31 |
|
32 |
<?php /* translators: %s: Site title */ ?>
|
33 |
+
<p class="partial_email_content"><?php echo wp_kses_post( $email_content ); ?></p>
|
34 |
<?php
|
35 |
|
36 |
/*
|
templates/emails/customer-updated-tracking-order.php
CHANGED
@@ -19,9 +19,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
exit;
|
20 |
}
|
21 |
$ut_settings = new wcast_updated_tracking_customizer_email();
|
22 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
23 |
|
24 |
-
$email_content = $ast->get_option_value_from_array('woocommerce_customer_updated_tracking_order_settings','wcast_updated_tracking_email_content'
|
25 |
$email_content = wc_advanced_shipment_tracking_email_class()->email_content( $email_content, $order->get_id(), $order );
|
26 |
|
27 |
/*
|
@@ -30,7 +30,7 @@ $email_content = wc_advanced_shipment_tracking_email_class()->email_content( $em
|
|
30 |
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
31 |
|
32 |
<?php /* translators: %s: Site title */ ?>
|
33 |
-
<p class="partial_email_content"><?php echo $email_content; ?></p>
|
34 |
<?php
|
35 |
|
36 |
/*
|
19 |
exit;
|
20 |
}
|
21 |
$ut_settings = new wcast_updated_tracking_customizer_email();
|
22 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
23 |
|
24 |
+
$email_content = $ast->get_option_value_from_array( 'woocommerce_customer_updated_tracking_order_settings', 'wcast_updated_tracking_email_content', $ut_settings->defaults['wcast_updated_tracking_email_content'] );
|
25 |
$email_content = wc_advanced_shipment_tracking_email_class()->email_content( $email_content, $order->get_id(), $order );
|
26 |
|
27 |
/*
|
30 |
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
31 |
|
32 |
<?php /* translators: %s: Site title */ ?>
|
33 |
+
<p class="partial_email_content"><?php echo wp_kses_post( $email_content ); ?></p>
|
34 |
<?php
|
35 |
|
36 |
/*
|
templates/emails/plain/tracking-info.php
CHANGED
@@ -6,16 +6,16 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
6 |
if ( $tracking_items ) {
|
7 |
|
8 |
$wcast_customizer_settings = new wcast_initialise_customizer_settings();
|
9 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
10 |
$tracking_info_settings = get_option('tracking_info_settings');
|
11 |
|
12 |
-
if($tracking_info_settings['header_text_change']){
|
13 |
$shipment_tracking_header = $tracking_info_settings['header_text_change'];
|
14 |
-
} else{
|
15 |
-
$shipment_tracking_header =
|
16 |
}
|
17 |
|
18 |
-
if($tracking_info_settings['additional_header_text']){
|
19 |
$shipment_tracking_header_text = $tracking_info_settings['additional_header_text'];
|
20 |
}
|
21 |
|
@@ -25,21 +25,22 @@ if ( $tracking_items ) {
|
|
25 |
|
26 |
$track_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'track_header_text', $wcast_customizer_settings->defaults['track_header_text'] );
|
27 |
|
28 |
-
echo strtoupper( apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ) ) .
|
29 |
|
30 |
if ( isset( $shipment_tracking_header_text ) ) {
|
31 |
-
echo $shipment_tracking_header_text .
|
32 |
}
|
33 |
|
34 |
if ( isset( $new_status ) ) {
|
35 |
-
|
|
|
36 |
}
|
37 |
|
38 |
foreach ( $tracking_items as $tracking_item ) {
|
39 |
-
echo
|
40 |
-
echo
|
41 |
-
echo
|
42 |
}
|
43 |
|
44 |
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
45 |
-
}
|
6 |
if ( $tracking_items ) {
|
7 |
|
8 |
$wcast_customizer_settings = new wcast_initialise_customizer_settings();
|
9 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
10 |
$tracking_info_settings = get_option('tracking_info_settings');
|
11 |
|
12 |
+
if ( $tracking_info_settings['header_text_change'] ) {
|
13 |
$shipment_tracking_header = $tracking_info_settings['header_text_change'];
|
14 |
+
} else {
|
15 |
+
$shipment_tracking_header = 'Tracking Information';
|
16 |
}
|
17 |
|
18 |
+
if ( $tracking_info_settings['additional_header_text'] ) {
|
19 |
$shipment_tracking_header_text = $tracking_info_settings['additional_header_text'];
|
20 |
}
|
21 |
|
25 |
|
26 |
$track_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'track_header_text', $wcast_customizer_settings->defaults['track_header_text'] );
|
27 |
|
28 |
+
echo esc_html( strtoupper( apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ) ) ) . '\n\n';
|
29 |
|
30 |
if ( isset( $shipment_tracking_header_text ) ) {
|
31 |
+
echo esc_html( $shipment_tracking_header_text ) . '\n\n';
|
32 |
}
|
33 |
|
34 |
if ( isset( $new_status ) ) {
|
35 |
+
/* translators: %s: replace with status */
|
36 |
+
echo sprintf( esc_html__( 'Shipment status changed to %s', 'woo-advanced-shipment-tracking' ), esc_html( apply_filters( 'trackship_status_filter', $new_status ) ) ) . '\n\n';
|
37 |
}
|
38 |
|
39 |
foreach ( $tracking_items as $tracking_item ) {
|
40 |
+
echo esc_html__( $provider_header_text, 'woo-advanced-shipment-tracking' ) . ': ' . esc_html( apply_filters( 'ast_provider_title', esc_html( $tracking_item['formatted_tracking_provider'] ) ) ) . '\n';
|
41 |
+
echo esc_html__( $tracking_number_header_text, 'woo-advanced-shipment-tracking' ) . ': ' . esc_html( $tracking_item['tracking_number'] ) . '\n';
|
42 |
+
echo esc_html__( $track_header_text, 'woo-advanced-shipment-tracking' ) . ': ' . esc_url( $tracking_item['ast_tracking_link'] ) . '\n\n';
|
43 |
}
|
44 |
|
45 |
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
46 |
+
}
|
templates/emails/tracking-info.php
CHANGED
@@ -7,206 +7,224 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
7 |
* Shipment Tracking
|
8 |
*
|
9 |
* Shows tracking information in the HTML order email
|
10 |
-
*
|
11 |
-
* @author WooThemes
|
12 |
-
* @package WooCommerce Shipment Tracking/templates/email
|
13 |
-
* @version 1.6.4
|
14 |
*/
|
15 |
if ( $tracking_items ) :
|
16 |
$settings = new wcast_initialise_customizer_settings();
|
17 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
18 |
|
19 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
20 |
|
21 |
$show_provider_th = 1;
|
22 |
$colspan = 1;
|
23 |
|
24 |
-
$display_thumbnail = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_image'
|
25 |
-
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_name'
|
26 |
-
$tracking_number_link = $ast->get_checkbox_option_value_from_array('tracking_info_settings','tracking_number_link','');
|
27 |
|
28 |
-
if($display_shipping_provider_name
|
29 |
$show_provider_th = 1;
|
30 |
$colspan = 2;
|
31 |
-
} else if($display_shipping_provider_name
|
32 |
$show_provider_th = 1;
|
33 |
$colspan = 1;
|
34 |
-
} else if($display_shipping_provider_name
|
35 |
$show_provider_th = 1;
|
36 |
$colspan = 1;
|
37 |
-
} else if($display_shipping_provider_name
|
38 |
$show_provider_th = 0;
|
39 |
$colspan = 1;
|
40 |
-
} else{
|
41 |
$show_provider_th = 0;
|
42 |
}
|
43 |
|
44 |
-
if(is_rtl()){
|
45 |
$header_content_text_align = 'right';
|
46 |
-
} else{
|
47 |
-
$header_content_text_align = $ast->get_option_value_from_array('tracking_info_settings','header_content_text_align'
|
48 |
}
|
49 |
|
50 |
$table_padding = 10;
|
51 |
|
52 |
-
$email_border_color = $ast->get_option_value_from_array('tracking_info_settings','table_border_color'
|
53 |
-
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size'
|
54 |
-
$hide_trackig_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
55 |
-
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
56 |
-
$shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
|
57 |
-
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color'
|
58 |
-
$table_content_line_height = $ast->get_option_value_from_array('tracking_info_settings','table_content_line_height'
|
59 |
-
$table_content_font_weight = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_weight'
|
60 |
-
$table_header_bg_color = $ast->get_option_value_from_array('tracking_info_settings','table_header_bg_color'
|
61 |
-
$table_header_font_size = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_size'
|
62 |
-
$table_header_font_weight = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_weight'
|
63 |
-
$table_header_font_color = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_color'
|
64 |
-
$table_content_font_size = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_size'
|
65 |
-
$table_content_font_color = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_color'
|
66 |
-
$tracking_link_font_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_font_color'
|
67 |
-
$tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color'
|
68 |
-
$hide_table_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_table_header','');
|
69 |
-
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array('tracking_info_settings','remove_date_from_tracking'
|
70 |
-
$show_track_label = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_track_label'
|
71 |
-
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text'
|
72 |
-
$tracking_number_header_text = $ast->get_option_value_from_array('tracking_info_settings','tracking_number_header_text'
|
73 |
-
$shipped_date_header_text = $ast->get_option_value_from_array('tracking_info_settings','shipped_date_header_text'
|
74 |
-
$track_header_text = $ast->get_option_value_from_array('tracking_info_settings','track_header_text'
|
75 |
-
$simple_layout_content = $ast->get_option_value_from_array('tracking_info_settings','simple_layout_content'
|
76 |
-
$simple_provider_font_size = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_size'
|
77 |
-
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color'
|
78 |
-
$show_provider_border = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_provider_border'
|
79 |
-
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color'
|
80 |
|
81 |
-
$
|
82 |
|
83 |
$text_align = is_rtl() ? 'right' : 'left';
|
84 |
|
85 |
-
$th_column_style =
|
86 |
-
$td_column_style =
|
87 |
-
$tracking_link_style =
|
88 |
-
$tracking_link_style2 =
|
89 |
|
90 |
-
$shipment_status = get_post_meta( $order_id,
|
91 |
|
92 |
-
if( $
|
93 |
-
|
94 |
-
|
|
|
95 |
</h2>
|
96 |
-
<?php } else{ ?>
|
97 |
-
<h2 class="header_text" style="text-align:<?php
|
98 |
-
<?php
|
99 |
</h2>
|
100 |
<?php } ?>
|
101 |
|
102 |
-
<p class="addition_header"><?php
|
103 |
|
104 |
-
<?php if(
|
105 |
<div class="tracking_info">
|
106 |
<ul class="tracking_list">
|
107 |
-
<?php
|
|
|
108 |
|
109 |
-
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] :
|
110 |
|
111 |
-
$simple_layout_content_updated = '';
|
|
|
112 |
|
113 |
<li class="tracking_list_li">
|
114 |
-
<div class="tracking_list_div" style="font-size:<?php
|
115 |
<?php
|
116 |
-
$formatted_tracking_provider = apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ));
|
117 |
-
$simple_layout_content_updated = str_replace('{ship_date}',date_i18n( get_option( 'date_format' ), $date_shipped )
|
118 |
-
$simple_layout_content_updated = str_replace('{shipping_provider}'
|
119 |
-
$tracking_number_link = '<a target="_blank" href="'.esc_url( $tracking_item['ast_tracking_link'] ).'">'
|
120 |
-
$simple_layout_content_updated = str_replace('{tracking_number_link}'
|
121 |
-
echo $simple_layout_content_updated;
|
|
|
122 |
</div>
|
123 |
-
<?php do_action(
|
124 |
</li>
|
125 |
<?php } ?>
|
126 |
</ul>
|
127 |
</div>
|
128 |
-
<?php } else if(
|
129 |
-
<table class="td tracking_table" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;background:<?php
|
130 |
-
<?php if( $
|
131 |
-
<thead class="<?php
|
132 |
<tr>
|
133 |
-
<?php if( $show_provider_th ){ ?>
|
134 |
-
<th class="tracking-provider" colspan="<?php
|
135 |
-
<?php
|
136 |
</th>
|
137 |
-
<?php
|
|
|
138 |
|
139 |
-
do_action(
|
|
|
140 |
|
141 |
-
<th class="tracking-number" scope="col" class="td" style="<?php
|
142 |
-
<?php if( $
|
143 |
-
<th class="date-shipped <?php
|
144 |
-
<?php
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
-
if( !$tracking_number_link ){
|
151 |
-
if( $
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
157 |
</tr>
|
158 |
</thead>
|
159 |
-
<?php } else{ ?>
|
160 |
-
<thead style="<?php
|
161 |
<tr>
|
162 |
-
<?php if( $show_provider_th ){ ?>
|
163 |
-
<th class="tracking-provider" colspan="<?php
|
164 |
<?php esc_html_e( $provider_header_text, 'woo-advanced-shipment-tracking' ); ?>
|
165 |
</th>
|
166 |
-
<?php
|
|
|
167 |
|
168 |
-
do_action(
|
|
|
169 |
|
170 |
-
<th class="tracking-number" scope="col" class="td" style="<?php
|
171 |
-
<?php if( $
|
172 |
-
<th class="date-shipped <?php
|
173 |
-
<?php
|
174 |
-
|
175 |
-
|
176 |
-
|
|
|
|
|
|
|
177 |
}
|
178 |
|
179 |
-
if( !$tracking_number_link ){
|
180 |
-
if( $
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
186 |
</tr>
|
187 |
</thead>
|
188 |
<?php } ?>
|
189 |
|
190 |
-
<tbody style="line-height:<?php
|
|
|
191 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
<tr class="tracking" style="background-color:<?php
|
196 |
|
197 |
-
<?php if($display_thumbnail
|
198 |
-
<td class="tracking-provider" data-title="<?php
|
199 |
<img style="width: 50px;vertical-align: middle;" src="<?php echo esc_url( $tracking_item['tracking_provider_image'] ); ?>">
|
200 |
</td>
|
201 |
<?php } ?>
|
202 |
|
203 |
-
<?php if($display_shipping_provider_name
|
204 |
-
<td class="tracking-provider" data-title="<?php
|
205 |
<?php
|
206 |
-
if ( $tracking_item[ 'formatted_tracking_provider' ]
|
207 |
-
|
208 |
} else {
|
209 |
-
|
210 |
}
|
211 |
?>
|
212 |
</td>
|
@@ -214,40 +232,52 @@ if ( $tracking_items ) :
|
|
214 |
|
215 |
<?php do_action( 'ast_tracking_email_body', $order_id, $tracking_item, $td_column_style ); ?>
|
216 |
|
217 |
-
<td class="tracking-number" data-title="<?php
|
218 |
-
<?php if($tracking_item['ast_tracking_link'] && $tracking_number_link){ ?>
|
219 |
-
|
220 |
-
<?php
|
|
|
221 |
echo esc_html( $tracking_item['tracking_number'] );
|
222 |
-
}
|
|
|
223 |
</td>
|
224 |
|
225 |
-
<?php if($
|
226 |
-
<td class="date-shipped <?php
|
227 |
-
<time datetime="<?php
|
228 |
</td>
|
229 |
-
<?php
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
233 |
</td>
|
234 |
-
<?php
|
|
|
235 |
}
|
236 |
|
237 |
-
if( !$tracking_number_link ){
|
238 |
-
|
239 |
-
|
240 |
-
|
|
|
241 |
<?php } ?>
|
242 |
</td>
|
243 |
<?php } ?>
|
244 |
-
</tr
|
245 |
-
|
|
|
|
|
246 |
</tbody>
|
247 |
</table><br/>
|
248 |
-
<?php
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
251 |
|
252 |
<style>
|
253 |
ul.tracking_list{
|
@@ -265,4 +295,4 @@ if ( $tracking_items ) :
|
|
265 |
}
|
266 |
</style>
|
267 |
<?php
|
268 |
-
endif;
|
7 |
* Shipment Tracking
|
8 |
*
|
9 |
* Shows tracking information in the HTML order email
|
10 |
+
*
|
|
|
|
|
|
|
11 |
*/
|
12 |
if ( $tracking_items ) :
|
13 |
$settings = new wcast_initialise_customizer_settings();
|
14 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
15 |
|
16 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $settings->defaults['select_tracking_template'] );
|
17 |
|
18 |
$show_provider_th = 1;
|
19 |
$colspan = 1;
|
20 |
|
21 |
+
$display_thumbnail = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'display_shipment_provider_image', $settings->defaults['display_shipment_provider_image'] );
|
22 |
+
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'display_shipment_provider_name', $settings->defaults['display_shipment_provider_name'] );
|
23 |
+
$tracking_number_link = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'tracking_number_link', '' );
|
24 |
|
25 |
+
if ( 1 == $display_shipping_provider_name && 1 == $display_thumbnail ) {
|
26 |
$show_provider_th = 1;
|
27 |
$colspan = 2;
|
28 |
+
} else if ( 1 != $display_shipping_provider_name && 1 == $display_thumbnail ) {
|
29 |
$show_provider_th = 1;
|
30 |
$colspan = 1;
|
31 |
+
} else if ( 1 == $display_shipping_provider_name && 1 != $display_thumbnail ) {
|
32 |
$show_provider_th = 1;
|
33 |
$colspan = 1;
|
34 |
+
} else if ( 1 != $display_shipping_provider_name && 1 != $display_thumbnail ) {
|
35 |
$show_provider_th = 0;
|
36 |
$colspan = 1;
|
37 |
+
} else {
|
38 |
$show_provider_th = 0;
|
39 |
}
|
40 |
|
41 |
+
if ( is_rtl() ) {
|
42 |
$header_content_text_align = 'right';
|
43 |
+
} else {
|
44 |
+
$header_content_text_align = $ast->get_option_value_from_array( 'tracking_info_settings', 'header_content_text_align', $settings->defaults['header_content_text_align'] );
|
45 |
}
|
46 |
|
47 |
$table_padding = 10;
|
48 |
|
49 |
+
$email_border_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_border_color', $settings->defaults['table_border_color'] );
|
50 |
+
$email_border_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_border_size', $settings->defaults['table_border_size'] );
|
51 |
+
$hide_trackig_header = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'hide_trackig_header', '');
|
52 |
+
$shipment_tracking_header = $ast->get_option_value_from_array( 'tracking_info_settings', 'header_text_change', 'Tracking Information' );
|
53 |
+
$shipment_tracking_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'additional_header_text', '' );
|
54 |
+
$email_table_backgroud_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_bg_color', $settings->defaults['table_bg_color'] );
|
55 |
+
$table_content_line_height = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_line_height', $settings->defaults['table_content_line_height'] );
|
56 |
+
$table_content_font_weight = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_weight', $settings->defaults['table_content_font_weight'] );
|
57 |
+
$table_header_bg_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_bg_color', $settings->defaults['table_header_bg_color'] );
|
58 |
+
$table_header_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_size', $settings->defaults['table_header_font_size'] );
|
59 |
+
$table_header_font_weight = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_weight', $settings->defaults['table_header_font_weight'] );
|
60 |
+
$table_header_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_color', $settings->defaults['table_header_font_color'] );
|
61 |
+
$table_content_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_size', $settings->defaults['table_content_font_size'] );
|
62 |
+
$table_content_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_color', $settings->defaults['table_content_font_color'] );
|
63 |
+
$tracking_link_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_link_font_color', $settings->defaults['tracking_link_font_color'] );
|
64 |
+
$tracking_link_bg_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_link_bg_color', $settings->defaults['tracking_link_bg_color'] );
|
65 |
+
$hide_table_header = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'hide_table_header', '' );
|
66 |
+
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'remove_date_from_tracking', $settings->defaults['remove_date_from_tracking'] );
|
67 |
+
$show_track_label = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'show_track_label', $settings->defaults['show_track_label'] );
|
68 |
+
$provider_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'provider_header_text', $settings->defaults['provider_header_text'] );
|
69 |
+
$tracking_number_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_number_header_text', $settings->defaults['tracking_number_header_text'] );
|
70 |
+
$shipped_date_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'shipped_date_header_text', $settings->defaults['shipped_date_header_text'] );
|
71 |
+
$track_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'track_header_text', $settings->defaults['track_header_text'] );
|
72 |
+
$simple_layout_content = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_layout_content', $settings->defaults['simple_layout_content'] );
|
73 |
+
$simple_provider_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_provider_font_size', $settings->defaults['simple_provider_font_size'] );
|
74 |
+
$simple_provider_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_provider_font_color', $settings->defaults['simple_provider_font_color'] );
|
75 |
+
$show_provider_border = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'show_provider_border', $settings->defaults['show_provider_border'] );
|
76 |
+
$provider_border_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'provider_border_color', $settings->defaults['provider_border_color'] );
|
77 |
|
78 |
+
$email_preview = ( isset( $_REQUEST['wcast-tracking-preview'] ) && '1' === $_REQUEST['wcast-tracking-preview'] ) ? true : false;
|
79 |
|
80 |
$text_align = is_rtl() ? 'right' : 'left';
|
81 |
|
82 |
+
$th_column_style = 'background:' . $table_header_bg_color . ';text-align: ' . $header_content_text_align . '; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-size:' . $table_header_font_size . 'px;font-weight:' . $table_header_font_weight . '; color: ' . $table_header_font_color . ' ; border: ' . $email_border_size . 'px solid ' . $email_border_color . '; padding: ' . $table_padding . 'px;';
|
83 |
+
$td_column_style = 'text-align: ' . $header_content_text_align . '; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size:' . $table_content_font_size . 'px;font-weight:' . $table_content_font_weight . '; color: ' . $table_content_font_color . ' ; border: ' . $email_border_size . 'px solid ' . $email_border_color . '; padding: ' . $table_padding . 'px;min-width: auto;';
|
84 |
+
$tracking_link_style = 'color: ' . $tracking_link_font_color . ' ;background:' . $tracking_link_bg_color . ';padding: 10px;text-decoration: none;';
|
85 |
+
$tracking_link_style2 = 'color: ' . $tracking_link_font_color . ';padding: 10px;text-decoration: none;';
|
86 |
|
87 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
88 |
|
89 |
+
if ( $email_preview ) {
|
90 |
+
?>
|
91 |
+
<h2 class="header_text <?php esc_html_e( ( $hide_trackig_header ) ? 'hide' : '' ); ?>" style="text-align:<?php esc_html_e( $text_align ); ?>;">
|
92 |
+
<?php esc_html_e( apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ) ); ?>
|
93 |
</h2>
|
94 |
+
<?php } else { ?>
|
95 |
+
<h2 class="header_text" style="text-align:<?php esc_html_e( $text_align ); ?>;<?php esc_html_e( ( $hide_trackig_header ) ? 'display:none' : '' ); ?>">
|
96 |
+
<?php esc_html_e( apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ) ); ?>
|
97 |
</h2>
|
98 |
<?php } ?>
|
99 |
|
100 |
+
<p class="addition_header"><?php esc_html_e( $shipment_tracking_header_text ); ?></p>
|
101 |
|
102 |
+
<?php if ( 'simple_list' == $select_tracking_template ) { ?>
|
103 |
<div class="tracking_info">
|
104 |
<ul class="tracking_list">
|
105 |
+
<?php
|
106 |
+
foreach ( $tracking_items as $tracking_item ) {
|
107 |
|
108 |
+
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] : gmdate( 'Y-m-d' );
|
109 |
|
110 |
+
$simple_layout_content_updated = '';
|
111 |
+
?>
|
112 |
|
113 |
<li class="tracking_list_li">
|
114 |
+
<div class="tracking_list_div" style="font-size:<?php esc_html_e( $simple_provider_font_size ); ?>px;color:<?php esc_html_e( $simple_provider_font_color ); ?>;border-bottom:<?php esc_html_e( $show_provider_border ); ?>px solid <?php esc_html_e( $provider_border_color ); ?>">
|
115 |
<?php
|
116 |
+
$formatted_tracking_provider = apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ) );
|
117 |
+
$simple_layout_content_updated = str_replace( '{ship_date}', date_i18n( get_option( 'date_format' ), $date_shipped ), $simple_layout_content );
|
118 |
+
$simple_layout_content_updated = str_replace( '{shipping_provider}', $formatted_tracking_provider, $simple_layout_content_updated );
|
119 |
+
$tracking_number_link = '<a target="_blank" href="' . esc_url( $tracking_item['ast_tracking_link'] ) . '">' . $tracking_item['tracking_number'] . '</a>';
|
120 |
+
$simple_layout_content_updated = str_replace( '{tracking_number_link}', $tracking_number_link, $simple_layout_content_updated );
|
121 |
+
echo wp_kses_post( $simple_layout_content_updated );
|
122 |
+
?>
|
123 |
</div>
|
124 |
+
<?php do_action( 'ast_tracking_simple_list_email_body', $order_id, $tracking_item ); ?>
|
125 |
</li>
|
126 |
<?php } ?>
|
127 |
</ul>
|
128 |
</div>
|
129 |
+
<?php } else if ( 'default_table' == $select_tracking_template ) { ?>
|
130 |
+
<table class="td tracking_table" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;background:<?php esc_html_e( $email_table_backgroud_color ); ?>" border="1">
|
131 |
+
<?php if ( $email_preview ) { ?>
|
132 |
+
<thead class="<?php esc_html_e( ( $hide_table_header ) ? 'hide' : '' ); ?>">
|
133 |
<tr>
|
134 |
+
<?php if ( $show_provider_th ) { ?>
|
135 |
+
<th class="tracking-provider" colspan="<?php esc_html_e( $colspan ); ?>" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>">
|
136 |
+
<?php esc_html_e( $provider_header_text, 'woo-advanced-shipment-tracking' ); ?>
|
137 |
</th>
|
138 |
+
<?php
|
139 |
+
}
|
140 |
|
141 |
+
do_action( 'ast_tracking_email_header', $order_id, $th_column_style );
|
142 |
+
?>
|
143 |
|
144 |
+
<th class="tracking-number" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $tracking_number_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
145 |
+
<?php if ( $email_preview ) { ?>
|
146 |
+
<th class="date-shipped <?php esc_html_e( ( 1 == $remove_date_from_tracking_info ) ? 'hide' : '' ); ?>" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
147 |
+
<?php
|
148 |
+
} else {
|
149 |
+
if ( 1 != $remove_date_from_tracking_info ) {
|
150 |
+
?>
|
151 |
+
<th class="date-shipped" style="<?php esc_html_e( $th_column_style ); ?>"><span class="nobr"><?php esc_html_e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></span></th>
|
152 |
+
<?php
|
153 |
+
}
|
154 |
}
|
155 |
|
156 |
+
if ( !$tracking_number_link ) {
|
157 |
+
if ( $email_preview ) {
|
158 |
+
?>
|
159 |
+
<th class="order-actions" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><span class="track_label <?php esc_html_e( ( 1 != $show_track_label ) ? 'hide' : '' ); ?>"><?php esc_html_e( $track_header_text, 'woo-advanced-shipment-tracking' ); ?></span></th>
|
160 |
+
<?php } else { ?>
|
161 |
+
<th class="order-actions" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( ( 1 == $show_track_label ) ? __( $track_header_text, 'woo-advanced-shipment-tracking' ) : '' ); ?></th>
|
162 |
+
<?php
|
163 |
+
}
|
164 |
+
}
|
165 |
+
?>
|
166 |
</tr>
|
167 |
</thead>
|
168 |
+
<?php } else { ?>
|
169 |
+
<thead style="<?php esc_html_e( ( $hide_table_header ) ? 'display:none' : '' ); ?>">
|
170 |
<tr>
|
171 |
+
<?php if ( $show_provider_th ) { ?>
|
172 |
+
<th class="tracking-provider" colspan="<?php esc_html_e( $colspan ); ?>" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>">
|
173 |
<?php esc_html_e( $provider_header_text, 'woo-advanced-shipment-tracking' ); ?>
|
174 |
</th>
|
175 |
+
<?php
|
176 |
+
}
|
177 |
|
178 |
+
do_action( 'ast_tracking_email_header', $order_id, $th_column_style);
|
179 |
+
?>
|
180 |
|
181 |
+
<th class="tracking-number" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $tracking_number_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
182 |
+
<?php if ( $email_preview ) { ?>
|
183 |
+
<th class="date-shipped <?php esc_html_e( ( 1 != $remove_date_from_tracking_info ) ? 'hide' : '' ); ?>" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
184 |
+
<?php
|
185 |
+
} else {
|
186 |
+
if ( 1 != $remove_date_from_tracking_info ) {
|
187 |
+
?>
|
188 |
+
<th class="date-shipped" style="<?php esc_html_e( $th_column_style ); ?>"><span class="nobr"><?php esc_html_e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></span></th>
|
189 |
+
<?php
|
190 |
+
}
|
191 |
}
|
192 |
|
193 |
+
if ( !$tracking_number_link ) {
|
194 |
+
if ( $email_preview ) {
|
195 |
+
?>
|
196 |
+
<th class="order-actions" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><span class="track_label <?php esc_html_e( ( 1 != $show_track_label ) ? 'hide' : '' ); ?>"><?php esc_html_e( $track_header_text, 'woo-advanced-shipment-tracking' ); ?></span></th>
|
197 |
+
<?php } else { ?>
|
198 |
+
<th class="order-actions" scope="col" class="td" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( ( 1 == $show_track_label ) ? __( $track_header_text, 'woo-advanced-shipment-tracking' ) : '' ); ?></th>
|
199 |
+
<?php
|
200 |
+
}
|
201 |
+
}
|
202 |
+
?>
|
203 |
</tr>
|
204 |
</thead>
|
205 |
<?php } ?>
|
206 |
|
207 |
+
<tbody style="line-height:<?php esc_html_e( $table_content_line_height ); ?>px;">
|
208 |
+
<?php
|
209 |
foreach ( $tracking_items as $key => $tracking_item ) {
|
210 |
|
211 |
+
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] : gmdate('Y-m-d');
|
212 |
+
?>
|
213 |
+
<tr class="tracking" style="background-color:<?php esc_html_e( $email_table_backgroud_color ); ?>">
|
214 |
|
215 |
+
<?php if ( 1 == $display_thumbnail ) { ?>
|
216 |
+
<td class="tracking-provider" data-title="<?php esc_html_e( 'Provider', 'woo-advanced-shipment-tracking' ); ?>" style="<?php esc_html_e( $td_column_style ); ?>;width: 50px;">
|
217 |
<img style="width: 50px;vertical-align: middle;" src="<?php echo esc_url( $tracking_item['tracking_provider_image'] ); ?>">
|
218 |
</td>
|
219 |
<?php } ?>
|
220 |
|
221 |
+
<?php if ( 1 == $display_shipping_provider_name ) { ?>
|
222 |
+
<td class="tracking-provider" data-title="<?php esc_html_e( 'Provider Name', 'woo-advanced-shipment-tracking' ); ?>" style="<?php esc_html_e( $td_column_style ); ?>">
|
223 |
<?php
|
224 |
+
if ( '' != $tracking_item[ 'formatted_tracking_provider' ] ) {
|
225 |
+
esc_html_e( apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ) ) );
|
226 |
} else {
|
227 |
+
esc_html_e( apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'tracking_provider' ] ) ) );
|
228 |
}
|
229 |
?>
|
230 |
</td>
|
232 |
|
233 |
<?php do_action( 'ast_tracking_email_body', $order_id, $tracking_item, $td_column_style ); ?>
|
234 |
|
235 |
+
<td class="tracking-number" data-title="<?php esc_html_e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php esc_html_e( $td_column_style ); ?>">
|
236 |
+
<?php if ( $tracking_item['ast_tracking_link'] && $tracking_number_link ) { ?>
|
237 |
+
<a href="<?php echo esc_url( $tracking_item['ast_tracking_link'] ); ?>" style="text-decoration: none;" target="_blank"><?php echo esc_html( $tracking_item['tracking_number'] ); ?></a>
|
238 |
+
<?php
|
239 |
+
} else {
|
240 |
echo esc_html( $tracking_item['tracking_number'] );
|
241 |
+
}
|
242 |
+
?>
|
243 |
</td>
|
244 |
|
245 |
+
<?php if ( $email_preview ) { ?>
|
246 |
+
<td class="date-shipped <?php esc_html_e( ( 1 == $remove_date_from_tracking_info ) ? 'hide' : '' ); ?>" data-title="<?php esc_html_e( 'Status', 'woocommerce' ); ?>" style="<?php esc_html_e( $td_column_style ); ?>">
|
247 |
+
<time datetime="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>" title="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>"><?php esc_html_e( date_i18n( get_option( 'date_format' ), $date_shipped ) ); ?></time>
|
248 |
</td>
|
249 |
+
<?php
|
250 |
+
} else {
|
251 |
+
if ( 1 != $remove_date_from_tracking_info ) {
|
252 |
+
?>
|
253 |
+
<td class="date-shipped" style="<?php esc_html_e( $td_column_style ); ?>" data-title="<?php esc_html_e( 'Date', 'woocommerce' ); ?>" style="text-align:left; white-space:nowrap;">
|
254 |
+
<time datetime="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>" title="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>"><?php esc_html_e( date_i18n( get_option( 'date_format' ), $date_shipped ) ); ?></time>
|
255 |
</td>
|
256 |
+
<?php
|
257 |
+
}
|
258 |
}
|
259 |
|
260 |
+
if ( !$tracking_number_link ) {
|
261 |
+
?>
|
262 |
+
<td class="order-actions" style="<?php esc_html_e( $td_column_style ); ?>">
|
263 |
+
<?php if ( $tracking_item['ast_tracking_link'] ) { ?>
|
264 |
+
<a href="<?php echo esc_url( $tracking_item['ast_tracking_link'] ); ?>" style="<?php esc_html_e( $tracking_link_style ); ?>" target="_blank"><?php esc_html_e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
265 |
<?php } ?>
|
266 |
</td>
|
267 |
<?php } ?>
|
268 |
+
</tr>
|
269 |
+
<?php
|
270 |
+
}
|
271 |
+
?>
|
272 |
</tbody>
|
273 |
</table><br/>
|
274 |
+
<?php
|
275 |
+
}
|
276 |
+
if ( !isset( $show_shipment_status ) ) {
|
277 |
+
$show_shipment_status = false;
|
278 |
+
}
|
279 |
+
do_action( 'tracking_info_template' , $order_id, $tracking_items, $show_shipment_status );
|
280 |
+
?>
|
281 |
|
282 |
<style>
|
283 |
ul.tracking_list{
|
295 |
}
|
296 |
</style>
|
297 |
<?php
|
298 |
+
endif;
|
templates/emails/wcast-billing-email-addresses.php
CHANGED
@@ -37,4 +37,4 @@ $address = $order->get_formatted_billing_address();
|
|
37 |
</address>
|
38 |
</td>
|
39 |
</tr>
|
40 |
-
</table>
|
37 |
</address>
|
38 |
</td>
|
39 |
</tr>
|
40 |
+
</table>
|
templates/emails/wcast-email-order-details.php
CHANGED
@@ -29,12 +29,14 @@ do_action( 'wcast_email_before_order_table', $order, $sent_to_admin, $plain_text
|
|
29 |
|
30 |
$table_font_size = '';
|
31 |
$kt_woomail = get_option( 'kt_woomail' );
|
32 |
-
if( !empty($kt_woomail) && isset( $kt_woomail['font_size'] ) )
|
|
|
|
|
33 |
?>
|
34 |
<br>
|
35 |
-
<h2 style="text-align:<?php
|
36 |
<?php
|
37 |
-
echo
|
38 |
?>
|
39 |
</h2>
|
40 |
<table class="order-info-split-table" cellspacing="0" cellpadding="0" width="100%" border="0">
|
@@ -42,36 +44,37 @@ if( !empty($kt_woomail) && isset( $kt_woomail['font_size'] ) )$table_font_size =
|
|
42 |
<td align="left" valign="middle" style="padding: 12px 0;">
|
43 |
<h3 style="text-align: left;">
|
44 |
<?php
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
</h3>
|
56 |
</td>
|
57 |
<td align="right" valign="middle" style="padding: 12px 0;">
|
58 |
<h3 style="text-align: right;">
|
59 |
<?php
|
60 |
echo wp_kses_post( sprintf( __( 'Order Date', 'woocommerce' ) . ': <time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) );
|
61 |
-
|
62 |
</h3>
|
63 |
</td>
|
64 |
</tr>
|
65 |
</table>
|
66 |
<?php
|
67 |
-
if ( true == $responsive_check ) {
|
|
|
68 |
<div style="margin-bottom: 40px;">
|
69 |
-
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;<?php
|
70 |
<thead>
|
71 |
<tr>
|
72 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
73 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
74 |
-
<?php if(!$hide_shipping_item_price){ ?>
|
75 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
76 |
<?php } ?>
|
77 |
</tr>
|
@@ -88,7 +91,7 @@ if ( true == $responsive_check ) { ?>
|
|
88 |
$args = apply_filters( 'ast_email_order_items_args', $args);
|
89 |
//echo wc_get_email_order_items( $order, $args );
|
90 |
|
91 |
-
echo wc_get_template(
|
92 |
'emails/wcast-email-order-items.php', array(
|
93 |
'order' => $order,
|
94 |
'items' => $order->get_items(),
|
@@ -103,19 +106,19 @@ if ( true == $responsive_check ) { ?>
|
|
103 |
),
|
104 |
'woocommerce-advanced-shipment-tracking/',
|
105 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
106 |
-
);
|
107 |
?>
|
108 |
</tbody>
|
109 |
</table>
|
110 |
</div>
|
111 |
-
<?php } else{ ?>
|
112 |
<div style="margin-bottom: 40px;">
|
113 |
-
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;<?php
|
114 |
<thead>
|
115 |
<tr>
|
116 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
117 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
118 |
-
<?php if(!$hide_shipping_item_price){ ?>
|
119 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
120 |
<?php } ?>
|
121 |
</tr>
|
@@ -130,8 +133,8 @@ if ( true == $responsive_check ) { ?>
|
|
130 |
'sent_to_admin' => $sent_to_admin,
|
131 |
);
|
132 |
$args = apply_filters( 'ast_email_order_items_args', $args);
|
133 |
-
|
134 |
-
echo wc_get_template(
|
135 |
'emails/wcast-email-order-items.php', array(
|
136 |
'order' => $order,
|
137 |
'items' => $order->get_items(),
|
@@ -146,10 +149,10 @@ if ( true == $responsive_check ) { ?>
|
|
146 |
),
|
147 |
'woocommerce-advanced-shipment-tracking/',
|
148 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
149 |
-
);
|
150 |
?>
|
151 |
</tbody>
|
152 |
</table>
|
153 |
</div>
|
154 |
<?php } ?>
|
155 |
-
<?php do_action( 'wcast_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
|
29 |
|
30 |
$table_font_size = '';
|
31 |
$kt_woomail = get_option( 'kt_woomail' );
|
32 |
+
if ( !empty( $kt_woomail ) && isset( $kt_woomail['font_size'] ) ) {
|
33 |
+
$table_font_size = 'font-size:' . $kt_woomail['font_size'] . 'px';
|
34 |
+
}
|
35 |
?>
|
36 |
<br>
|
37 |
+
<h2 style="text-align:<?php esc_html_e( $text_align ); ?>">
|
38 |
<?php
|
39 |
+
echo esc_html_e( 'Order details', 'woocommerce' );
|
40 |
?>
|
41 |
</h2>
|
42 |
<table class="order-info-split-table" cellspacing="0" cellpadding="0" width="100%" border="0">
|
44 |
<td align="left" valign="middle" style="padding: 12px 0;">
|
45 |
<h3 style="text-align: left;">
|
46 |
<?php
|
47 |
+
if ( $sent_to_admin ) {
|
48 |
+
$before = '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">';
|
49 |
+
$after = '</a>';
|
50 |
+
} else {
|
51 |
+
$before = '';
|
52 |
+
$after = '';
|
53 |
+
}
|
54 |
+
/* translators: %s: Order ID. */
|
55 |
+
echo wp_kses_post( $before . sprintf( __( 'Order number: %s', 'woo-advanced-shipment-tracking' ) . $after, $order->get_order_number() ) );
|
56 |
+
?>
|
57 |
</h3>
|
58 |
</td>
|
59 |
<td align="right" valign="middle" style="padding: 12px 0;">
|
60 |
<h3 style="text-align: right;">
|
61 |
<?php
|
62 |
echo wp_kses_post( sprintf( __( 'Order Date', 'woocommerce' ) . ': <time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) );
|
63 |
+
?>
|
64 |
</h3>
|
65 |
</td>
|
66 |
</tr>
|
67 |
</table>
|
68 |
<?php
|
69 |
+
if ( true == $responsive_check ) {
|
70 |
+
?>
|
71 |
<div style="margin-bottom: 40px;">
|
72 |
+
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;<?php esc_html_e( $table_font_size ); ?>" border="1">
|
73 |
<thead>
|
74 |
<tr>
|
75 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
76 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
77 |
+
<?php if ( !$hide_shipping_item_price ) { ?>
|
78 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
79 |
<?php } ?>
|
80 |
</tr>
|
91 |
$args = apply_filters( 'ast_email_order_items_args', $args);
|
92 |
//echo wc_get_email_order_items( $order, $args );
|
93 |
|
94 |
+
echo wp_kses_post( wc_get_template(
|
95 |
'emails/wcast-email-order-items.php', array(
|
96 |
'order' => $order,
|
97 |
'items' => $order->get_items(),
|
106 |
),
|
107 |
'woocommerce-advanced-shipment-tracking/',
|
108 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
109 |
+
) );
|
110 |
?>
|
111 |
</tbody>
|
112 |
</table>
|
113 |
</div>
|
114 |
+
<?php } else { ?>
|
115 |
<div style="margin-bottom: 40px;">
|
116 |
+
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;<?php esc_html_e( $table_font_size ); ?>" border="1">
|
117 |
<thead>
|
118 |
<tr>
|
119 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
120 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
121 |
+
<?php if ( !$hide_shipping_item_price ) { ?>
|
122 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
123 |
<?php } ?>
|
124 |
</tr>
|
133 |
'sent_to_admin' => $sent_to_admin,
|
134 |
);
|
135 |
$args = apply_filters( 'ast_email_order_items_args', $args);
|
136 |
+
|
137 |
+
echo wp_kses_post( wc_get_template(
|
138 |
'emails/wcast-email-order-items.php', array(
|
139 |
'order' => $order,
|
140 |
'items' => $order->get_items(),
|
149 |
),
|
150 |
'woocommerce-advanced-shipment-tracking/',
|
151 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
152 |
+
) );
|
153 |
?>
|
154 |
</tbody>
|
155 |
</table>
|
156 |
</div>
|
157 |
<?php } ?>
|
158 |
+
<?php do_action( 'wcast_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
|
templates/emails/wcast-email-order-items.php
CHANGED
@@ -87,11 +87,11 @@ foreach ( $items as $item_id => $item ) :
|
|
87 |
echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $qty_display, $item ) );
|
88 |
?>
|
89 |
</td>
|
90 |
-
<?php if(!$hide_shipping_item_price){ ?>
|
91 |
<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
|
92 |
<?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
|
93 |
</td>
|
94 |
-
<?php }?>
|
95 |
</tr>
|
96 |
<?php
|
97 |
|
87 |
echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $qty_display, $item ) );
|
88 |
?>
|
89 |
</td>
|
90 |
+
<?php if ( !$hide_shipping_item_price ) { ?>
|
91 |
<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
|
92 |
<?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
|
93 |
</td>
|
94 |
+
<?php } ?>
|
95 |
</tr>
|
96 |
<?php
|
97 |
|
templates/emails/wcast-shipping-email-addresses.php
CHANGED
@@ -22,7 +22,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
$text_align = is_rtl() ? 'right' : 'left';
|
23 |
$address = $order->get_formatted_billing_address();
|
24 |
$shipping = $order->get_formatted_shipping_address();
|
25 |
-
if( !empty($shipping) ){
|
|
|
26 |
<table id="addresses" cellspacing="0" cellpadding="0" style="width: 48%;display:inline-block;vertical-align: top; margin-bottom: 20px; padding:0;border: 0;margin-right: 15px;" border="0">
|
27 |
<tr>
|
28 |
<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; padding:0;" valign="top" width="50%">
|
22 |
$text_align = is_rtl() ? 'right' : 'left';
|
23 |
$address = $order->get_formatted_billing_address();
|
24 |
$shipping = $order->get_formatted_shipping_address();
|
25 |
+
if ( !empty($shipping) ) {
|
26 |
+
?>
|
27 |
<table id="addresses" cellspacing="0" cellpadding="0" style="width: 48%;display:inline-block;vertical-align: top; margin-bottom: 20px; padding:0;border: 0;margin-right: 15px;" border="0">
|
28 |
<tr>
|
29 |
<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; padding:0;" valign="top" width="50%">
|
templates/myaccount/tracking-info.php
CHANGED
@@ -7,221 +7,243 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
7 |
* View Order: Tracking information
|
8 |
*
|
9 |
* Shows tracking numbers view order page
|
10 |
-
*
|
11 |
-
* @author WooThemes
|
12 |
-
* @package WooCommerce Shipment Tracking/templates/myaccount
|
13 |
-
* @version 1.6.4
|
14 |
*/
|
15 |
|
16 |
if ( $tracking_items ) :
|
17 |
$settings = new wcast_initialise_customizer_settings();
|
18 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
19 |
|
20 |
-
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template'
|
21 |
|
22 |
$show_provider_th = 1;
|
23 |
$colspan = 1;
|
24 |
|
25 |
-
$display_thumbnail = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_image'
|
26 |
-
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_name'
|
27 |
-
$tracking_number_link = $ast->get_checkbox_option_value_from_array('tracking_info_settings','tracking_number_link','');
|
28 |
|
29 |
-
if($display_shipping_provider_name
|
30 |
$show_provider_th = 1;
|
31 |
$colspan = 2;
|
32 |
-
} else if($display_shipping_provider_name
|
33 |
$show_provider_th = 1;
|
34 |
$colspan = 1;
|
35 |
-
} else if($display_shipping_provider_name
|
36 |
$show_provider_th = 1;
|
37 |
$colspan = 1;
|
38 |
-
} else if($display_shipping_provider_name
|
39 |
$show_provider_th = 0;
|
40 |
$colspan = 1;
|
41 |
-
} else{
|
42 |
$show_provider_th = 0;
|
43 |
}
|
44 |
|
45 |
-
$email_border_color = $ast->get_option_value_from_array('tracking_info_settings','table_border_color'
|
46 |
-
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size'
|
47 |
-
$hide_trackig_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
48 |
-
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
49 |
-
$shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
|
50 |
-
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color'
|
51 |
-
$table_content_line_height = $ast->get_option_value_from_array('tracking_info_settings','table_content_line_height'
|
52 |
-
$table_content_font_weight = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_weight'
|
53 |
-
$table_header_bg_color = $ast->get_option_value_from_array('tracking_info_settings','table_header_bg_color'
|
54 |
-
$table_header_font_size = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_size'
|
55 |
-
$table_header_font_weight = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_weight'
|
56 |
-
$table_header_font_color = $ast->get_option_value_from_array('tracking_info_settings','table_header_font_color'
|
57 |
-
$table_content_font_size = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_size'
|
58 |
-
$table_content_font_color = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_color'
|
59 |
-
$tracking_link_font_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_font_color'
|
60 |
-
$tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color'
|
61 |
-
$tracking_link_style =
|
62 |
-
$hide_table_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_table_header','');
|
63 |
-
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array('tracking_info_settings','remove_date_from_tracking'
|
64 |
-
$show_track_label = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_track_label'
|
65 |
-
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text'
|
66 |
-
$tracking_number_header_text = $ast->get_option_value_from_array('tracking_info_settings','tracking_number_header_text'
|
67 |
-
$shipped_date_header_text = $ast->get_option_value_from_array('tracking_info_settings','shipped_date_header_text'
|
68 |
-
$track_header_text = $ast->get_option_value_from_array('tracking_info_settings','track_header_text'
|
69 |
-
$simple_layout_content = $ast->get_option_value_from_array('tracking_info_settings','simple_layout_content'
|
70 |
-
$simple_provider_font_size = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_size'
|
71 |
-
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color'
|
72 |
-
$show_provider_border = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_provider_border'
|
73 |
-
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color'
|
74 |
|
75 |
-
if(is_rtl()){
|
76 |
$header_content_text_align = 'right';
|
77 |
-
} else{
|
78 |
-
$header_content_text_align = $ast->get_option_value_from_array('tracking_info_settings','header_content_text_align'
|
79 |
}
|
80 |
|
81 |
-
$th_column_style =
|
82 |
|
83 |
-
$td_column_style =
|
84 |
|
85 |
-
if(
|
86 |
-
|
|
|
87 |
<?php } ?>
|
88 |
|
89 |
-
<p><?php
|
90 |
|
91 |
-
<?php if(
|
92 |
<div class="tracking_info">
|
93 |
<ul class="tracking_list">
|
94 |
-
<?php
|
|
|
95 |
|
96 |
-
$shipment_status = get_post_meta( $order_id,
|
97 |
-
$
|
98 |
|
99 |
-
if(isset($shipment_status[$key])){
|
100 |
-
if(isset($shipment_status[$key]['status'])){
|
101 |
-
$
|
102 |
}
|
103 |
}
|
104 |
|
105 |
-
$ts_tracking_page = $ast->check_ts_tracking_page_for_tracking_item( $order_id, $tracking_item, $
|
106 |
|
107 |
-
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] :
|
108 |
|
109 |
-
$simple_layout_content_updated = '';
|
|
|
110 |
|
111 |
<li class="tracking_list_li">
|
112 |
-
<div class="tracking_list_div" style="font-size:<?php
|
113 |
<?php
|
114 |
|
115 |
$formatted_tracking_provider = apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ));
|
116 |
|
117 |
-
$simple_layout_content_updated = str_replace('{ship_date}',date_i18n( get_option( 'date_format' ), $date_shipped )
|
118 |
|
119 |
-
$simple_layout_content_updated = str_replace('{shipping_provider}'
|
120 |
|
121 |
-
if($ts_tracking_page){
|
122 |
-
$tracking_number_link = '<a href="javascript:void(0)" class="open_tracking_lightbox" data-order="'
|
123 |
-
} else{
|
124 |
-
$tracking_number_link = '<a target="_blank" href="'.esc_url( $tracking_item['ast_tracking_link'] ).'">'
|
125 |
}
|
126 |
|
127 |
-
$simple_layout_content_updated = str_replace('{tracking_number_link}'
|
128 |
|
129 |
-
echo $simple_layout_content_updated;
|
|
|
130 |
</div>
|
131 |
-
<?php do_action(
|
132 |
</li>
|
133 |
<?php } ?>
|
134 |
</ul>
|
135 |
</div>
|
136 |
-
<?php } else if(
|
137 |
-
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;background:<?php
|
138 |
-
<?php if(
|
139 |
<thead>
|
140 |
<tr>
|
141 |
-
<?php if( $show_provider_th ){ ?>
|
142 |
-
<th class="tracking-provider" colspan="<?php
|
143 |
-
<?php
|
144 |
</th>
|
145 |
-
<?php
|
|
|
146 |
|
147 |
-
do_action(
|
|
|
148 |
|
149 |
-
<th class="" style="<?php
|
150 |
|
151 |
-
<?php if($remove_date_from_tracking_info
|
152 |
-
<th class="date-shipped" style="<?php
|
153 |
-
<?php
|
|
|
154 |
|
155 |
-
if(!$tracking_number_link){
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
<?php } ?>
|
158 |
</tr>
|
159 |
</thead>
|
160 |
<?php } ?>
|
161 |
-
<tbody
|
162 |
-
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] :
|
173 |
|
174 |
-
$ts_tracking_page = $ast->check_ts_tracking_page_for_tracking_item( $order_id, $tracking_item, $
|
175 |
|
176 |
-
|
177 |
|
178 |
<tr class="tracking">
|
179 |
-
<?php if($display_thumbnail
|
180 |
-
<td class="tracking-provider" style="<?php
|
181 |
<img style="width: 50px;margin-right: 5px;vertical-align: middle;" src="<?php echo esc_url( $tracking_item['tracking_provider_image'] ); ?>">
|
182 |
</td>
|
183 |
<?php } ?>
|
184 |
|
185 |
-
<?php if($display_shipping_provider_name
|
186 |
-
<td class="tracking-provider" style="<?php
|
187 |
<?php
|
188 |
-
if ( $tracking_item[ 'formatted_tracking_provider' ]
|
189 |
-
|
190 |
} else {
|
191 |
-
|
192 |
}
|
193 |
?>
|
194 |
</td>
|
195 |
-
<?php
|
|
|
196 |
|
197 |
-
do_action(
|
|
|
198 |
|
199 |
-
<td class="tracking-number" style="<?php
|
200 |
-
<?php
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
<a href="<?php echo
|
205 |
-
<?php }
|
206 |
-
|
|
|
|
|
|
|
207 |
echo esc_html( $tracking_item['tracking_number'] );
|
208 |
-
}
|
|
|
209 |
</td>
|
210 |
|
211 |
-
<?php if($remove_date_from_tracking_info
|
212 |
-
<td class="date-shipped" style="<?php
|
213 |
-
<time datetime="<?php
|
214 |
</td>
|
215 |
-
<?php
|
|
|
216 |
|
217 |
-
if( !$tracking_number_link ){
|
218 |
-
|
219 |
-
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
<?php } } ?>
|
226 |
</td>
|
227 |
<?php } ?>
|
@@ -229,11 +251,15 @@ if ( $tracking_items ) :
|
|
229 |
<?php } ?>
|
230 |
</tbody>
|
231 |
</table>
|
232 |
-
<?php
|
|
|
233 |
|
234 |
-
if( !isset($show_shipment_status) )
|
|
|
|
|
235 |
|
236 |
-
do_action( 'my_account_tracking_info_template' , $order_id, $tracking_items, $show_shipment_status );
|
|
|
237 |
|
238 |
<div id="" class="popupwrapper ts_tracking_popup" style="display:none;">
|
239 |
<div class="popuprow">
|
@@ -242,4 +268,4 @@ if ( $tracking_items ) :
|
|
242 |
<div class="popupclose"></div>
|
243 |
</div>
|
244 |
<?php
|
245 |
-
endif;
|
7 |
* View Order: Tracking information
|
8 |
*
|
9 |
* Shows tracking numbers view order page
|
10 |
+
*
|
|
|
|
|
|
|
11 |
*/
|
12 |
|
13 |
if ( $tracking_items ) :
|
14 |
$settings = new wcast_initialise_customizer_settings();
|
15 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions();
|
16 |
|
17 |
+
$select_tracking_template = $ast->get_option_value_from_array( 'tracking_info_settings', 'select_tracking_template', $settings->defaults['select_tracking_template'] );
|
18 |
|
19 |
$show_provider_th = 1;
|
20 |
$colspan = 1;
|
21 |
|
22 |
+
$display_thumbnail = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'display_shipment_provider_image', $settings->defaults['display_shipment_provider_image'] );
|
23 |
+
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'display_shipment_provider_name', $settings->defaults['display_shipment_provider_name'] );
|
24 |
+
$tracking_number_link = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'tracking_number_link', '' );
|
25 |
|
26 |
+
if ( 1 == $display_shipping_provider_name && 1 == $display_thumbnail ) {
|
27 |
$show_provider_th = 1;
|
28 |
$colspan = 2;
|
29 |
+
} else if ( 1 != $display_shipping_provider_name && 1 == $display_thumbnail ) {
|
30 |
$show_provider_th = 1;
|
31 |
$colspan = 1;
|
32 |
+
} else if ( 1 == $display_shipping_provider_name && 1 != $display_thumbnail ) {
|
33 |
$show_provider_th = 1;
|
34 |
$colspan = 1;
|
35 |
+
} else if ( 1 != $display_shipping_provider_name && 1 != $display_thumbnail ) {
|
36 |
$show_provider_th = 0;
|
37 |
$colspan = 1;
|
38 |
+
} else {
|
39 |
$show_provider_th = 0;
|
40 |
}
|
41 |
|
42 |
+
$email_border_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_border_color', $settings->defaults['table_border_color'] );
|
43 |
+
$email_border_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_border_size', $settings->defaults['table_border_size'] );
|
44 |
+
$hide_trackig_header = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'hide_trackig_header', '' );
|
45 |
+
$shipment_tracking_header = $ast->get_option_value_from_array( 'tracking_info_settings', 'header_text_change', 'Tracking Information' );
|
46 |
+
$shipment_tracking_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'additional_header_text', '' );
|
47 |
+
$email_table_backgroud_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_bg_color', $settings->defaults['table_bg_color'] );
|
48 |
+
$table_content_line_height = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_line_height', $settings->defaults['table_content_line_height'] );
|
49 |
+
$table_content_font_weight = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_weight', $settings->defaults['table_content_font_weight'] );
|
50 |
+
$table_header_bg_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_bg_color', $settings->defaults['table_header_bg_color'] );
|
51 |
+
$table_header_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_size', $settings->defaults['table_header_font_size'] );
|
52 |
+
$table_header_font_weight = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_weight', $settings->defaults['table_header_font_weight'] );
|
53 |
+
$table_header_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_header_font_color', $settings->defaults['table_header_font_color'] );
|
54 |
+
$table_content_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_size', $settings->defaults['table_content_font_size'] );
|
55 |
+
$table_content_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'table_content_font_color', $settings->defaults['table_content_font_color'] );
|
56 |
+
$tracking_link_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_link_font_color', $settings->defaults['tracking_link_font_color'] );
|
57 |
+
$tracking_link_bg_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_link_bg_color', $settings->defaults['tracking_link_bg_color'] );
|
58 |
+
$tracking_link_style = 'color: ' . $tracking_link_font_color . ' ;background:' . $tracking_link_bg_color . ';margin-bottom: 0;';
|
59 |
+
$hide_table_header = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'hide_table_header', '' );
|
60 |
+
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'remove_date_from_tracking', $settings->defaults['remove_date_from_tracking'] );
|
61 |
+
$show_track_label = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'show_track_label', $settings->defaults['show_track_label'] );
|
62 |
+
$provider_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'provider_header_text', $settings->defaults['provider_header_text'] );
|
63 |
+
$tracking_number_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'tracking_number_header_text', $settings->defaults['tracking_number_header_text'] );
|
64 |
+
$shipped_date_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'shipped_date_header_text', $settings->defaults['shipped_date_header_text'] );
|
65 |
+
$track_header_text = $ast->get_option_value_from_array( 'tracking_info_settings', 'track_header_text', $settings->defaults['track_header_text'] );
|
66 |
+
$simple_layout_content = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_layout_content', $settings->defaults['simple_layout_content'] );
|
67 |
+
$simple_provider_font_size = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_provider_font_size', $settings->defaults['simple_provider_font_size'] );
|
68 |
+
$simple_provider_font_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'simple_provider_font_color', $settings->defaults['simple_provider_font_color'] );
|
69 |
+
$show_provider_border = $ast->get_checkbox_option_value_from_array( 'tracking_info_settings', 'show_provider_border', $settings->defaults['show_provider_border'] );
|
70 |
+
$provider_border_color = $ast->get_option_value_from_array( 'tracking_info_settings', 'provider_border_color', $settings->defaults['provider_border_color'] );
|
71 |
|
72 |
+
if ( is_rtl() ) {
|
73 |
$header_content_text_align = 'right';
|
74 |
+
} else {
|
75 |
+
$header_content_text_align = $ast->get_option_value_from_array( 'tracking_info_settings', 'header_content_text_align', $settings->defaults['header_content_text_align'] );
|
76 |
}
|
77 |
|
78 |
+
$th_column_style = 'background:' . $table_header_bg_color . ';text-align: ' . $header_content_text_align . '; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-size:' . $table_header_font_size . 'px; color: ' . $table_header_font_color . ' ; border: ' . $email_border_size . 'px solid ' . $email_border_color . '; padding: 12px;font-weight:' . $table_header_font_weight . ';';
|
79 |
|
80 |
+
$td_column_style = 'text-align: ' . $header_content_text_align . '; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size:' . $table_content_font_size . 'px;font-weight:' . $table_content_font_weight . '; color: ' . $table_content_font_color . ' ; border: ' . $email_border_size . 'px solid ' . $email_border_color . '; padding: 12px;line-height: ' . $table_content_line_height . 'px;';
|
81 |
|
82 |
+
if ( 1 != $hide_trackig_header ) {
|
83 |
+
?>
|
84 |
+
<h2><?php esc_html_e( apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ) ); ?></h2>
|
85 |
<?php } ?>
|
86 |
|
87 |
+
<p><?php esc_html_e( $shipment_tracking_header_text ); ?></p>
|
88 |
|
89 |
+
<?php if ( 'simple_list' == $select_tracking_template ) { ?>
|
90 |
<div class="tracking_info">
|
91 |
<ul class="tracking_list">
|
92 |
+
<?php
|
93 |
+
foreach ( $tracking_items as $key => $tracking_item ) {
|
94 |
|
95 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
96 |
+
$ts_status = '';
|
97 |
|
98 |
+
if ( isset( $shipment_status[$key] ) ) {
|
99 |
+
if ( isset( $shipment_status[$key]['status'] ) ) {
|
100 |
+
$ts_status = $shipment_status[$key]['status'];
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
$ts_tracking_page = $ast->check_ts_tracking_page_for_tracking_item( $order_id, $tracking_item, $ts_status );
|
105 |
|
106 |
+
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] : gmdate( 'Y-m-d' );
|
107 |
|
108 |
+
$simple_layout_content_updated = '';
|
109 |
+
?>
|
110 |
|
111 |
<li class="tracking_list_li">
|
112 |
+
<div class="tracking_list_div" style="font-size:<?php esc_html_e( $simple_provider_font_size ); ?>px;color:<?php esc_html_e( $simple_provider_font_color ); ?>;border-bottom:<?php esc_html_e( $show_provider_border ); ?>px solid <?php esc_html_e( $provider_border_color ); ?>">
|
113 |
<?php
|
114 |
|
115 |
$formatted_tracking_provider = apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ));
|
116 |
|
117 |
+
$simple_layout_content_updated = str_replace( '{ship_date}', date_i18n( get_option( 'date_format' ), $date_shipped ), $simple_layout_content );
|
118 |
|
119 |
+
$simple_layout_content_updated = str_replace( '{shipping_provider}', $formatted_tracking_provider, $simple_layout_content_updated );
|
120 |
|
121 |
+
if ( $ts_tracking_page ) {
|
122 |
+
$tracking_number_link = '<a href="javascript:void(0)" class="open_tracking_lightbox" data-order="' . $order_id . '" data-tracking="' . $tracking_item['tracking_number'] . '" wp_nonce="' . wp_create_nonce( 'open_tracking_lightbox' ) . '">' . $tracking_item['tracking_number'] . '</a>';
|
123 |
+
} else {
|
124 |
+
$tracking_number_link = '<a target="_blank" href="' . esc_url( $tracking_item['ast_tracking_link'] ) . '">' . $tracking_item['tracking_number'] . '</a>';
|
125 |
}
|
126 |
|
127 |
+
$simple_layout_content_updated = str_replace( '{tracking_number_link}', $tracking_number_link, $simple_layout_content_updated );
|
128 |
|
129 |
+
echo wp_kses_post( $simple_layout_content_updated );
|
130 |
+
?>
|
131 |
</div>
|
132 |
+
<?php do_action( 'ast_tracking_simple_list_email_body', $order_id, $tracking_item ); ?>
|
133 |
</li>
|
134 |
<?php } ?>
|
135 |
</ul>
|
136 |
</div>
|
137 |
+
<?php } else if ( 'default_table' == $select_tracking_template ) { ?>
|
138 |
+
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;background:<?php esc_html_e( $email_table_backgroud_color ); ?>">
|
139 |
+
<?php if ( 1 != $hide_table_header ) { ?>
|
140 |
<thead>
|
141 |
<tr>
|
142 |
+
<?php if ( $show_provider_th ) { ?>
|
143 |
+
<th class="tracking-provider" colspan="<?php esc_html_e( $colspan ); ?>" style="<?php esc_html_e( $th_column_style ); ?>">
|
144 |
+
<?php esc_html_e( $provider_header_text, 'woo-advanced-shipment-tracking' ); ?>
|
145 |
</th>
|
146 |
+
<?php
|
147 |
+
}
|
148 |
|
149 |
+
do_action( 'ast_tracking_my_acoount_header', $order_id, $th_column_style );
|
150 |
+
?>
|
151 |
|
152 |
+
<th class="" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $tracking_number_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
153 |
|
154 |
+
<?php if ( 1 != $remove_date_from_tracking_info ) { ?>
|
155 |
+
<th class="date-shipped" style="<?php esc_html_e( $th_column_style ); ?>"><?php esc_html_e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
156 |
+
<?php
|
157 |
+
}
|
158 |
|
159 |
+
if ( !$tracking_number_link ) {
|
160 |
+
?>
|
161 |
+
<th class="order-actions" style="<?php esc_html_e( $th_column_style ); ?>">
|
162 |
+
<?php
|
163 |
+
if ( 1 == $show_track_label ) {
|
164 |
+
esc_html_e( $track_header_text, 'woo-advanced-shipment-tracking' );
|
165 |
+
}
|
166 |
+
?>
|
167 |
+
</th>
|
168 |
<?php } ?>
|
169 |
</tr>
|
170 |
</thead>
|
171 |
<?php } ?>
|
172 |
+
<tbody>
|
173 |
+
<?php
|
174 |
+
foreach ( $tracking_items as $key => $tracking_item ) {
|
175 |
|
176 |
+
$shipment_status = get_post_meta( $order_id, 'shipment_status', true);
|
177 |
+
$ts_status = '';
|
178 |
|
179 |
+
if ( isset( $shipment_status[$key] ) ) {
|
180 |
+
if ( isset( $shipment_status[$key]['status'] ) ) {
|
181 |
+
$ts_status = $shipment_status[$key]['status'];
|
182 |
+
}
|
183 |
+
}
|
184 |
+
$date_shipped = ( isset( $tracking_item['date_shipped'] ) ) ? $tracking_item['date_shipped'] : gmdate('Y-m-d');
|
185 |
|
186 |
+
$ts_tracking_page = $ast->check_ts_tracking_page_for_tracking_item( $order_id, $tracking_item, $ts_status );
|
187 |
|
188 |
+
?>
|
189 |
|
190 |
<tr class="tracking">
|
191 |
+
<?php if ( 1 == $display_thumbnail ) { ?>
|
192 |
+
<td class="tracking-provider" style="<?php esc_html_e( $td_column_style ); ?>" data-title="<?php esc_html_e( 'Provider', 'woo-advanced-shipment-tracking' ); ?>">
|
193 |
<img style="width: 50px;margin-right: 5px;vertical-align: middle;" src="<?php echo esc_url( $tracking_item['tracking_provider_image'] ); ?>">
|
194 |
</td>
|
195 |
<?php } ?>
|
196 |
|
197 |
+
<?php if ( 1 == $display_shipping_provider_name ) { ?>
|
198 |
+
<td class="tracking-provider" style="<?php esc_html_e( $td_column_style ); ?>" data-title="<?php esc_html_e( 'Provider Name', 'woo-advanced-shipment-tracking' ); ?>">
|
199 |
<?php
|
200 |
+
if ( '' != $tracking_item[ 'formatted_tracking_provider' ] ) {
|
201 |
+
esc_html_e( apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'formatted_tracking_provider' ] ) ) );
|
202 |
} else {
|
203 |
+
esc_html_e( apply_filters( 'ast_provider_title', esc_html( $tracking_item[ 'tracking_provider' ] ) ) );
|
204 |
}
|
205 |
?>
|
206 |
</td>
|
207 |
+
<?php
|
208 |
+
}
|
209 |
|
210 |
+
do_action( 'ast_tracking_my_account_body', $order_id, $tracking_item, $td_column_style );
|
211 |
+
?>
|
212 |
|
213 |
+
<td class="tracking-number" style="<?php esc_html_e( $td_column_style ); ?>" data-title="<?php esc_html_e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>">
|
214 |
+
<?php
|
215 |
+
if ( '' !== $tracking_item['ast_tracking_link'] && $tracking_number_link ) {
|
216 |
+
if ( $ts_tracking_page ) {
|
217 |
+
?>
|
218 |
+
<a href="javascript:void(0)" class="open_tracking_lightbox" data-order="<?php esc_html_e( $order_id ); ?>" data-tracking="<?php echo esc_html( $tracking_item['tracking_number'] ); ?>" wp_nonce="<?php esc_html_e( wp_create_nonce( 'open_tracking_lightbox' ) ); ?>" style="<?php esc_html_e( $tracking_link_style ); ?>"><?php echo esc_html( $tracking_item['tracking_number'] ); ?></a>
|
219 |
+
<?php } else { ?>
|
220 |
+
<a href="<?php echo esc_url( $tracking_item['ast_tracking_link'] ); ?>" target="_blank" style="<?php esc_html_e( $tracking_link_style ); ?>"><?php echo esc_html( $tracking_item['tracking_number'] ); ?></a>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
} else {
|
224 |
echo esc_html( $tracking_item['tracking_number'] );
|
225 |
+
}
|
226 |
+
?>
|
227 |
</td>
|
228 |
|
229 |
+
<?php if ( 1 != $remove_date_from_tracking_info ) { ?>
|
230 |
+
<td class="date-shipped" style="<?php esc_html_e( $td_column_style ); ?>" data-title="<?php esc_html_e( 'Date', 'woocommerce' ); ?>" style="text-align:left; white-space:nowrap;">
|
231 |
+
<time datetime="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>" title="<?php esc_html_e( gmdate( 'Y-m-d', $date_shipped ) ); ?>"><?php esc_html_e( date_i18n( get_option( 'date_format' ), $date_shipped ) ); ?></time>
|
232 |
</td>
|
233 |
+
<?php
|
234 |
+
}
|
235 |
|
236 |
+
if ( !$tracking_number_link ) {
|
237 |
+
?>
|
238 |
+
<td class="order-actions" style="<?php esc_html_e( $td_column_style ); ?>;text-align:center;">
|
239 |
+
<?php
|
240 |
+
if ( '' !== $tracking_item['ast_tracking_link'] ) {
|
241 |
|
242 |
+
if ( $ts_tracking_page ) {
|
243 |
+
?>
|
244 |
+
<a href="javascript:void(0)" class="button open_tracking_lightbox" data-order="<?php esc_html_e( $order_id ); ?>" data-tracking="<?php echo esc_html( $tracking_item['tracking_number'] ); ?>" wp_nonce="<?php esc_html_e( wp_create_nonce( 'open_tracking_lightbox' ) ); ?>" style="<?php esc_html_e( $tracking_link_style ); ?>"><?php esc_html_e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
245 |
+
<?php } else { ?>
|
246 |
+
<a href="<?php echo esc_url( $tracking_item['ast_tracking_link'] ); ?>" target="_blank" class="button" style="<?php esc_html_e( $tracking_link_style ); ?>"><?php esc_html_e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
247 |
<?php } } ?>
|
248 |
</td>
|
249 |
<?php } ?>
|
251 |
<?php } ?>
|
252 |
</tbody>
|
253 |
</table>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
|
257 |
+
if ( !isset( $show_shipment_status ) ) {
|
258 |
+
$show_shipment_status = false;
|
259 |
+
}
|
260 |
|
261 |
+
do_action( 'my_account_tracking_info_template' , $order_id, $tracking_items, $show_shipment_status );
|
262 |
+
?>
|
263 |
|
264 |
<div id="" class="popupwrapper ts_tracking_popup" style="display:none;">
|
265 |
<div class="popuprow">
|
268 |
<div class="popupclose"></div>
|
269 |
</div>
|
270 |
<?php
|
271 |
+
endif;
|
templates/tracking/tracking-form.php
CHANGED
@@ -8,13 +8,13 @@
|
|
8 |
?>
|
9 |
<div class="track-order-section">
|
10 |
<form method="post" class="order_track_form">
|
11 |
-
<p><?php
|
12 |
-
<p class="form-row form-row-first"><label for="order_id"><?php
|
13 |
-
<p class="form-row form-row-last"><label for="order_email"><?php
|
14 |
<div class="clear"></div>
|
15 |
<input type="hidden" name="action" value="get_tracking_info">
|
16 |
-
<p class="form-row"><button type="submit" class="button" name="track" value="Track"><?php echo apply_filters( 'ast_tracking_page_front_track_label', __( 'Track', 'woo-advanced-shipment-tracking' ) ); ?></button></p>
|
17 |
<div class="track_fail_msg" style="display:none;color: red;"></div>
|
18 |
-
<?php wp_nonce_field( 'tracking_form', 'tracking_form_nonce' )
|
19 |
</form>
|
20 |
-
</div>
|
8 |
?>
|
9 |
<div class="track-order-section">
|
10 |
<form method="post" class="order_track_form">
|
11 |
+
<p><?php esc_html_e( apply_filters( 'ast_tracking_page_front_text', __( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woo-advanced-shipment-tracking' ) ) ); ?></p>
|
12 |
+
<p class="form-row form-row-first"><label for="order_id"><?php esc_html_e( apply_filters( 'ast_tracking_page_front_order_label', __( 'Order ID', 'woocommerce' ) ) ); ?></label> <input class="input-text" type="text" name="order_id" id="order_id" value="" placeholder="<?php esc_html_e( 'Found in your order confirmation email.', 'woo-advanced-shipment-tracking' ); ?>"></p>
|
13 |
+
<p class="form-row form-row-last"><label for="order_email"><?php esc_html_e( apply_filters( 'ast_tracking_page_front_order_email_label', __( 'Order Email', 'woo-advanced-shipment-tracking' ) ) ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" value="" placeholder="<?php esc_html_e( 'Found in your order confirmation email.', 'woo-advanced-shipment-tracking' ); ?>"></p>
|
14 |
<div class="clear"></div>
|
15 |
<input type="hidden" name="action" value="get_tracking_info">
|
16 |
+
<p class="form-row"><button type="submit" class="button" name="track" value="Track"><?php echo esc_html( apply_filters( 'ast_tracking_page_front_track_label', __( 'Track', 'woo-advanced-shipment-tracking' ) ) ); ?></button></p>
|
17 |
<div class="track_fail_msg" style="display:none;color: red;"></div>
|
18 |
+
<?php wp_nonce_field( 'tracking_form', 'tracking_form_nonce' ); ?>
|
19 |
</form>
|
20 |
+
</div>
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,33 +4,35 @@
|
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
-
* Version: 3.2.
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
-
* WC tested up to: 5.
|
14 |
*/
|
15 |
|
16 |
-
class
|
17 |
|
18 |
/**
|
19 |
* WooCommerce Advanced Shipment Tracking version.
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
public $version = '3.2.
|
24 |
|
25 |
/**
|
26 |
* Initialize the main plugin function
|
27 |
*/
|
28 |
-
|
29 |
|
30 |
$this->plugin_file = __FILE__;
|
31 |
|
32 |
// Add your templates to this array.
|
33 |
-
if (!defined('SHIPMENT_TRACKING_PATH'))
|
|
|
|
|
34 |
|
35 |
register_activation_hook( __FILE__, array( $this,'on_activation' ) );
|
36 |
|
@@ -38,7 +40,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
38 |
|
39 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
40 |
|
41 |
-
if( is_multisite() ) {
|
42 |
|
43 |
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
44 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
@@ -55,7 +57,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
55 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
56 |
}
|
57 |
|
58 |
-
if( ! $this->is_ast_pro_active() || ! $this->ast_pro_version_check() ) {
|
59 |
if ( $this->is_wc_active() ) {
|
60 |
|
61 |
// Include required files.
|
@@ -81,7 +83,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
81 |
|
82 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
83 |
|
84 |
-
if( !function_exists( 'trackship_for_woocommerce' ) ) {
|
85 |
$this->late_shipments->init();
|
86 |
$this->trackship->init();
|
87 |
}
|
@@ -90,31 +92,26 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
90 |
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'ast_plugin_action_links' ) );
|
91 |
}
|
92 |
}
|
93 |
-
|
94 |
|
95 |
/**
|
96 |
-
*
|
97 |
*
|
98 |
-
* @access public
|
99 |
* @since 1.0.0
|
100 |
*/
|
101 |
-
public function on_activation(){
|
102 |
|
103 |
// Require parent plugin
|
104 |
-
if ( is_plugin_active( 'ast-pro/ast-pro.php' )
|
105 |
|
106 |
//admin notice for not allow activate plugin
|
107 |
-
wp_redirect( admin_url().'plugins.php?ast-not-allow=true' );
|
108 |
exit;
|
109 |
}
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
-
* Check if AST PRO is active
|
114 |
-
*
|
115 |
-
* @access private
|
116 |
-
* @since 1.0.0
|
117 |
-
* @return bool
|
118 |
*/
|
119 |
private function is_ast_pro_active() {
|
120 |
|
@@ -131,12 +128,8 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
131 |
return $is_active;
|
132 |
}
|
133 |
|
134 |
-
|
135 |
-
* Check if Advanced Shipment Tracking for WooCommerce is active
|
136 |
-
*
|
137 |
-
* @access private
|
138 |
-
* @since 1.0.0
|
139 |
-
* @return bool
|
140 |
*/
|
141 |
private function ast_pro_version_check() {
|
142 |
|
@@ -157,8 +150,9 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
157 |
}
|
158 |
|
159 |
/**
|
160 |
-
* Check if WooCommerce is active
|
161 |
-
*
|
|
|
162 |
* @return bool
|
163 |
*/
|
164 |
private function is_wc_active() {
|
@@ -181,15 +175,17 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
-
* Display WC active notice
|
185 |
-
* @since 1.0.0
|
186 |
*/
|
187 |
public function notice_activate_wc() {
|
188 |
?>
|
189 |
<div class="error">
|
190 |
-
<p
|
|
|
191 |
/* translators: %s: search WooCommerce plugin link */
|
192 |
-
printf( esc_html__( 'Please install and activate %1$sWooCommerce%2$s for Advanced Shipment Tracking for WooCommerce!', 'woo-advanced-shipment-tracking' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=WooCommerce&plugin-search-input=Search+Plugins' ) ) . '">', '</a>' );
|
|
|
|
|
193 |
</div>
|
194 |
<?php
|
195 |
}
|
@@ -205,10 +201,10 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
205 |
add_action( 'add_meta_boxes', array( $this->actions, 'add_meta_box' ) );
|
206 |
add_action( 'woocommerce_view_order', array( $this->actions, 'show_tracking_info_order' ) );
|
207 |
|
208 |
-
add_action( 'woocommerce_my_account_my_orders_actions', array( $this->actions, 'add_column_my_account_orders_ast_track_column' ),10, 2 );
|
209 |
|
210 |
add_action( 'wp_ajax_wc_shipment_tracking_delete_item', array( $this->actions, 'meta_box_delete_tracking' ) );
|
211 |
-
add_action( 'woocommerce_process_shop_order_meta', array( $this->actions, 'save_meta_box' ),0, 2 );
|
212 |
add_action( 'wp_ajax_wc_shipment_tracking_save_form', array( $this->actions, 'save_meta_box_ajax' ) );
|
213 |
|
214 |
add_action( 'wp_ajax_reassign_order_status', array( $this, 'reassign_order_status' ) );
|
@@ -217,7 +213,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
217 |
|
218 |
if ( !$preview ) {
|
219 |
$tracking_info_settings = get_option('tracking_info_settings');
|
220 |
-
if( isset( $tracking_info_settings['display_tracking_info_at'] ) && 'after_order' == $tracking_info_settings['display_tracking_info_at'] ) {
|
221 |
add_action( 'woocommerce_email_order_meta', array( $this->actions, 'email_display' ), 0, 4 );
|
222 |
} else {
|
223 |
add_action( 'woocommerce_email_before_order_table', array( $this->actions, 'email_display' ), 0, 4 );
|
@@ -287,7 +283,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
287 |
}
|
288 |
|
289 |
/*** Method load Language file ***/
|
290 |
-
function wst_load_textdomain() {
|
291 |
load_plugin_textdomain( 'woo-advanced-shipment-tracking', false, dirname( plugin_basename(__FILE__) ) . '/lang' );
|
292 |
}
|
293 |
|
@@ -369,10 +365,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
369 |
$this->admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
370 |
|
371 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-settings.php';
|
372 |
-
$this->settings = WC_Advanced_Shipment_Tracking_Settings::get_instance();
|
373 |
-
|
374 |
-
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-license.php';
|
375 |
-
$this->license = WC_Advanced_Shipment_Tracking_License::get_instance();
|
376 |
|
377 |
if ( !function_exists( 'trackship_for_woocommerce' ) ) {
|
378 |
|
@@ -460,7 +453,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
460 |
$screen = get_current_screen();
|
461 |
|
462 |
if ( 'plugins.php' == $screen->parent_file ) {
|
463 |
-
wp_enqueue_style( 'ast_styles',
|
464 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
465 |
wp_enqueue_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
466 |
}
|
@@ -473,8 +466,8 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
473 |
unset( $order_statuses['wc-partial-shipped'] );
|
474 |
unset( $order_statuses['wc-delivered'] );
|
475 |
|
476 |
-
if( $delivered_count > 0 || $ps_count > 0 ) {
|
477 |
-
|
478 |
|
479 |
<script>
|
480 |
|
@@ -527,40 +520,44 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
527 |
<div class="popup_body">
|
528 |
<form method="post" id="order_reassign_form">
|
529 |
<?php
|
530 |
-
|
531 |
?>
|
532 |
|
533 |
-
<p
|
|
|
534 |
/* translators: %s: replace with delivered order count */
|
535 |
-
printf( esc_html__('We detected %s orders that use the Delivered order status, You can reassign these orders to a different status', 'woo-advanced-shipment-tracking'), $delivered_count );
|
536 |
-
|
537 |
</p>
|
538 |
<select id="reassign_delivered_order" name="reassign_delivered_order" class="reassign_select">
|
539 |
-
<option value=""><?php
|
540 |
-
<?php foreach($order_statuses as $key => $status){ ?>
|
541 |
-
<option value="<?php
|
542 |
<?php } ?>
|
543 |
</select>
|
544 |
|
545 |
-
<?php
|
|
|
546 |
|
547 |
if ( $ps_count > 0 ) {
|
548 |
-
|
549 |
-
<p
|
|
|
550 |
/* translators: %s: replace with Partially Shipped order count */
|
551 |
-
printf( esc_html__('We detected %s orders that use the Partially Shipped order status, You can reassign these orders to a different status', 'woo-advanced-shipment-tracking'), $ps_count );
|
552 |
-
|
553 |
</p>
|
554 |
|
555 |
<select id="reassign_ps_order" name="reassign_ps_order" class="reassign_select">
|
556 |
-
<option value=""><?php
|
557 |
-
<?php foreach($order_statuses as $key => $status){ ?>
|
558 |
-
<option value="<?php
|
559 |
<?php } ?>
|
560 |
</select>
|
561 |
|
562 |
<?php } ?>
|
563 |
<p>
|
|
|
564 |
<input type="hidden" name="action" value="reassign_order_status">
|
565 |
<input type="button" value="Uninstall" class="uninstall_plugin button-primary btn_ast2">
|
566 |
<input type="button" value="Close" class="uninstall_close button-primary btn_red">
|
@@ -570,7 +567,8 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
570 |
</div>
|
571 |
<div class="popupclose"></div>
|
572 |
</div>
|
573 |
-
<?php
|
|
|
574 |
}
|
575 |
|
576 |
/*
|
@@ -578,6 +576,8 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
578 |
*/
|
579 |
public function reassign_order_status() {
|
580 |
|
|
|
|
|
581 |
$reassign_delivered_order = isset( $_POST['reassign_delivered_order'] ) ? wc_clean( $_POST['reassign_delivered_order'] ) : '';
|
582 |
$reassign_ps_order = isset( $_POST['reassign_ps_order'] ) ? wc_clean( $_POST['reassign_ps_order'] ) : '';
|
583 |
|
@@ -634,18 +634,18 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
634 |
}
|
635 |
|
636 |
/**
|
637 |
-
* Returns an instance of
|
638 |
*
|
639 |
* @since 1.6.5
|
640 |
* @version 1.6.5
|
641 |
*
|
642 |
-
* @return
|
643 |
*/
|
644 |
function wc_advanced_shipment_tracking() {
|
645 |
static $instance;
|
646 |
|
647 |
if ( ! isset( $instance ) ) {
|
648 |
-
$instance = new
|
649 |
}
|
650 |
|
651 |
return $instance;
|
@@ -656,4 +656,4 @@ function wc_advanced_shipment_tracking() {
|
|
656 |
*
|
657 |
* Backward compatibility.
|
658 |
*/
|
659 |
-
wc_advanced_shipment_tracking();
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
+
* Version: 3.2.6
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
+
* WC tested up to: 5.5.1
|
14 |
*/
|
15 |
|
16 |
+
class Zorem_Woocommerce_Advanced_Shipment_Tracking {
|
17 |
|
18 |
/**
|
19 |
* WooCommerce Advanced Shipment Tracking version.
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
public $version = '3.2.6';
|
24 |
|
25 |
/**
|
26 |
* Initialize the main plugin function
|
27 |
*/
|
28 |
+
public function __construct() {
|
29 |
|
30 |
$this->plugin_file = __FILE__;
|
31 |
|
32 |
// Add your templates to this array.
|
33 |
+
if (!defined('SHIPMENT_TRACKING_PATH')) {
|
34 |
+
define( 'SHIPMENT_TRACKING_PATH', $this->get_plugin_path());
|
35 |
+
}
|
36 |
|
37 |
register_activation_hook( __FILE__, array( $this,'on_activation' ) );
|
38 |
|
40 |
|
41 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
42 |
|
43 |
+
if ( is_multisite() ) {
|
44 |
|
45 |
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
46 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
57 |
$this->table = $wpdb->prefix . 'woo_shippment_provider';
|
58 |
}
|
59 |
|
60 |
+
if ( ! $this->is_ast_pro_active() || ! $this->ast_pro_version_check() ) {
|
61 |
if ( $this->is_wc_active() ) {
|
62 |
|
63 |
// Include required files.
|
83 |
|
84 |
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
85 |
|
86 |
+
if ( !function_exists( 'trackship_for_woocommerce' ) ) {
|
87 |
$this->late_shipments->init();
|
88 |
$this->trackship->init();
|
89 |
}
|
92 |
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'ast_plugin_action_links' ) );
|
93 |
}
|
94 |
}
|
95 |
+
}
|
96 |
|
97 |
/**
|
98 |
+
* Callback on activation and allow to activate if pro deactivated
|
99 |
*
|
|
|
100 |
* @since 1.0.0
|
101 |
*/
|
102 |
+
public function on_activation() {
|
103 |
|
104 |
// Require parent plugin
|
105 |
+
if ( is_plugin_active( 'ast-pro/ast-pro.php' ) && current_user_can( 'activate_plugins' ) ) {
|
106 |
|
107 |
//admin notice for not allow activate plugin
|
108 |
+
wp_redirect( admin_url() . 'plugins.php?ast-not-allow=true' );
|
109 |
exit;
|
110 |
}
|
111 |
}
|
112 |
|
113 |
/**
|
114 |
+
* Check if AST PRO is active
|
|
|
|
|
|
|
|
|
115 |
*/
|
116 |
private function is_ast_pro_active() {
|
117 |
|
128 |
return $is_active;
|
129 |
}
|
130 |
|
131 |
+
/**
|
132 |
+
* Check if Advanced Shipment Tracking for WooCommerce is active
|
|
|
|
|
|
|
|
|
133 |
*/
|
134 |
private function ast_pro_version_check() {
|
135 |
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
+
* Check if WooCommerce is active
|
154 |
+
*
|
155 |
+
* @since 1.0.0
|
156 |
* @return bool
|
157 |
*/
|
158 |
private function is_wc_active() {
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
+
* Display WC active notice
|
|
|
179 |
*/
|
180 |
public function notice_activate_wc() {
|
181 |
?>
|
182 |
<div class="error">
|
183 |
+
<p>
|
184 |
+
<?php
|
185 |
/* translators: %s: search WooCommerce plugin link */
|
186 |
+
printf( esc_html__( 'Please install and activate %1$sWooCommerce%2$s for Advanced Shipment Tracking for WooCommerce!', 'woo-advanced-shipment-tracking' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=WooCommerce&plugin-search-input=Search+Plugins' ) ) . '">', '</a>' );
|
187 |
+
?>
|
188 |
+
</p>
|
189 |
</div>
|
190 |
<?php
|
191 |
}
|
201 |
add_action( 'add_meta_boxes', array( $this->actions, 'add_meta_box' ) );
|
202 |
add_action( 'woocommerce_view_order', array( $this->actions, 'show_tracking_info_order' ) );
|
203 |
|
204 |
+
add_action( 'woocommerce_my_account_my_orders_actions', array( $this->actions, 'add_column_my_account_orders_ast_track_column' ), 10, 2 );
|
205 |
|
206 |
add_action( 'wp_ajax_wc_shipment_tracking_delete_item', array( $this->actions, 'meta_box_delete_tracking' ) );
|
207 |
+
add_action( 'woocommerce_process_shop_order_meta', array( $this->actions, 'save_meta_box' ), 0, 2 );
|
208 |
add_action( 'wp_ajax_wc_shipment_tracking_save_form', array( $this->actions, 'save_meta_box_ajax' ) );
|
209 |
|
210 |
add_action( 'wp_ajax_reassign_order_status', array( $this, 'reassign_order_status' ) );
|
213 |
|
214 |
if ( !$preview ) {
|
215 |
$tracking_info_settings = get_option('tracking_info_settings');
|
216 |
+
if ( isset( $tracking_info_settings['display_tracking_info_at'] ) && 'after_order' == $tracking_info_settings['display_tracking_info_at'] ) {
|
217 |
add_action( 'woocommerce_email_order_meta', array( $this->actions, 'email_display' ), 0, 4 );
|
218 |
} else {
|
219 |
add_action( 'woocommerce_email_before_order_table', array( $this->actions, 'email_display' ), 0, 4 );
|
283 |
}
|
284 |
|
285 |
/*** Method load Language file ***/
|
286 |
+
public function wst_load_textdomain() {
|
287 |
load_plugin_textdomain( 'woo-advanced-shipment-tracking', false, dirname( plugin_basename(__FILE__) ) . '/lang' );
|
288 |
}
|
289 |
|
365 |
$this->admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
366 |
|
367 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-settings.php';
|
368 |
+
$this->settings = WC_Advanced_Shipment_Tracking_Settings::get_instance();
|
|
|
|
|
|
|
369 |
|
370 |
if ( !function_exists( 'trackship_for_woocommerce' ) ) {
|
371 |
|
453 |
$screen = get_current_screen();
|
454 |
|
455 |
if ( 'plugins.php' == $screen->parent_file ) {
|
456 |
+
wp_enqueue_style( 'ast_styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/admin.css', array(), wc_advanced_shipment_tracking()->version );
|
457 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
458 |
wp_enqueue_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
459 |
}
|
466 |
unset( $order_statuses['wc-partial-shipped'] );
|
467 |
unset( $order_statuses['wc-delivered'] );
|
468 |
|
469 |
+
if ( $delivered_count > 0 || $ps_count > 0 ) {
|
470 |
+
?>
|
471 |
|
472 |
<script>
|
473 |
|
520 |
<div class="popup_body">
|
521 |
<form method="post" id="order_reassign_form">
|
522 |
<?php
|
523 |
+
if ( $delivered_count > 0 ) {
|
524 |
?>
|
525 |
|
526 |
+
<p>
|
527 |
+
<?php
|
528 |
/* translators: %s: replace with delivered order count */
|
529 |
+
printf( esc_html__('We detected %s orders that use the Delivered order status, You can reassign these orders to a different status', 'woo-advanced-shipment-tracking'), esc_html( $delivered_count ) );
|
530 |
+
?>
|
531 |
</p>
|
532 |
<select id="reassign_delivered_order" name="reassign_delivered_order" class="reassign_select">
|
533 |
+
<option value=""><?php esc_html_e('Select', 'woocommerce'); ?></option>
|
534 |
+
<?php foreach ( $order_statuses as $key => $status ) { ?>
|
535 |
+
<option value="<?php esc_html_e( $key ); ?>"><?php esc_html_e( $status ); ?></option>
|
536 |
<?php } ?>
|
537 |
</select>
|
538 |
|
539 |
+
<?php
|
540 |
+
}
|
541 |
|
542 |
if ( $ps_count > 0 ) {
|
543 |
+
?>
|
544 |
+
<p>
|
545 |
+
<?php
|
546 |
/* translators: %s: replace with Partially Shipped order count */
|
547 |
+
printf( esc_html__('We detected %s orders that use the Partially Shipped order status, You can reassign these orders to a different status', 'woo-advanced-shipment-tracking'), esc_html( $ps_count ) );
|
548 |
+
?>
|
549 |
</p>
|
550 |
|
551 |
<select id="reassign_ps_order" name="reassign_ps_order" class="reassign_select">
|
552 |
+
<option value=""><?php esc_html_e('Select', 'woocommerce'); ?></option>
|
553 |
+
<?php foreach ( $order_statuses as $key => $status ) { ?>
|
554 |
+
<option value="<?php esc_html_e( $key ); ?>"><?php esc_html_e( $status ); ?></option>
|
555 |
<?php } ?>
|
556 |
</select>
|
557 |
|
558 |
<?php } ?>
|
559 |
<p>
|
560 |
+
<?php wp_nonce_field( 'ast_reassign_order_status', 'ast_reassign_order_status_nonce' ); ?>
|
561 |
<input type="hidden" name="action" value="reassign_order_status">
|
562 |
<input type="button" value="Uninstall" class="uninstall_plugin button-primary btn_ast2">
|
563 |
<input type="button" value="Close" class="uninstall_close button-primary btn_red">
|
567 |
</div>
|
568 |
<div class="popupclose"></div>
|
569 |
</div>
|
570 |
+
<?php
|
571 |
+
}
|
572 |
}
|
573 |
|
574 |
/*
|
576 |
*/
|
577 |
public function reassign_order_status() {
|
578 |
|
579 |
+
check_ajax_referer( 'ast_reassign_order_status', 'ast_reassign_order_status_nonce' );
|
580 |
+
|
581 |
$reassign_delivered_order = isset( $_POST['reassign_delivered_order'] ) ? wc_clean( $_POST['reassign_delivered_order'] ) : '';
|
582 |
$reassign_ps_order = isset( $_POST['reassign_ps_order'] ) ? wc_clean( $_POST['reassign_ps_order'] ) : '';
|
583 |
|
634 |
}
|
635 |
|
636 |
/**
|
637 |
+
* Returns an instance of Zorem_Woocommerce_Advanced_Shipment_Tracking.
|
638 |
*
|
639 |
* @since 1.6.5
|
640 |
* @version 1.6.5
|
641 |
*
|
642 |
+
* @return Zorem_Woocommerce_Advanced_Shipment_Tracking
|
643 |
*/
|
644 |
function wc_advanced_shipment_tracking() {
|
645 |
static $instance;
|
646 |
|
647 |
if ( ! isset( $instance ) ) {
|
648 |
+
$instance = new Zorem_Woocommerce_Advanced_Shipment_Tracking();
|
649 |
}
|
650 |
|
651 |
return $instance;
|
656 |
*
|
657 |
* Backward compatibility.
|
658 |
*/
|
659 |
+
wc_advanced_shipment_tracking();
|