Version Description
- Dev - When user disconnect Trackship and connect again than Trackship enable automatically
- Fix - Removed custom order status from the Documents tab of WooCommerce PDF Invoices & Packing Slips plugin if the custom order status is disabled
- Dev - Removed Woocommerce PDF Invoices & Packing Slips plugin compatibility code from the plugin
- Enhancement - Added option for hiding Tracking Header in tracking display customizer
- Dev - Change return URL of shipment status customizer, so it will return back to the notifications tab
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 2.9.9.6 |
Comparing to | |
See all releases |
Code changes from version 2.9.9.3 to 2.9.9.6
- assets/css/admin.css +13 -6
- assets/css/customizer-styles.css +9 -0
- assets/css/icons/On-hold-v3.png +0 -0
- assets/css/icons/shipped-o.png +0 -0
- assets/js/admin.js +36 -26
- assets/js/customizer-scripts.js +40 -9
- assets/js/preview-scripts.js +28 -0
- assets/js/settings.js +18 -0
- assets/js/shipping_row.js +3 -5
- assets/shipment-provider-img/fastway-ireland.png +0 -0
- assets/shipment-provider-img/gls-pakete.png +0 -0
- assets/shipment-provider-img/wahana.png +0 -0
- includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php +2 -0
- includes/class-wc-advanced-shipment-tracking-admin.php +108 -99
- includes/class-wc-advanced-shipment-tracking-api-call.php +3 -1
- includes/class-wc-advanced-shipment-tracking-front.php +7 -6
- includes/class-wc-advanced-shipment-tracking-install.php +25 -1
- includes/class-wc-advanced-shipment-tracking-settings.php +25 -20
- includes/class-wc-advanced-shipment-tracking.php +127 -276
- includes/customizer/class-wc-shipped-email-customizer.php +430 -0
- includes/customizer/class-wc-tracking-info-customizer.php +18 -0
- includes/customizer/class-wcast-customizer.php +22 -3
- includes/customizer/preview/shipped_preview.php +30 -0
- includes/email-manager.php +18 -9
- includes/emails/class-shipment-delivered-email.php +4 -5
- includes/views/admin_options_addons.php +2 -1
- includes/views/admin_options_settings.php +5 -5
- includes/views/admin_status_notifications.php +15 -16
- includes/views/admin_trackship_dashboard.php +3 -3
- readme.txt +38 -80
- templates/emails/customer-shipped-order.php +85 -0
- templates/emails/tracking-info.php +12 -6
- templates/myaccount/tracking-info.php +10 -6
- woocommerce-advanced-shipment-tracking.php +9 -12
assets/css/admin.css
CHANGED
@@ -303,7 +303,7 @@ input.tab_input_1:checked + label{
|
|
303 |
.ast_admin_content .form-table .wp-color-result.button {
|
304 |
margin: 0 6px 0px 0;
|
305 |
}
|
306 |
-
#wc_ast_status_label_color,#wc_ast_status_partial_shipped_label_color,#wc_ast_status_updated_tracking_label_color,#wc_ast_select_primary_color,#wc_ast_select_border_color {
|
307 |
width: 80px;
|
308 |
}
|
309 |
.color_field input[type=text] {
|
@@ -1424,7 +1424,7 @@ p.delivered_message {
|
|
1424 |
border: 0;
|
1425 |
background: #fafeff;
|
1426 |
}
|
1427 |
-
#
|
1428 |
border-bottom: 0;
|
1429 |
}
|
1430 |
.woocommerce.zorem_admin_layout table.form-table.heading-table td{
|
@@ -1459,6 +1459,9 @@ p.delivered_message {
|
|
1459 |
.woocommerce.zorem_admin_layout table.form-table.table-layout-2 th.titledesc{
|
1460 |
padding: 20px 15px 20px 15px;
|
1461 |
}
|
|
|
|
|
|
|
1462 |
.woocommerce.zorem_admin_layout table.form-table td{
|
1463 |
padding: 15px 15px;
|
1464 |
}
|
@@ -1947,10 +1950,6 @@ span.tracking_product_list {
|
|
1947 |
.order-status-table tr td.status-label-column{
|
1948 |
width:130px;
|
1949 |
}
|
1950 |
-
.form-table .multiple_checkbox {
|
1951 |
-
display: inline-block;
|
1952 |
-
padding-right: 20px;
|
1953 |
-
}
|
1954 |
.order-status-table .wp-picker-container,.tracking_page_table .wp-picker-container {
|
1955 |
display: inline-block;
|
1956 |
vertical-align: middle;
|
@@ -2159,6 +2158,9 @@ table.form-table.heading-table.disable_tracking_page {
|
|
2159 |
.right-div{
|
2160 |
width: 60%;
|
2161 |
}
|
|
|
|
|
|
|
2162 |
}
|
2163 |
@media screen and (max-width: 820px) {
|
2164 |
.nav_doc_section{
|
@@ -2213,4 +2215,9 @@ table.form-table.heading-table.disable_tracking_page {
|
|
2213 |
.plugin-logo{
|
2214 |
max-width: 300px;
|
2215 |
}
|
|
|
|
|
|
|
|
|
|
|
2216 |
}
|
303 |
.ast_admin_content .form-table .wp-color-result.button {
|
304 |
margin: 0 6px 0px 0;
|
305 |
}
|
306 |
+
#wc_ast_status_label_color,#wc_ast_status_partial_shipped_label_color,#wc_ast_status_updated_tracking_label_color,#wc_ast_select_primary_color,#wc_ast_select_border_color,#wc_ast_shipped_status_label_color {
|
307 |
width: 80px;
|
308 |
}
|
309 |
.color_field input[type=text] {
|
1424 |
border: 0;
|
1425 |
background: #fafeff;
|
1426 |
}
|
1427 |
+
#wc_ast_trackship_form table.form-table.heading-table tr,#wc_ast_upload_csv_form table.form-table.heading-table tr{
|
1428 |
border-bottom: 0;
|
1429 |
}
|
1430 |
.woocommerce.zorem_admin_layout table.form-table.heading-table td{
|
1459 |
.woocommerce.zorem_admin_layout table.form-table.table-layout-2 th.titledesc{
|
1460 |
padding: 20px 15px 20px 15px;
|
1461 |
}
|
1462 |
+
.woocommerce.zorem_admin_layout table.form-table.table-single-column td fieldset{
|
1463 |
+
margin-top: 10px;
|
1464 |
+
}
|
1465 |
.woocommerce.zorem_admin_layout table.form-table td{
|
1466 |
padding: 15px 15px;
|
1467 |
}
|
1950 |
.order-status-table tr td.status-label-column{
|
1951 |
width:130px;
|
1952 |
}
|
|
|
|
|
|
|
|
|
1953 |
.order-status-table .wp-picker-container,.tracking_page_table .wp-picker-container {
|
1954 |
display: inline-block;
|
1955 |
vertical-align: middle;
|
2158 |
.right-div{
|
2159 |
width: 60%;
|
2160 |
}
|
2161 |
+
span.provider_name {
|
2162 |
+
font-size: 12px;
|
2163 |
+
}
|
2164 |
}
|
2165 |
@media screen and (max-width: 820px) {
|
2166 |
.nav_doc_section{
|
2215 |
.plugin-logo{
|
2216 |
max-width: 300px;
|
2217 |
}
|
2218 |
+
}
|
2219 |
+
@media screen and (min-width: 768px) and (max-width: 1050px) {
|
2220 |
+
.provider{
|
2221 |
+
width: 33.3%;
|
2222 |
+
}
|
2223 |
}
|
assets/css/customizer-styles.css
CHANGED
@@ -59,6 +59,15 @@
|
|
59 |
display: inline-block;
|
60 |
vertical-align: middle;
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
#accordion-section-customer_failure_email>h3:before{
|
63 |
content: ' ';
|
64 |
background-image: url(icons/failure-v4.png);
|
59 |
display: inline-block;
|
60 |
vertical-align: middle;
|
61 |
}
|
62 |
+
#accordion-section-customer_shipped_email>h3:before{
|
63 |
+
content: ' ';
|
64 |
+
background-image: url(icons/shipped-o.png);
|
65 |
+
width: 20px;
|
66 |
+
height: 20px;
|
67 |
+
background-size: cover;
|
68 |
+
display: inline-block;
|
69 |
+
vertical-align: middle;
|
70 |
+
}
|
71 |
#accordion-section-customer_failure_email>h3:before{
|
72 |
content: ' ';
|
73 |
background-image: url(icons/failure-v4.png);
|
assets/css/icons/On-hold-v3.png
CHANGED
Binary file
|
assets/css/icons/shipped-o.png
ADDED
Binary file
|
assets/js/admin.js
CHANGED
@@ -12,9 +12,9 @@ jQuery( function( $ ) {
|
|
12 |
|
13 |
// When a user enters a new tracking item
|
14 |
save_form: function () {
|
15 |
-
|
16 |
var tracking_number = jQuery("#tracking_number");
|
17 |
-
var tracking_provider = jQuery("#tracking_provider");
|
18 |
|
19 |
if( tracking_number.val() === '' ){
|
20 |
showerror( tracking_number );error = true;
|
@@ -35,16 +35,17 @@ jQuery( function( $ ) {
|
|
35 |
hideerror(tracking_provider);
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
48 |
}
|
49 |
|
50 |
if(qty == false){
|
@@ -127,7 +128,6 @@ jQuery( function( $ ) {
|
|
127 |
$( 'input#tracking_number' ).val( '' );
|
128 |
$( 'input#date_shipped' ).val( '' );
|
129 |
if(checked == 'change_order_to_shipped'){
|
130 |
-
jQuery('#order_status').val('wc-completed');
|
131 |
jQuery('#order_status').select2().trigger('change');
|
132 |
jQuery('#post').before('<div id="order_updated_message" class="updated notice notice-success is-dismissible"><p>Order updated.</p><button type="button" class="notice-dismiss update-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>');
|
133 |
} else if(checked == 'change_order_to_partial_shipped'){
|
@@ -148,6 +148,7 @@ jQuery( function( $ ) {
|
|
148 |
show_form: function () {
|
149 |
$( '#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form' ).show();
|
150 |
$( '#woocommerce-advanced-shipment-tracking .button-show-tracking-form' ).hide();
|
|
|
151 |
},
|
152 |
|
153 |
// Delete a tracking item
|
@@ -298,8 +299,14 @@ jQuery(document).on("click", ".add_inline_tracking", function(){
|
|
298 |
type: 'POST',
|
299 |
success: function(response) {
|
300 |
jQuery( ".add_tracking_popup" ).remove();
|
301 |
-
jQuery("body").append(response);
|
302 |
jQuery('.add_tracking_popup').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
var selected_provider = jQuery("#tracking_provider").val();
|
304 |
|
305 |
if(selected_provider == 'nz-couriers' || selected_provider == 'post-haste' || selected_provider == 'castle-parcels' || selected_provider == 'dx-mail' || selected_provider == 'now-couriers'){
|
@@ -337,11 +344,12 @@ jQuery(document).on("submit", "#add_tracking_number_form", function(){
|
|
337 |
|
338 |
|
339 |
if( tracking_provider.val() === '' ){
|
340 |
-
|
341 |
error = true;
|
342 |
-
} else{
|
|
|
343 |
hideerror(tracking_provider);
|
344 |
-
}
|
345 |
|
346 |
if( tracking_number.val() === '' ){
|
347 |
showerror(tracking_number);
|
@@ -364,15 +372,17 @@ jQuery(document).on("submit", "#add_tracking_number_form", function(){
|
|
364 |
}
|
365 |
|
366 |
|
367 |
-
if(jQuery(
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
|
|
376 |
}
|
377 |
|
378 |
if(qty == false){
|
12 |
|
13 |
// When a user enters a new tracking item
|
14 |
save_form: function () {
|
15 |
+
var error;
|
16 |
var tracking_number = jQuery("#tracking_number");
|
17 |
+
var tracking_provider = jQuery("#tracking_provider");
|
18 |
|
19 |
if( tracking_number.val() === '' ){
|
20 |
showerror( tracking_number );error = true;
|
35 |
hideerror(tracking_provider);
|
36 |
}
|
37 |
|
38 |
+
if(jQuery('.enable_tracking_per_item').prop("checked") == true){
|
39 |
+
if(jQuery("tr").hasClass("ASTProduct_row")){
|
40 |
+
var qty = false;
|
41 |
+
jQuery(".ASTProduct_row").each(function(index){
|
42 |
+
var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
|
43 |
+
if(ASTProduct_qty > 0){
|
44 |
+
qty = true;
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
});
|
48 |
+
}
|
49 |
}
|
50 |
|
51 |
if(qty == false){
|
128 |
$( 'input#tracking_number' ).val( '' );
|
129 |
$( 'input#date_shipped' ).val( '' );
|
130 |
if(checked == 'change_order_to_shipped'){
|
|
|
131 |
jQuery('#order_status').select2().trigger('change');
|
132 |
jQuery('#post').before('<div id="order_updated_message" class="updated notice notice-success is-dismissible"><p>Order updated.</p><button type="button" class="notice-dismiss update-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>');
|
133 |
} else if(checked == 'change_order_to_partial_shipped'){
|
148 |
show_form: function () {
|
149 |
$( '#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form' ).show();
|
150 |
$( '#woocommerce-advanced-shipment-tracking .button-show-tracking-form' ).hide();
|
151 |
+
$( "#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form #tracking_number" ).focus();
|
152 |
},
|
153 |
|
154 |
// Delete a tracking item
|
299 |
type: 'POST',
|
300 |
success: function(response) {
|
301 |
jQuery( ".add_tracking_popup" ).remove();
|
302 |
+
jQuery("body").append(response);
|
303 |
jQuery('.add_tracking_popup').show();
|
304 |
+
jQuery( "#add_tracking_number_form #tracking_number" ).focus();
|
305 |
+
|
306 |
+
jQuery('#tracking_provider').select2({
|
307 |
+
matcher: modelMatcher
|
308 |
+
});
|
309 |
+
|
310 |
var selected_provider = jQuery("#tracking_provider").val();
|
311 |
|
312 |
if(selected_provider == 'nz-couriers' || selected_provider == 'post-haste' || selected_provider == 'castle-parcels' || selected_provider == 'dx-mail' || selected_provider == 'now-couriers'){
|
344 |
|
345 |
|
346 |
if( tracking_provider.val() === '' ){
|
347 |
+
jQuery("#tracking_provider").siblings('.select2-container').find('.select2-selection').css('border-color','red');
|
348 |
error = true;
|
349 |
+
} else{
|
350 |
+
jQuery("#tracking_provider").siblings('.select2-container').find('.select2-selection').css('border-color','#ddd');
|
351 |
hideerror(tracking_provider);
|
352 |
+
}
|
353 |
|
354 |
if( tracking_number.val() === '' ){
|
355 |
showerror(tracking_number);
|
372 |
}
|
373 |
|
374 |
|
375 |
+
if(jQuery('.enable_tracking_per_item').prop("checked") == true){
|
376 |
+
if(jQuery("tr").hasClass("ASTProduct_row")){
|
377 |
+
var qty = false;
|
378 |
+
jQuery(".ASTProduct_row").each(function(index){
|
379 |
+
var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
|
380 |
+
if(ASTProduct_qty > 0){
|
381 |
+
qty = true;
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
});
|
385 |
+
}
|
386 |
}
|
387 |
|
388 |
if(qty == false){
|
assets/js/customizer-scripts.js
CHANGED
@@ -7,7 +7,7 @@ jQuery(document).ready(function() {
|
|
7 |
|
8 |
/**
|
9 |
* Change description
|
10 |
-
*/
|
11 |
jQuery(wcast_customizer.trigger_click).trigger( "click" );
|
12 |
jQuery('#customize-theme-controls #accordion-section-themes').hide();
|
13 |
|
@@ -19,6 +19,10 @@ jQuery(document).ready(function() {
|
|
19 |
jQuery('#customize-control-tracking_info_settings-track_header_text').hide();
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
22 |
if(jQuery("#customize-control-woocommerce_customer_delivered_order_settings-wcast_enable_delivered_ga_tracking input").prop("checked") != true){
|
23 |
jQuery('#customize-control-woocommerce_customer_delivered_order_settings-wcast_delivered_analytics_link').hide();
|
24 |
}
|
@@ -45,21 +49,15 @@ jQuery(document).ready(function() {
|
|
45 |
}
|
46 |
|
47 |
if(jQuery('#customize-control-tracking_info_settings-tracking_number_link input').prop("checked") == true){
|
48 |
-
jQuery('#customize-control-tracking_info_settings-show_track_label').hide();
|
49 |
-
|
50 |
-
//jQuery('#customize-control-tracking_info_settings-tracking_link_font_color').hide();
|
51 |
-
jQuery('#customize-control-tracking_info_settings-tracking_link_bg_color').hide();
|
52 |
-
//jQuery('#customize-control-tracking_info_settings-tracking_link_border').hide();
|
53 |
jQuery('#customize-control-tracking_info_settings-track_header_text').hide();
|
54 |
} else{
|
55 |
if(jQuery("#customize-control-tracking_info_settings-show_track_label input").prop("checked") == true && jQuery('#customize-control-tracking_info_settings-tracking_number_link input').prop("checked") != true){
|
56 |
jQuery('#customize-control-tracking_info_settings-track_header_text').show();
|
57 |
}
|
58 |
jQuery('#customize-control-tracking_info_settings-show_track_label').show();
|
59 |
-
//jQuery('#customize-control-tracking_info_settings-shipment_link_header').show();
|
60 |
-
//jQuery('#customize-control-tracking_info_settings-tracking_link_font_color').show();
|
61 |
jQuery('#customize-control-tracking_info_settings-tracking_link_bg_color').show();
|
62 |
-
//jQuery('#customize-control-tracking_info_settings-tracking_link_border').show();
|
63 |
}
|
64 |
|
65 |
var tracking_template = jQuery(".tracking_template_select").val();
|
@@ -119,6 +117,15 @@ jQuery(document).on("click", "#customize-control-tracking_info_settings-show_pro
|
|
119 |
jQuery('#customize-control-tracking_info_settings-provider_border_color').hide();
|
120 |
}
|
121 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
jQuery(document).on("change", ".tracking_template_select", function(){
|
123 |
var tracking_template = jQuery(this).val();
|
124 |
|
@@ -331,6 +338,30 @@ jQuery(document).on("change", "#_customize-input-customizer_delivered_order_sett
|
|
331 |
} );
|
332 |
} );
|
333 |
} ( wp.customize ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
(function ( api ) {
|
336 |
api.section( 'customer_updated_tracking_email', function( section ) {
|
7 |
|
8 |
/**
|
9 |
* Change description
|
10 |
+
*/
|
11 |
jQuery(wcast_customizer.trigger_click).trigger( "click" );
|
12 |
jQuery('#customize-theme-controls #accordion-section-themes').hide();
|
13 |
|
19 |
jQuery('#customize-control-tracking_info_settings-track_header_text').hide();
|
20 |
}
|
21 |
|
22 |
+
if(jQuery("#customize-control-tracking_info_settings-hide_trackig_header input").prop("checked") == true){
|
23 |
+
jQuery('#customize-control-tracking_info_settings-header_text_change').hide();
|
24 |
+
}
|
25 |
+
|
26 |
if(jQuery("#customize-control-woocommerce_customer_delivered_order_settings-wcast_enable_delivered_ga_tracking input").prop("checked") != true){
|
27 |
jQuery('#customize-control-woocommerce_customer_delivered_order_settings-wcast_delivered_analytics_link').hide();
|
28 |
}
|
49 |
}
|
50 |
|
51 |
if(jQuery('#customize-control-tracking_info_settings-tracking_number_link input').prop("checked") == true){
|
52 |
+
jQuery('#customize-control-tracking_info_settings-show_track_label').hide();
|
53 |
+
jQuery('#customize-control-tracking_info_settings-tracking_link_bg_color').hide();
|
|
|
|
|
|
|
54 |
jQuery('#customize-control-tracking_info_settings-track_header_text').hide();
|
55 |
} else{
|
56 |
if(jQuery("#customize-control-tracking_info_settings-show_track_label input").prop("checked") == true && jQuery('#customize-control-tracking_info_settings-tracking_number_link input').prop("checked") != true){
|
57 |
jQuery('#customize-control-tracking_info_settings-track_header_text').show();
|
58 |
}
|
59 |
jQuery('#customize-control-tracking_info_settings-show_track_label').show();
|
|
|
|
|
60 |
jQuery('#customize-control-tracking_info_settings-tracking_link_bg_color').show();
|
|
|
61 |
}
|
62 |
|
63 |
var tracking_template = jQuery(".tracking_template_select").val();
|
117 |
jQuery('#customize-control-tracking_info_settings-provider_border_color').hide();
|
118 |
}
|
119 |
});
|
120 |
+
|
121 |
+
jQuery(document).on("click", "#customize-control-tracking_info_settings-hide_trackig_header input", function(){
|
122 |
+
if(jQuery(this).prop("checked") == true){
|
123 |
+
jQuery('#customize-control-tracking_info_settings-header_text_change').hide();
|
124 |
+
} else{
|
125 |
+
jQuery('#customize-control-tracking_info_settings-header_text_change').show();
|
126 |
+
}
|
127 |
+
});
|
128 |
+
|
129 |
jQuery(document).on("change", ".tracking_template_select", function(){
|
130 |
var tracking_template = jQuery(this).val();
|
131 |
|
338 |
} );
|
339 |
} );
|
340 |
} ( wp.customize ) );
|
341 |
+
(function ( api ) {
|
342 |
+
api.section( 'customer_custom_completed_email', function( section ) {
|
343 |
+
section.expanded.bind( function( isExpanded ) {
|
344 |
+
var url;
|
345 |
+
if ( isExpanded ) {
|
346 |
+
jQuery('#save').trigger('click');
|
347 |
+
url = wcast_customizer.custom_completed_email_preview_url;
|
348 |
+
api.previewer.previewUrl.set( url );
|
349 |
+
}
|
350 |
+
} );
|
351 |
+
} );
|
352 |
+
} ( wp.customize ) );
|
353 |
+
(function ( api ) {
|
354 |
+
api.section( 'customer_shipped_email', function( section ) {
|
355 |
+
section.expanded.bind( function( isExpanded ) {
|
356 |
+
var url;
|
357 |
+
if ( isExpanded ) {
|
358 |
+
jQuery('#save').trigger('click');
|
359 |
+
url = wcast_customizer.shipped_email_preview_url;
|
360 |
+
api.previewer.previewUrl.set( url );
|
361 |
+
}
|
362 |
+
} );
|
363 |
+
} );
|
364 |
+
} ( wp.customize ) );
|
365 |
|
366 |
(function ( api ) {
|
367 |
api.section( 'customer_updated_tracking_email', function( section ) {
|
assets/js/preview-scripts.js
CHANGED
@@ -21,6 +21,7 @@
|
|
21 |
}
|
22 |
});
|
23 |
});
|
|
|
24 |
wp.customize( 'tracking_info_settings[show_track_label]', function( value ) {
|
25 |
value.bind( function( show_track_label ) {
|
26 |
if( show_track_label ){
|
@@ -31,6 +32,17 @@
|
|
31 |
}
|
32 |
});
|
33 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
wp.customize( 'tracking_info_settings[header_text_change]', function( value ) {
|
35 |
value.bind( function( header_text ) {
|
36 |
if( header_text ){
|
@@ -40,6 +52,7 @@
|
|
40 |
}
|
41 |
});
|
42 |
});
|
|
|
43 |
wp.customize( 'tracking_info_settings[additional_header_text]', function( value ) {
|
44 |
value.bind( function( additional_header_text ) {
|
45 |
if( additional_header_text ){
|
@@ -397,4 +410,19 @@
|
|
397 |
$( '.tracking_list_div' ).css( 'border-bottom','1px solid '+provider_border_color );
|
398 |
} );
|
399 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
} )( jQuery );
|
21 |
}
|
22 |
});
|
23 |
});
|
24 |
+
|
25 |
wp.customize( 'tracking_info_settings[show_track_label]', function( value ) {
|
26 |
value.bind( function( show_track_label ) {
|
27 |
if( show_track_label ){
|
32 |
}
|
33 |
});
|
34 |
});
|
35 |
+
|
36 |
+
wp.customize( 'tracking_info_settings[hide_trackig_header]', function( value ) {
|
37 |
+
value.bind( function( hide_trackig_header ) {
|
38 |
+
if( hide_trackig_header ){
|
39 |
+
$( '.header_text' ).hide();
|
40 |
+
} else{
|
41 |
+
$( '.header_text' ).show();
|
42 |
+
}
|
43 |
+
});
|
44 |
+
});
|
45 |
+
|
46 |
wp.customize( 'tracking_info_settings[header_text_change]', function( value ) {
|
47 |
value.bind( function( header_text ) {
|
48 |
if( header_text ){
|
52 |
}
|
53 |
});
|
54 |
});
|
55 |
+
|
56 |
wp.customize( 'tracking_info_settings[additional_header_text]', function( value ) {
|
57 |
value.bind( function( additional_header_text ) {
|
58 |
if( additional_header_text ){
|
410 |
$( '.tracking_list_div' ).css( 'border-bottom','1px solid '+provider_border_color );
|
411 |
} );
|
412 |
} );
|
413 |
+
|
414 |
+
wp.customize( 'woocommerce_wc_customer_custom_completed_order_settings[heading]', function( value ) {
|
415 |
+
value.bind( function( wcast_custom_completed_email_heading ) {
|
416 |
+
|
417 |
+
var str = wcast_custom_completed_email_heading;
|
418 |
+
var res = str.replace("{site_title}", wcast_preview.site_title);
|
419 |
+
var res = res.replace("{order_number}", wcast_preview.order_number);
|
420 |
+
|
421 |
+
if( wcast_custom_completed_email_heading ){
|
422 |
+
$( '#header_wrapper h1' ).text(res);
|
423 |
+
} else{
|
424 |
+
$( '#header_wrapper h1' ).text('');
|
425 |
+
}
|
426 |
+
});
|
427 |
+
});
|
428 |
} )( jQuery );
|
assets/js/settings.js
CHANGED
@@ -6,6 +6,14 @@ jQuery(document).on("click", "#wc_ast_status_delivered", function(){
|
|
6 |
}
|
7 |
});
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
jQuery(document).on("click", "#wc_ast_status_partial_shipped", function(){
|
10 |
if(jQuery(this).prop("checked") == true){
|
11 |
jQuery(this).closest('tr').removeClass('disable_row');
|
@@ -42,6 +50,12 @@ jQuery( document ).ready(function() {
|
|
42 |
jQuery('.order-status-table .order-label.wc-delivered').css('background',color);
|
43 |
},
|
44 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
jQuery('#wc_ast_status_partial_shipped_label_color').wpColorPicker({
|
46 |
change: function(e, ui) {
|
47 |
var color = ui.color.toString();
|
@@ -82,6 +96,10 @@ jQuery(document).on("change", "#wc_ast_status_label_font_color", function(){
|
|
82 |
var font_color = jQuery(this).val();
|
83 |
jQuery('.order-status-table .order-label.wc-delivered').css('color',font_color);
|
84 |
});
|
|
|
|
|
|
|
|
|
85 |
jQuery(document).on("change", "#wc_ast_status_partial_shipped_label_font_color", function(){
|
86 |
var font_color = jQuery(this).val();
|
87 |
jQuery('.order-status-table .order-label.wc-partially-shipped').css('color',font_color);
|
6 |
}
|
7 |
});
|
8 |
|
9 |
+
jQuery(document).on("click", "#wc_ast_status_shipped_active", function(){
|
10 |
+
if(jQuery(this).prop("checked") == true){
|
11 |
+
jQuery(this).closest('tr').removeClass('disable_row');
|
12 |
+
} else{
|
13 |
+
jQuery(this).closest('tr').addClass('disable_row');
|
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');
|
50 |
jQuery('.order-status-table .order-label.wc-delivered').css('background',color);
|
51 |
},
|
52 |
});
|
53 |
+
jQuery('#wc_ast_shipped_status_label_color').wpColorPicker({
|
54 |
+
change: function(e, ui) {
|
55 |
+
var color = ui.color.toString();
|
56 |
+
jQuery('.order-status-table .order-label.wc-shipped').css('background',color);
|
57 |
+
},
|
58 |
+
});
|
59 |
jQuery('#wc_ast_status_partial_shipped_label_color').wpColorPicker({
|
60 |
change: function(e, ui) {
|
61 |
var color = ui.color.toString();
|
96 |
var font_color = jQuery(this).val();
|
97 |
jQuery('.order-status-table .order-label.wc-delivered').css('color',font_color);
|
98 |
});
|
99 |
+
jQuery(document).on("change", "#wc_ast_shipped_status_label_font_color", function(){
|
100 |
+
var font_color = jQuery(this).val();
|
101 |
+
jQuery('.order-status-table .order-label.wc-shipped').css('color',font_color);
|
102 |
+
});
|
103 |
jQuery(document).on("change", "#wc_ast_status_partial_shipped_label_font_color", function(){
|
104 |
var font_color = jQuery(this).val();
|
105 |
jQuery('.order-status-table .order-label.wc-partially-shipped').css('color',font_color);
|
assets/js/shipping_row.js
CHANGED
@@ -18,12 +18,11 @@
|
|
18 |
},
|
19 |
|
20 |
save_wc_ast_settings_form: function( event ) {
|
21 |
-
event.preventDefault();
|
22 |
-
|
23 |
$wc_ast_settings_form.find(".spinner").addClass("active");
|
24 |
var ajax_data = $wc_ast_settings_form.serialize();
|
25 |
|
26 |
-
$.post( ajaxurl, ajax_data, function(response) {
|
27 |
$wc_ast_settings_form.find(".spinner").removeClass("active");
|
28 |
var snackbarContainer = document.querySelector('#demo-toast-example');
|
29 |
var data = {message: shipment_tracking_table_rows.i18n.data_saved };
|
@@ -1177,5 +1176,4 @@ var getUrlParameter = function getUrlParameter(sParam) {
|
|
1177 |
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
1178 |
}
|
1179 |
}
|
1180 |
-
};
|
1181 |
-
|
18 |
},
|
19 |
|
20 |
save_wc_ast_settings_form: function( event ) {
|
21 |
+
event.preventDefault();
|
|
|
22 |
$wc_ast_settings_form.find(".spinner").addClass("active");
|
23 |
var ajax_data = $wc_ast_settings_form.serialize();
|
24 |
|
25 |
+
$.post( ajaxurl, ajax_data, function(response) {
|
26 |
$wc_ast_settings_form.find(".spinner").removeClass("active");
|
27 |
var snackbarContainer = document.querySelector('#demo-toast-example');
|
28 |
var data = {message: shipment_tracking_table_rows.i18n.data_saved };
|
1176 |
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
1177 |
}
|
1178 |
}
|
1179 |
+
};
|
|
assets/shipment-provider-img/fastway-ireland.png
ADDED
Binary file
|
assets/shipment-provider-img/gls-pakete.png
ADDED
Binary file
|
assets/shipment-provider-img/wahana.png
ADDED
Binary file
|
includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php
CHANGED
@@ -163,6 +163,7 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
|
|
163 |
if(empty($wc_ast_api_key)){
|
164 |
update_option('wc_ast_api_key',$request['user_key']);
|
165 |
}
|
|
|
166 |
if($wc_ast_api_enabled == ''){
|
167 |
update_option('wc_ast_api_enabled',1);
|
168 |
}
|
@@ -325,6 +326,7 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
|
|
325 |
public function disconnect_from_trackship_fun($request){
|
326 |
$add_key = update_option( 'wc_ast_api_key', '' );
|
327 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 0 );
|
|
|
328 |
delete_option( 'trackers_balance' );
|
329 |
}
|
330 |
|
163 |
if(empty($wc_ast_api_key)){
|
164 |
update_option('wc_ast_api_key',$request['user_key']);
|
165 |
}
|
166 |
+
|
167 |
if($wc_ast_api_enabled == ''){
|
168 |
update_option('wc_ast_api_enabled',1);
|
169 |
}
|
326 |
public function disconnect_from_trackship_fun($request){
|
327 |
$add_key = update_option( 'wc_ast_api_key', '' );
|
328 |
$wc_ast_api_enabled = update_option( 'wc_ast_api_enabled', 0 );
|
329 |
+
delete_option( 'wc_ast_api_enabled' );
|
330 |
delete_option( 'trackers_balance' );
|
331 |
}
|
332 |
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -62,11 +62,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
62 |
/*
|
63 |
* init from parent mail class
|
64 |
*/
|
65 |
-
public function init(){
|
66 |
-
|
67 |
-
//database check
|
68 |
-
add_action( 'init', array( $this, 'database_table_check') );
|
69 |
-
|
70 |
//cron_schedules
|
71 |
add_filter( 'cron_schedules', array( $this, 'add_cron_interval') );
|
72 |
|
@@ -101,12 +97,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
101 |
|
102 |
// add bulk order filter for exported / non-exported orders
|
103 |
add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
|
104 |
-
add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
|
105 |
-
|
106 |
-
// add bulk order tracking number filter for exported / non-exported orders
|
107 |
-
add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'filter_orders_by_tracking_number_query' ) );
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
// trigger when order status changed to shipped or completed
|
111 |
add_action( 'woocommerce_order_status_completed', array( $this, 'trigger_woocommerce_order_status_completed'), 10, 1 );
|
112 |
|
@@ -160,28 +160,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
160 |
if ( is_plugin_active( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' ) ) {
|
161 |
if( !$this->licence_valid() )add_action( 'admin_notices', array( $this, 'ast_product_licence_notice') );
|
162 |
}
|
163 |
-
}
|
164 |
-
|
165 |
-
/*
|
166 |
-
* database table check
|
167 |
-
*/
|
168 |
-
function database_table_check(){
|
169 |
-
global $wpdb;
|
170 |
-
$table_name = $wpdb->prefix.'shipment_batch_process';
|
171 |
-
$charset_collate = $wpdb->get_charset_collate();
|
172 |
-
|
173 |
-
$sql = "CREATE TABLE `{$table_name}` (
|
174 |
-
id int NOT NULL AUTO_INCREMENT,
|
175 |
-
order_id text NULL,
|
176 |
-
PRIMARY KEY (id)
|
177 |
-
) $charset_collate;";
|
178 |
-
|
179 |
-
if ( !function_exists( 'maybe_create_table' ) ) {
|
180 |
-
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
|
181 |
-
}
|
182 |
-
maybe_create_table( $table_name, $sql );
|
183 |
-
}
|
184 |
-
|
185 |
|
186 |
/*
|
187 |
* add_cron_interval
|
@@ -227,7 +206,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
227 |
$range = get_option('wc_ast_api_date_range', 30 );
|
228 |
$args = array(
|
229 |
'status' => 'wc-completed',
|
230 |
-
'limit' =>
|
231 |
);
|
232 |
if( $range != 0 ){
|
233 |
$start = strtotime( date( 'Y-m-d 00:00:00', strtotime( '-'.$range.' days' ) ));
|
@@ -236,29 +215,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
236 |
}
|
237 |
|
238 |
return $orders = wc_get_orders( $args );
|
239 |
-
}
|
240 |
-
|
241 |
-
/*
|
242 |
-
* add in batch process
|
243 |
-
*/
|
244 |
-
function add_in_batch_process( $order_id ){
|
245 |
-
global $wpdb;
|
246 |
-
$table_name = $wpdb->prefix.'shipment_batch_process';
|
247 |
-
$data = array(
|
248 |
-
'order_id' => $order_id
|
249 |
-
);
|
250 |
-
$wpdb->insert( $table_name, $data );
|
251 |
-
return $wpdb->insert_id;
|
252 |
-
}
|
253 |
-
|
254 |
-
/*
|
255 |
-
* remove from batch process
|
256 |
-
*/
|
257 |
-
function remove_from_batch_process( $batch_process_id ){
|
258 |
-
global $wpdb;
|
259 |
-
$table_name = $wpdb->prefix.'shipment_batch_process';
|
260 |
-
$wpdb->delete( $table_name, array( 'id' => $batch_process_id ) );
|
261 |
-
}
|
262 |
|
263 |
/*
|
264 |
* shipment api call
|
@@ -634,9 +591,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
634 |
}?>
|
635 |
<span class=" multiple_checkbox">
|
636 |
<label class="" for="<?php echo $key?>">
|
637 |
-
<span class="multiple_label"><?php echo $val['status']; ?></span>
|
638 |
<input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
|
639 |
<input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
|
|
|
640 |
</br>
|
641 |
</label>
|
642 |
</span>
|
@@ -659,9 +616,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
659 |
<?php } ?>
|
660 |
<span class="multiple_checkbox">
|
661 |
<label class="" for="<?php echo $key?>">
|
662 |
-
<span class="multiple_label"><?php echo $val['status']; ?></span>
|
663 |
<input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
|
664 |
-
<input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
|
|
|
665 |
</br>
|
666 |
</label>
|
667 |
</span>
|
@@ -746,9 +703,21 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
746 |
<?php } ?>
|
747 |
</select>
|
748 |
</fieldset>
|
749 |
-
<?php } elseif( $array['type'] == '
|
750 |
-
|
751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
<fieldset>
|
753 |
<?php if($array['connected'] == true){ ?>
|
754 |
<a href="https://my.trackship.info/" target="_blank">
|
@@ -787,8 +756,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
787 |
</tbody>
|
788 |
</table>
|
789 |
<?php
|
790 |
-
}
|
791 |
-
|
792 |
|
793 |
/*
|
794 |
* get html of fields
|
@@ -1063,14 +1031,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1063 |
$form_data = array(
|
1064 |
'wc_ast_api_enabled' => array(
|
1065 |
'type' => 'checkbox',
|
1066 |
-
'title' => __( 'Enable/Disable', 'woo-advanced-shipment-tracking' ),
|
1067 |
'show' => $show_trackship_field,
|
1068 |
'class' => '',
|
1069 |
),
|
1070 |
'wc_ast_status_change_to_delivered' => array(
|
1071 |
'type' => 'checkbox',
|
1072 |
-
'title' => __( 'Set order status
|
1073 |
-
'show' => $show_trackship_field,
|
1074 |
'class' => '',
|
1075 |
'disabled' => $disabled_change_to_delivered,
|
1076 |
),
|
@@ -1260,7 +1227,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1260 |
*/
|
1261 |
function get_settings_data(){
|
1262 |
|
1263 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
1264 |
if($wc_ast_status_shipped == 1){
|
1265 |
$completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
1266 |
$mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>"', 'woo-advanced-shipment-tracking' );
|
@@ -1278,11 +1245,12 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1278 |
'wc-processing' => 'Processing',
|
1279 |
'wc-on-hold' => 'On hold',
|
1280 |
'wc-completed' => 'Completed',
|
1281 |
-
'wc-delivered' => 'Delivered',
|
1282 |
-
//'wc-partial-shipped' => 'Partially Shipped',
|
1283 |
'wc-cancelled' => 'Cancelled',
|
1284 |
'wc-refunded' => 'Refunded',
|
1285 |
-
'wc-failed' => 'Failed'
|
|
|
|
|
1286 |
);
|
1287 |
foreach($default_order_status as $key=>$value){
|
1288 |
unset($all_order_status[$key]);
|
@@ -1305,7 +1273,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1305 |
"show_in_customer_invoice" => array(
|
1306 |
'status' => __( 'Customer Invoice', 'woocommerce' ),
|
1307 |
'type' => 'default',
|
1308 |
-
),
|
1309 |
"refunded" => array(
|
1310 |
'status' => __( 'Refunded', 'woocommerce' ),
|
1311 |
'type' => 'default',
|
@@ -1321,17 +1289,21 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1321 |
"completed" => array(
|
1322 |
'status' => $completed_order_label,
|
1323 |
'type' => 'default',
|
|
|
|
|
|
|
|
|
1324 |
),
|
1325 |
);
|
1326 |
-
$order_status_array = array_merge($order_status,$custom_order_status);
|
1327 |
-
|
1328 |
if ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) {
|
1329 |
$show_invoice_field = true;
|
1330 |
} else{
|
1331 |
$show_invoice_field = false;
|
1332 |
-
}
|
1333 |
|
1334 |
-
$form_data = array(
|
1335 |
'wc_ast_status_shipped' => array(
|
1336 |
'type' => 'checkbox',
|
1337 |
'title' => __( 'Rename the “Completed” Order status to “Shipped”', 'woo-advanced-shipment-tracking' ),
|
@@ -1347,26 +1319,15 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1347 |
),
|
1348 |
'wc_ast_unclude_tracking_info' => array(
|
1349 |
'type' => 'multiple_checkbox',
|
1350 |
-
'title' => __( 'On which order status email to include the shipment tracking info?', 'woo-advanced-shipment-tracking' ),
|
|
|
1351 |
'show' => true,
|
1352 |
'class' => '',
|
1353 |
-
)
|
1354 |
-
'wc_ast_show_tracking_invoice' => array(
|
1355 |
-
'type' => 'checkbox',
|
1356 |
-
'title' => __( 'Show tracking info in Invoice', 'woo-advanced-shipment-tracking' ),
|
1357 |
-
'show' => $show_invoice_field,
|
1358 |
-
'class' => '',
|
1359 |
-
),
|
1360 |
-
'wc_ast_show_tracking_packing_slip' => array(
|
1361 |
-
'type' => 'checkbox',
|
1362 |
-
'title' => __( 'Show tracking info in Packing Slip', 'woo-advanced-shipment-tracking' ),
|
1363 |
-
'show' => $show_invoice_field,
|
1364 |
-
'class' => '',
|
1365 |
-
),
|
1366 |
);
|
1367 |
return $form_data;
|
1368 |
|
1369 |
-
}
|
1370 |
|
1371 |
/*
|
1372 |
* get settings tab array data
|
@@ -1407,7 +1368,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1407 |
);
|
1408 |
return $form_data;
|
1409 |
|
1410 |
-
}
|
1411 |
|
1412 |
/*
|
1413 |
* get updated tracking status settings array data
|
@@ -1494,7 +1455,8 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1494 |
/*
|
1495 |
* settings form save
|
1496 |
*/
|
1497 |
-
function wc_ast_settings_form_update_callback(){
|
|
|
1498 |
if ( ! empty( $_POST ) && check_admin_referer( 'wc_ast_settings_form', 'wc_ast_settings_form' ) ) {
|
1499 |
|
1500 |
$data = $this->get_settings_data();
|
@@ -1503,7 +1465,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1503 |
if(isset($_POST[ $key ])){
|
1504 |
update_option( $key, $_POST[ $key ] );
|
1505 |
}
|
1506 |
-
}
|
1507 |
|
1508 |
$data = $this->get_delivered_data();
|
1509 |
|
@@ -1531,7 +1493,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1531 |
if(isset($_POST[ $key ])){
|
1532 |
update_option( $key, $_POST[ $key ] );
|
1533 |
}
|
1534 |
-
}
|
1535 |
|
1536 |
$data = $this->get_partial_shipped_data();
|
1537 |
|
@@ -1603,6 +1565,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1603 |
$bg_color = get_option('wc_ast_status_label_color','#212c42');
|
1604 |
$color = get_option('wc_ast_status_label_font_color','#fff');
|
1605 |
|
|
|
|
|
|
|
1606 |
$ps_bg_color = get_option('wc_ast_status_partial_shipped_label_color','#0c0c0c');
|
1607 |
$ps_color = get_option('wc_ast_status_partial_shipped_label_font_color','#fff');
|
1608 |
|
@@ -1613,7 +1578,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1613 |
.order-status.status-delivered,.order-status-table .order-label.wc-delivered{
|
1614 |
background: <?php echo $bg_color; ?>;
|
1615 |
color: <?php echo $color; ?>;
|
1616 |
-
}
|
|
|
|
|
|
|
|
|
1617 |
.order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
|
1618 |
background: <?php echo $ps_bg_color; ?>;
|
1619 |
color: <?php echo $ps_color; ?>;
|
@@ -2114,7 +2083,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2114 |
* Change completed order email title to Shipped Order
|
2115 |
*/
|
2116 |
public function change_completed_woocommerce_email_title($email_title, $email){
|
2117 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
2118 |
// Only on backend Woocommerce Settings "Emails" tab
|
2119 |
if($wc_ast_status_shipped == 1){
|
2120 |
if( isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab']) && $_GET['tab'] == 'email' ) {
|
@@ -2138,7 +2107,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2138 |
|
2139 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
2140 |
if($wc_ast_status_delivered){
|
2141 |
-
if ( $order->has_status( array( 'completed' ) ) ) {
|
2142 |
// Get Order ID (compatibility all WC versions)
|
2143 |
$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
|
2144 |
// Set the action button
|
@@ -2148,7 +2117,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2148 |
'action' => "delivered_icon", // keep "view" class for a clean button CSS
|
2149 |
);
|
2150 |
}
|
2151 |
-
}
|
2152 |
|
2153 |
if ( !$order->has_status( array( 'pickup','ready-pickup','on-hold','delivered','cancelled','failed' ) ) ) {
|
2154 |
$actions['add_tracking'] = array(
|
@@ -2514,7 +2483,47 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2514 |
</select>
|
2515 |
<?php
|
2516 |
}
|
2517 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2518 |
|
2519 |
/**
|
2520 |
* Get the order count for orders by shipment status
|
62 |
/*
|
63 |
* init from parent mail class
|
64 |
*/
|
65 |
+
public function init(){
|
|
|
|
|
|
|
|
|
66 |
//cron_schedules
|
67 |
add_filter( 'cron_schedules', array( $this, 'add_cron_interval') );
|
68 |
|
97 |
|
98 |
// add bulk order filter for exported / non-exported orders
|
99 |
add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
|
100 |
+
add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
+
// add bulk order tracking number filter for exported / non-exported orders
|
104 |
+
add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'filter_orders_by_tracking_number_query' ) );
|
105 |
+
|
106 |
+
// add bulk order filter for exported / non-exported orders
|
107 |
+
add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipping_provider') , 20 );
|
108 |
+
add_filter( 'request', array( $this, 'filter_orders_by_shipping_provider_query' ) );
|
109 |
+
|
110 |
// trigger when order status changed to shipped or completed
|
111 |
add_action( 'woocommerce_order_status_completed', array( $this, 'trigger_woocommerce_order_status_completed'), 10, 1 );
|
112 |
|
160 |
if ( is_plugin_active( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' ) ) {
|
161 |
if( !$this->licence_valid() )add_action( 'admin_notices', array( $this, 'ast_product_licence_notice') );
|
162 |
}
|
163 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
/*
|
166 |
* add_cron_interval
|
206 |
$range = get_option('wc_ast_api_date_range', 30 );
|
207 |
$args = array(
|
208 |
'status' => 'wc-completed',
|
209 |
+
'limit' => -1,
|
210 |
);
|
211 |
if( $range != 0 ){
|
212 |
$start = strtotime( date( 'Y-m-d 00:00:00', strtotime( '-'.$range.' days' ) ));
|
215 |
}
|
216 |
|
217 |
return $orders = wc_get_orders( $args );
|
218 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
/*
|
221 |
* shipment api call
|
591 |
}?>
|
592 |
<span class=" multiple_checkbox">
|
593 |
<label class="" for="<?php echo $key?>">
|
|
|
594 |
<input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
|
595 |
<input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
|
596 |
+
<span class="multiple_label"><?php echo $val['status']; ?></span>
|
597 |
</br>
|
598 |
</label>
|
599 |
</span>
|
616 |
<?php } ?>
|
617 |
<span class="multiple_checkbox">
|
618 |
<label class="" for="<?php echo $key?>">
|
|
|
619 |
<input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
|
620 |
+
<input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
|
621 |
+
<span class="multiple_label"><?php echo $val['status']; ?></span>
|
622 |
</br>
|
623 |
</label>
|
624 |
</span>
|
703 |
<?php } ?>
|
704 |
</select>
|
705 |
</fieldset>
|
706 |
+
<?php } elseif( isset( $array['type'] ) && $array['type'] == 'radio' ){ ?>
|
707 |
+
<fieldset>
|
708 |
+
<?php foreach((array)$array['options'] as $key => $val ){
|
709 |
+
$selected = '';
|
710 |
+
if( get_option($id,$array['default']) == (string)$key )$selected = 'checked'; ?>
|
711 |
+
<span class="radio_section">
|
712 |
+
<label class="" for="<?php echo $id?>_<?php echo $key?>">
|
713 |
+
<input type="radio" id="<?php echo $id?>_<?php echo $key?>" name="<?php echo $id?>" class="<?php echo $id?>" value="<?php echo $key?>" <?php echo $selected?>/>
|
714 |
+
<span class=""><?php echo $val; ?></span>
|
715 |
+
</br>
|
716 |
+
</label>
|
717 |
+
</span></br>
|
718 |
+
<?php } ?>
|
719 |
+
</fieldset>
|
720 |
+
<?php } elseif( $array['type'] == 'key_field' ){ ?>
|
721 |
<fieldset>
|
722 |
<?php if($array['connected'] == true){ ?>
|
723 |
<a href="https://my.trackship.info/" target="_blank">
|
756 |
</tbody>
|
757 |
</table>
|
758 |
<?php
|
759 |
+
}
|
|
|
760 |
|
761 |
/*
|
762 |
* get html of fields
|
1031 |
$form_data = array(
|
1032 |
'wc_ast_api_enabled' => array(
|
1033 |
'type' => 'checkbox',
|
1034 |
+
'title' => __( 'Enable/Disable - You can enable/diable trackship, store is connected with trackship but shipment status will not update for new trackers', 'woo-advanced-shipment-tracking' ),
|
1035 |
'show' => $show_trackship_field,
|
1036 |
'class' => '',
|
1037 |
),
|
1038 |
'wc_ast_status_change_to_delivered' => array(
|
1039 |
'type' => 'checkbox',
|
1040 |
+
'title' => __( 'Set order status as delivered when shipment status is delivered', 'woo-advanced-shipment-tracking' ),'show' => $show_trackship_field,
|
|
|
1041 |
'class' => '',
|
1042 |
'disabled' => $disabled_change_to_delivered,
|
1043 |
),
|
1227 |
*/
|
1228 |
function get_settings_data(){
|
1229 |
|
1230 |
+
$wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
|
1231 |
if($wc_ast_status_shipped == 1){
|
1232 |
$completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
1233 |
$mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>"', 'woo-advanced-shipment-tracking' );
|
1245 |
'wc-processing' => 'Processing',
|
1246 |
'wc-on-hold' => 'On hold',
|
1247 |
'wc-completed' => 'Completed',
|
1248 |
+
'wc-delivered' => 'Delivered',
|
|
|
1249 |
'wc-cancelled' => 'Cancelled',
|
1250 |
'wc-refunded' => 'Refunded',
|
1251 |
+
'wc-failed' => 'Failed',
|
1252 |
+
'wc-ready-pickup' => 'Ready for Pickup',
|
1253 |
+
'wc-pickup' => 'Picked up'
|
1254 |
);
|
1255 |
foreach($default_order_status as $key=>$value){
|
1256 |
unset($all_order_status[$key]);
|
1273 |
"show_in_customer_invoice" => array(
|
1274 |
'status' => __( 'Customer Invoice', 'woocommerce' ),
|
1275 |
'type' => 'default',
|
1276 |
+
),
|
1277 |
"refunded" => array(
|
1278 |
'status' => __( 'Refunded', 'woocommerce' ),
|
1279 |
'type' => 'default',
|
1289 |
"completed" => array(
|
1290 |
'status' => $completed_order_label,
|
1291 |
'type' => 'default',
|
1292 |
+
),
|
1293 |
+
"show_in_customer_note" => array(
|
1294 |
+
'status' => __( 'Customer note', 'woocommerce' ),
|
1295 |
+
'type' => 'default',
|
1296 |
),
|
1297 |
);
|
1298 |
+
$order_status_array = array_merge($order_status,$custom_order_status);
|
1299 |
+
|
1300 |
if ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) {
|
1301 |
$show_invoice_field = true;
|
1302 |
} else{
|
1303 |
$show_invoice_field = false;
|
1304 |
+
}
|
1305 |
|
1306 |
+
$form_data = array(
|
1307 |
'wc_ast_status_shipped' => array(
|
1308 |
'type' => 'checkbox',
|
1309 |
'title' => __( 'Rename the “Completed” Order status to “Shipped”', 'woo-advanced-shipment-tracking' ),
|
1319 |
),
|
1320 |
'wc_ast_unclude_tracking_info' => array(
|
1321 |
'type' => 'multiple_checkbox',
|
1322 |
+
'title' => __( 'On which order status email to include the shipment tracking info?', 'woo-advanced-shipment-tracking' ),
|
1323 |
+
'options' => $order_status_array,
|
1324 |
'show' => true,
|
1325 |
'class' => '',
|
1326 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
);
|
1328 |
return $form_data;
|
1329 |
|
1330 |
+
}
|
1331 |
|
1332 |
/*
|
1333 |
* get settings tab array data
|
1368 |
);
|
1369 |
return $form_data;
|
1370 |
|
1371 |
+
}
|
1372 |
|
1373 |
/*
|
1374 |
* get updated tracking status settings array data
|
1455 |
/*
|
1456 |
* settings form save
|
1457 |
*/
|
1458 |
+
function wc_ast_settings_form_update_callback(){
|
1459 |
+
//echo '<pre>'; print_r($_POST);echo '</pre>';exit;
|
1460 |
if ( ! empty( $_POST ) && check_admin_referer( 'wc_ast_settings_form', 'wc_ast_settings_form' ) ) {
|
1461 |
|
1462 |
$data = $this->get_settings_data();
|
1465 |
if(isset($_POST[ $key ])){
|
1466 |
update_option( $key, $_POST[ $key ] );
|
1467 |
}
|
1468 |
+
}
|
1469 |
|
1470 |
$data = $this->get_delivered_data();
|
1471 |
|
1493 |
if(isset($_POST[ $key ])){
|
1494 |
update_option( $key, $_POST[ $key ] );
|
1495 |
}
|
1496 |
+
}
|
1497 |
|
1498 |
$data = $this->get_partial_shipped_data();
|
1499 |
|
1565 |
$bg_color = get_option('wc_ast_status_label_color','#212c42');
|
1566 |
$color = get_option('wc_ast_status_label_font_color','#fff');
|
1567 |
|
1568 |
+
$shipped_bg_color = get_option('wc_ast_shipped_status_label_color','#b7b7b7');
|
1569 |
+
$shipped_color = get_option('wc_ast_shipped_status_label_font_color','#fff');
|
1570 |
+
|
1571 |
$ps_bg_color = get_option('wc_ast_status_partial_shipped_label_color','#0c0c0c');
|
1572 |
$ps_color = get_option('wc_ast_status_partial_shipped_label_font_color','#fff');
|
1573 |
|
1578 |
.order-status.status-delivered,.order-status-table .order-label.wc-delivered{
|
1579 |
background: <?php echo $bg_color; ?>;
|
1580 |
color: <?php echo $color; ?>;
|
1581 |
+
}
|
1582 |
+
.order-status.status-shipped,.order-status-table .order-label.wc-shipped{
|
1583 |
+
background: <?php echo $shipped_bg_color; ?>;
|
1584 |
+
color: <?php echo $shipped_color; ?>;
|
1585 |
+
}
|
1586 |
.order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
|
1587 |
background: <?php echo $ps_bg_color; ?>;
|
1588 |
color: <?php echo $ps_color; ?>;
|
2083 |
* Change completed order email title to Shipped Order
|
2084 |
*/
|
2085 |
public function change_completed_woocommerce_email_title($email_title, $email){
|
2086 |
+
$wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
|
2087 |
// Only on backend Woocommerce Settings "Emails" tab
|
2088 |
if($wc_ast_status_shipped == 1){
|
2089 |
if( isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab']) && $_GET['tab'] == 'email' ) {
|
2107 |
|
2108 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
2109 |
if($wc_ast_status_delivered){
|
2110 |
+
if ( $order->has_status( array( 'completed' ) ) || $order->has_status( array( 'shipped' ) )) {
|
2111 |
// Get Order ID (compatibility all WC versions)
|
2112 |
$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
|
2113 |
// Set the action button
|
2117 |
'action' => "delivered_icon", // keep "view" class for a clean button CSS
|
2118 |
);
|
2119 |
}
|
2120 |
+
}
|
2121 |
|
2122 |
if ( !$order->has_status( array( 'pickup','ready-pickup','on-hold','delivered','cancelled','failed' ) ) ) {
|
2123 |
$actions['add_tracking'] = array(
|
2483 |
</select>
|
2484 |
<?php
|
2485 |
}
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
/**
|
2489 |
+
* Add bulk filter for Shipping provider in orders list
|
2490 |
+
*
|
2491 |
+
* @since 2.4
|
2492 |
+
*/
|
2493 |
+
public function filter_orders_by_shipping_provider(){
|
2494 |
+
global $typenow, $wpdb;
|
2495 |
+
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE display_in_order = 1" );
|
2496 |
+
//echo '<pre>';print_r($default_shippment_providers);echo '</pre>';
|
2497 |
+
if ( 'shop_order' === $typenow ) { ?>
|
2498 |
+
<select name="_shop_order_shipping_provider" id="dropdown_shop_order_shipping_provider">
|
2499 |
+
<option value=""><?php _e( 'Filter by shipping provider', 'woo-advanced-shipment-tracking' ); ?></option>
|
2500 |
+
<?php foreach ( $default_shippment_providers as $provider ) : ?>
|
2501 |
+
<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 ) : '' ); ?>>
|
2502 |
+
<?php printf( '%1$s', esc_html( $provider->provider_name ) ); ?>
|
2503 |
+
</option>
|
2504 |
+
<?php endforeach; ?>
|
2505 |
+
</select>
|
2506 |
+
<?php
|
2507 |
+
}
|
2508 |
+
}
|
2509 |
+
|
2510 |
+
/**
|
2511 |
+
* Process bulk filter action for shipment status orders
|
2512 |
+
*
|
2513 |
+
* @since 3.0.0
|
2514 |
+
* @param array $vars query vars without filtering
|
2515 |
+
* @return array $vars query vars with (maybe) filtering
|
2516 |
+
*/
|
2517 |
+
public function filter_orders_by_shipping_provider_query( $vars ){
|
2518 |
+
global $typenow;
|
2519 |
+
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && $_GET['_shop_order_shipping_provider'] != '') {
|
2520 |
+
$vars['meta_key'] = '_wc_shipment_tracking_items';
|
2521 |
+
$vars['meta_value'] = $_GET['_shop_order_shipping_provider'];
|
2522 |
+
$vars['meta_compare'] = 'LIKE';
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
return $vars;
|
2526 |
+
}
|
2527 |
|
2528 |
/**
|
2529 |
* Get the order count for orders by shipment status
|
includes/class-wc-advanced-shipment-tracking-api-call.php
CHANGED
@@ -79,8 +79,10 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
79 |
$shipment_status[$key]['est_delivery_date'] = '';
|
80 |
|
81 |
update_post_meta( $order->get_id(), "shipment_status", $shipment_status);
|
82 |
-
update_option('trackers_balance',$body['trackers_balance']);
|
83 |
|
|
|
|
|
|
|
84 |
} else {
|
85 |
//error like 403 500 502
|
86 |
$timestamp = time() + 5*60;
|
79 |
$shipment_status[$key]['est_delivery_date'] = '';
|
80 |
|
81 |
update_post_meta( $order->get_id(), "shipment_status", $shipment_status);
|
|
|
82 |
|
83 |
+
if(isset($body['trackers_balance'])){
|
84 |
+
update_option('trackers_balance',$body['trackers_balance']);
|
85 |
+
}
|
86 |
} else {
|
87 |
//error like 403 500 502
|
88 |
$timestamp = time() + 5*60;
|
includes/class-wc-advanced-shipment-tracking-front.php
CHANGED
@@ -170,10 +170,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
170 |
return $form;
|
171 |
|
172 |
} else{
|
173 |
-
ob_start();
|
174 |
-
|
175 |
-
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
176 |
-
$order_id = $wast->get_formated_order_id($order_id);
|
177 |
|
178 |
$num = 1;
|
179 |
$total_trackings = sizeof($tracking_items);
|
@@ -241,6 +238,9 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
241 |
}
|
242 |
}
|
243 |
|
|
|
|
|
|
|
244 |
if(!empty($decoded_data)){
|
245 |
if($tracking_page_layout == 't_layout_1'){ ?>
|
246 |
|
@@ -401,6 +401,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
401 |
} else {
|
402 |
$tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
|
403 |
}
|
|
|
404 |
$shipment_status = get_post_meta( $order_id, "shipment_status", true);
|
405 |
if(!$tracking_items){
|
406 |
ob_start();
|
@@ -551,7 +552,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
551 |
<div class="tracking-header tracking-desktop-header">
|
552 |
<div class="col-md col-md-6">
|
553 |
<span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span><br>
|
554 |
-
<span class="tracking-number"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider ));
|
555 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered" || $tracker->ep_status == "available_for_pickup") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-warning'; } else{ echo 'text-secondary'; } ?>">
|
556 |
<?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?>
|
557 |
</h1>
|
@@ -577,7 +578,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
577 |
<img class="provider_image" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/shipment-provider-img/<?php echo sanitize_title($tracking_provider); ?>.png">
|
578 |
</div>
|
579 |
<div class="header_top_right">
|
580 |
-
<span class="tracking-number"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider ));
|
581 |
<span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span>
|
582 |
</div>
|
583 |
</div>
|
170 |
return $form;
|
171 |
|
172 |
} else{
|
173 |
+
ob_start();
|
|
|
|
|
|
|
174 |
|
175 |
$num = 1;
|
176 |
$total_trackings = sizeof($tracking_items);
|
238 |
}
|
239 |
}
|
240 |
|
241 |
+
$wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
242 |
+
$order_id = $wast->get_custom_order_number($order_id);
|
243 |
+
|
244 |
if(!empty($decoded_data)){
|
245 |
if($tracking_page_layout == 't_layout_1'){ ?>
|
246 |
|
401 |
} else {
|
402 |
$tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
|
403 |
}
|
404 |
+
|
405 |
$shipment_status = get_post_meta( $order_id, "shipment_status", true);
|
406 |
if(!$tracking_items){
|
407 |
ob_start();
|
552 |
<div class="tracking-header tracking-desktop-header">
|
553 |
<div class="col-md col-md-6">
|
554 |
<span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span><br>
|
555 |
+
<span class="tracking-number"><span class="header_tracking_provider"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>:</span> <strong><?php echo $tracking_number; ?></strong></span>
|
556 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered" || $tracker->ep_status == "available_for_pickup") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-warning'; } else{ echo 'text-secondary'; } ?>">
|
557 |
<?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?>
|
558 |
</h1>
|
578 |
<img class="provider_image" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/shipment-provider-img/<?php echo sanitize_title($tracking_provider); ?>.png">
|
579 |
</div>
|
580 |
<div class="header_top_right">
|
581 |
+
<span class="tracking-number"><span class="header_tracking_provider"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>:</span> <strong><?php echo $tracking_number; ?></strong></span><br>
|
582 |
<span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span>
|
583 |
</div>
|
584 |
</div>
|
includes/class-wc-advanced-shipment-tracking-install.php
CHANGED
@@ -66,6 +66,10 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
66 |
if(!$wc_ast_api_key){
|
67 |
add_action( 'adminmenu', array( $this, 'admin_notice_menu_tooltip') );
|
68 |
}
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
/**
|
@@ -1746,6 +1750,12 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
1746 |
$wpdb->update( $this->table, $data_array, $where_array);
|
1747 |
}
|
1748 |
update_option( 'wc_advanced_shipment_tracking', '3.10');
|
|
|
|
|
|
|
|
|
|
|
|
|
1749 |
}
|
1750 |
}
|
1751 |
}
|
@@ -1967,7 +1977,21 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
1967 |
</div>
|
1968 |
<?php
|
1969 |
}
|
1970 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1971 |
/*
|
1972 |
* Display admin notice on plugin install or update
|
1973 |
*/
|
66 |
if(!$wc_ast_api_key){
|
67 |
add_action( 'adminmenu', array( $this, 'admin_notice_menu_tooltip') );
|
68 |
}
|
69 |
+
|
70 |
+
if ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) {
|
71 |
+
add_action( 'admin_notices', array( $this, 'admin_notice_for_invoices_plugin' ) );
|
72 |
+
}
|
73 |
}
|
74 |
|
75 |
/**
|
1750 |
$wpdb->update( $this->table, $data_array, $where_array);
|
1751 |
}
|
1752 |
update_option( 'wc_advanced_shipment_tracking', '3.10');
|
1753 |
+
}
|
1754 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.13', '<') ){
|
1755 |
+
$wc_ast_unclude_tracking_info = get_option('wc_ast_unclude_tracking_info');
|
1756 |
+
$wc_ast_unclude_tracking_info['show_in_customer_note'] = 0;
|
1757 |
+
update_option('wc_ast_unclude_tracking_info',$wc_ast_unclude_tracking_info);
|
1758 |
+
update_option( 'wc_advanced_shipment_tracking', '3.13');
|
1759 |
}
|
1760 |
}
|
1761 |
}
|
1977 |
</div>
|
1978 |
<?php
|
1979 |
}
|
1980 |
+
|
1981 |
+
/*
|
1982 |
+
* Display admin notice if WooCommerce PDF Invoices & Packing Slips plugin is active that e remove compatibility code from plugin
|
1983 |
+
*/
|
1984 |
+
public function admin_notice_for_invoices_plugin(){
|
1985 |
+
if ( ! PAnD::is_admin_notice_active( 'disable-pdf-plugin-notice-forever' ) ) {
|
1986 |
+
return;
|
1987 |
+
}
|
1988 |
+
?>
|
1989 |
+
<div data-dismissible="disable-pdf-plugin-notice-forever" class="notice updated is-dismissible">
|
1990 |
+
<p>We removed compatibility code for WooCommerce PDF Invoices & Packing Slips plugin from our plugin. If you want to add tracking information in Invoice and packing slip PDF use this <a href="https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/compatibility/#pdf-invoices-plugins" target="blank">code snippet</a>.</p>
|
1991 |
+
</div>
|
1992 |
+
<?php
|
1993 |
+
}
|
1994 |
+
|
1995 |
/*
|
1996 |
* Display admin notice on plugin install or update
|
1997 |
*/
|
includes/class-wc-advanced-shipment-tracking-settings.php
CHANGED
@@ -54,7 +54,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
54 |
public function init(){
|
55 |
|
56 |
//rename order status + rename bulk action + rename filter
|
57 |
-
add_filter( 'wc_order_statuses', array( $this, 'wc_renaming_order_status') );
|
58 |
add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses'), 10, 1 );
|
59 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions'), 50, 1 );
|
60 |
|
@@ -75,7 +75,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
75 |
add_filter( 'woocommerce_order_is_paid_statuses', array( $this, 'delivered_woocommerce_order_is_paid_statuses' ) );
|
76 |
//add bulk action
|
77 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'add_bulk_actions'), 50, 1 );
|
78 |
-
}
|
79 |
|
80 |
//new order status
|
81 |
$updated_tracking_status = get_option( "wc_ast_status_updated_tracking", 0);
|
@@ -132,7 +132,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
132 |
/**
|
133 |
* Register new status : Delivered
|
134 |
**/
|
135 |
-
function register_order_status() {
|
136 |
register_post_status( 'wc-delivered', array(
|
137 |
'label' => __( 'Delivered', 'woo-advanced-shipment-tracking' ),
|
138 |
'public' => true,
|
@@ -141,7 +141,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
141 |
'exclude_from_search' => false,
|
142 |
'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
143 |
) );
|
144 |
-
}
|
145 |
|
146 |
/**
|
147 |
* Register new status : Updated Tracking
|
@@ -174,7 +174,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
174 |
/*
|
175 |
* add status after completed
|
176 |
*/
|
177 |
-
function add_delivered_to_order_statuses( $order_statuses ) {
|
178 |
$new_order_statuses = array();
|
179 |
foreach ( $order_statuses as $key => $status ) {
|
180 |
$new_order_statuses[ $key ] = $status;
|
@@ -184,12 +184,12 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
184 |
}
|
185 |
|
186 |
return $new_order_statuses;
|
187 |
-
}
|
188 |
|
189 |
/*
|
190 |
* add status after completed
|
191 |
*/
|
192 |
-
function add_updated_tracking_to_order_statuses( $order_statuses ) {
|
193 |
$new_order_statuses = array();
|
194 |
foreach ( $order_statuses as $key => $status ) {
|
195 |
$new_order_statuses[ $key ] = $status;
|
@@ -203,7 +203,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
203 |
/*
|
204 |
* add status after completed
|
205 |
*/
|
206 |
-
function add_partial_shipped_to_order_statuses( $order_statuses ) {
|
207 |
$new_order_statuses = array();
|
208 |
foreach ( $order_statuses as $key => $status ) {
|
209 |
$new_order_statuses[ $key ] = $status;
|
@@ -220,7 +220,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
220 |
function include_custom_order_status_to_reports( $statuses ){
|
221 |
if($statuses)$statuses[] = 'delivered';
|
222 |
return $statuses;
|
223 |
-
}
|
224 |
|
225 |
/*
|
226 |
* Adding the updated-tracking order status to the default woocommerce order statuses
|
@@ -244,7 +244,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
244 |
function delivered_woocommerce_order_is_paid_statuses( $statuses ) {
|
245 |
$statuses[] = 'delivered';
|
246 |
return $statuses;
|
247 |
-
}
|
248 |
|
249 |
/*
|
250 |
* mark status as a paid.
|
@@ -307,7 +307,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
307 |
}
|
308 |
}
|
309 |
return $order_statuses;
|
310 |
-
}
|
311 |
|
312 |
/*
|
313 |
* define the woocommerce_register_shop_order_post_statuses callback
|
@@ -445,7 +445,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
445 |
$default_provider = get_option("wc_ast_default_provider" );
|
446 |
$wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
|
447 |
|
448 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
449 |
if($wc_ast_status_shipped == 1){
|
450 |
$change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
|
451 |
$shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
@@ -461,7 +461,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
461 |
<div class="trackingpopup_row">
|
462 |
<h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?> - #<?php echo $custom_order_number; ?></h2>
|
463 |
<form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
|
464 |
-
<p class="form-field">
|
465 |
<label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
|
466 |
<select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width:100%;">
|
467 |
<option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
|
@@ -485,11 +485,11 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
485 |
</p>
|
486 |
<p class="form-field tracking_number_field">
|
487 |
<label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
|
488 |
-
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="">
|
489 |
</p>
|
490 |
<p class="form-field tracking_product_code_field">
|
491 |
<label for="tracking_product_code"><?php _e( 'Product Code:', 'woo-advanced-shipment-tracking'); ?></label>
|
492 |
-
<input type="text" class="short" style="" name="tracking_product_code" id="tracking_product_code" value=""
|
493 |
</p>
|
494 |
<p class="form-field date_shipped_field">
|
495 |
<label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
|
@@ -497,6 +497,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
497 |
</p>
|
498 |
<?php
|
499 |
|
|
|
500 |
do_action("ast_tracking_form_between_form", $order_id);
|
501 |
|
502 |
if($wc_ast_status_partial_shipped){ ?>
|
@@ -530,7 +531,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
530 |
/*
|
531 |
* define the item in the meta box by adding an item to the $actions array
|
532 |
*/
|
533 |
-
function add_order_meta_box_actions( $actions ) {
|
534 |
$actions['resend_delivered_order_notification'] = __( 'Resend delivered order notification', 'woo-advanced-shipment-tracking' );
|
535 |
return $actions;
|
536 |
}
|
@@ -588,8 +589,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
588 |
|
589 |
if(is_array($shipment_status)){
|
590 |
$shipment_status_merge = array_merge($shipment_status_merge, $shipment_status);
|
591 |
-
}
|
592 |
-
|
593 |
}
|
594 |
|
595 |
foreach($tracking_items_results as $order){
|
@@ -747,7 +747,12 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
747 |
]
|
748 |
}
|
749 |
);
|
750 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
751 |
<div class="ast-dashborad-widget">
|
752 |
|
753 |
<input id="tab_s_providers" type="radio" name="tabs" class="widget_tab_input" checked>
|
@@ -980,4 +985,4 @@ class WC_Advanced_Shipment_Tracking_Settings {
|
|
980 |
<a class="view_synch_details" id="view_deleted_details" href="javaScript:void(0);" style="display: block;"><?php _e( 'view details', 'woo-advanced-shipment-tracking'); ?></a>
|
981 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php _e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
982 |
<?php }
|
983 |
-
}
|
54 |
public function init(){
|
55 |
|
56 |
//rename order status + rename bulk action + rename filter
|
57 |
+
add_filter( 'wc_order_statuses', array( $this, 'wc_renaming_order_status') );
|
58 |
add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses'), 10, 1 );
|
59 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions'), 50, 1 );
|
60 |
|
75 |
add_filter( 'woocommerce_order_is_paid_statuses', array( $this, 'delivered_woocommerce_order_is_paid_statuses' ) );
|
76 |
//add bulk action
|
77 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'add_bulk_actions'), 50, 1 );
|
78 |
+
}
|
79 |
|
80 |
//new order status
|
81 |
$updated_tracking_status = get_option( "wc_ast_status_updated_tracking", 0);
|
132 |
/**
|
133 |
* Register new status : Delivered
|
134 |
**/
|
135 |
+
function register_order_status() {
|
136 |
register_post_status( 'wc-delivered', array(
|
137 |
'label' => __( 'Delivered', 'woo-advanced-shipment-tracking' ),
|
138 |
'public' => true,
|
141 |
'exclude_from_search' => false,
|
142 |
'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
|
143 |
) );
|
144 |
+
}
|
145 |
|
146 |
/**
|
147 |
* Register new status : Updated Tracking
|
174 |
/*
|
175 |
* add status after completed
|
176 |
*/
|
177 |
+
function add_delivered_to_order_statuses( $order_statuses ) {
|
178 |
$new_order_statuses = array();
|
179 |
foreach ( $order_statuses as $key => $status ) {
|
180 |
$new_order_statuses[ $key ] = $status;
|
184 |
}
|
185 |
|
186 |
return $new_order_statuses;
|
187 |
+
}
|
188 |
|
189 |
/*
|
190 |
* add status after completed
|
191 |
*/
|
192 |
+
function add_updated_tracking_to_order_statuses( $order_statuses ) {
|
193 |
$new_order_statuses = array();
|
194 |
foreach ( $order_statuses as $key => $status ) {
|
195 |
$new_order_statuses[ $key ] = $status;
|
203 |
/*
|
204 |
* add status after completed
|
205 |
*/
|
206 |
+
function add_partial_shipped_to_order_statuses( $order_statuses ) {
|
207 |
$new_order_statuses = array();
|
208 |
foreach ( $order_statuses as $key => $status ) {
|
209 |
$new_order_statuses[ $key ] = $status;
|
220 |
function include_custom_order_status_to_reports( $statuses ){
|
221 |
if($statuses)$statuses[] = 'delivered';
|
222 |
return $statuses;
|
223 |
+
}
|
224 |
|
225 |
/*
|
226 |
* Adding the updated-tracking order status to the default woocommerce order statuses
|
244 |
function delivered_woocommerce_order_is_paid_statuses( $statuses ) {
|
245 |
$statuses[] = 'delivered';
|
246 |
return $statuses;
|
247 |
+
}
|
248 |
|
249 |
/*
|
250 |
* mark status as a paid.
|
307 |
}
|
308 |
}
|
309 |
return $order_statuses;
|
310 |
+
}
|
311 |
|
312 |
/*
|
313 |
* define the woocommerce_register_shop_order_post_statuses callback
|
445 |
$default_provider = get_option("wc_ast_default_provider" );
|
446 |
$wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
|
447 |
|
448 |
+
$wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
|
449 |
if($wc_ast_status_shipped == 1){
|
450 |
$change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
|
451 |
$shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
461 |
<div class="trackingpopup_row">
|
462 |
<h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?> - #<?php echo $custom_order_number; ?></h2>
|
463 |
<form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
|
464 |
+
<p class="form-field" style="margin-bottom: 10px;">
|
465 |
<label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
|
466 |
<select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width:100%;">
|
467 |
<option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
|
485 |
</p>
|
486 |
<p class="form-field tracking_number_field">
|
487 |
<label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
|
488 |
+
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
|
489 |
</p>
|
490 |
<p class="form-field tracking_product_code_field">
|
491 |
<label for="tracking_product_code"><?php _e( 'Product Code:', 'woo-advanced-shipment-tracking'); ?></label>
|
492 |
+
<input type="text" class="short" style="" name="tracking_product_code" id="tracking_product_code" value="">
|
493 |
</p>
|
494 |
<p class="form-field date_shipped_field">
|
495 |
<label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
|
497 |
</p>
|
498 |
<?php
|
499 |
|
500 |
+
do_action("ast_after_tracking_field", $order_id);
|
501 |
do_action("ast_tracking_form_between_form", $order_id);
|
502 |
|
503 |
if($wc_ast_status_partial_shipped){ ?>
|
531 |
/*
|
532 |
* define the item in the meta box by adding an item to the $actions array
|
533 |
*/
|
534 |
+
function add_order_meta_box_actions( $actions ) {
|
535 |
$actions['resend_delivered_order_notification'] = __( 'Resend delivered order notification', 'woo-advanced-shipment-tracking' );
|
536 |
return $actions;
|
537 |
}
|
589 |
|
590 |
if(is_array($shipment_status)){
|
591 |
$shipment_status_merge = array_merge($shipment_status_merge, $shipment_status);
|
592 |
+
}
|
|
|
593 |
}
|
594 |
|
595 |
foreach($tracking_items_results as $order){
|
747 |
]
|
748 |
}
|
749 |
);
|
750 |
+
</script>
|
751 |
+
<style>
|
752 |
+
a[href="http://www.amcharts.com"] {
|
753 |
+
display: none !important;
|
754 |
+
}
|
755 |
+
</style>
|
756 |
<div class="ast-dashborad-widget">
|
757 |
|
758 |
<input id="tab_s_providers" type="radio" name="tabs" class="widget_tab_input" checked>
|
985 |
<a class="view_synch_details" id="view_deleted_details" href="javaScript:void(0);" style="display: block;"><?php _e( 'view details', 'woo-advanced-shipment-tracking'); ?></a>
|
986 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php _e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
987 |
<?php }
|
988 |
+
}
|
includes/class-wc-advanced-shipment-tracking.php
CHANGED
@@ -205,121 +205,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
205 |
echo '–';
|
206 |
}
|
207 |
return apply_filters( 'woocommerce_shipment_tracking_get_shipment_tracking_column', ob_get_clean(), $order_id, $tracking_items );
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Lightbox for add tracking number from orders list
|
212 |
-
*/
|
213 |
-
public function add_inline_tracking_lightbox(){
|
214 |
-
global $wpdb;
|
215 |
-
$WC_Countries = new WC_Countries();
|
216 |
-
$countries = $WC_Countries->get_countries();
|
217 |
-
|
218 |
-
$woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
|
219 |
-
|
220 |
-
if( is_multisite() ){
|
221 |
-
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
222 |
-
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
223 |
-
}
|
224 |
-
if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
|
225 |
-
$main_blog_prefix = $wpdb->get_blog_prefix(BLOG_ID_CURRENT_SITE);
|
226 |
-
$woo_shippment_table_name = $main_blog_prefix."woo_shippment_provider";
|
227 |
-
} else{
|
228 |
-
$woo_shippment_table_name = $wpdb->prefix."woo_shippment_provider";
|
229 |
-
}
|
230 |
-
} else{
|
231 |
-
$woo_shippment_table_name = $wpdb->prefix."woo_shippment_provider";
|
232 |
-
}
|
233 |
-
$shippment_countries = $wpdb->get_results( "SELECT shipping_country FROM $woo_shippment_table_name WHERE display_in_order = 1 GROUP BY shipping_country" );
|
234 |
-
|
235 |
-
$shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
|
236 |
-
|
237 |
-
$default_provider = get_option("wc_ast_default_provider" );
|
238 |
-
$wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
|
239 |
-
|
240 |
-
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
241 |
-
if($wc_ast_status_shipped == 1){
|
242 |
-
$change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
|
243 |
-
$shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
|
244 |
-
} else{
|
245 |
-
$change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
|
246 |
-
$shipped_label = __( 'Completed', 'woo-advanced-shipment-tracking' );
|
247 |
-
}
|
248 |
-
|
249 |
-
$wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
|
250 |
-
?>
|
251 |
-
<div id="" class="trackingpopup_wrapper add_tracking_popup" style="display:none;">
|
252 |
-
<div class="trackingpopup_row">
|
253 |
-
<h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?></h2>
|
254 |
-
<form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
|
255 |
-
<p class="form-field tracking_number_field ">
|
256 |
-
<label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
|
257 |
-
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" placeholder="">
|
258 |
-
</p>
|
259 |
-
<p class="form-field">
|
260 |
-
<select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width: 100%;">
|
261 |
-
<option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
|
262 |
-
<?php
|
263 |
-
foreach($shippment_countries as $s_c){
|
264 |
-
if($s_c->shipping_country != 'Global'){
|
265 |
-
$country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
|
266 |
-
} else{
|
267 |
-
$country_name = 'Global';
|
268 |
-
}
|
269 |
-
echo '<optgroup label="' . $country_name . '">';
|
270 |
-
$country = $s_c->shipping_country;
|
271 |
-
$shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
|
272 |
-
foreach ( $shippment_providers_by_country as $providers ) {
|
273 |
-
$selected = ( $default_provider == esc_attr( $providers->ts_slug ) ) ? 'selected' : '';
|
274 |
-
echo '<option value="' . esc_attr( $providers->ts_slug ) . '" '.$selected. '>' . esc_html( $providers->provider_name ) . '</option>';
|
275 |
-
}
|
276 |
-
echo '</optgroup>';
|
277 |
-
} ?>
|
278 |
-
</select>
|
279 |
-
</p>
|
280 |
-
<p class="form-field tracking_number_field ">
|
281 |
-
<label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
|
282 |
-
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" placeholder="">
|
283 |
-
</p>
|
284 |
-
<p class="form-field date_shipped_field">
|
285 |
-
<label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
|
286 |
-
<input type="text" class="date-picker-field" style="" 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( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), time() ); ?>">
|
287 |
-
</p>
|
288 |
-
<?php
|
289 |
-
|
290 |
-
//do_action("ast_tracking_form_between_form", $post->ID);
|
291 |
-
|
292 |
-
if($wc_ast_status_partial_shipped){ ?>
|
293 |
-
<fieldset class="form-field change_order_to_shipped_field ">
|
294 |
-
<legend><?php _e( 'Mark order as:', 'woo-advanced-shipment-tracking'); ?></legend>
|
295 |
-
<ul class="wc-radios">
|
296 |
-
<li><label><input name="change_order_to_shipped" value="change_order_to_shipped" type="checkbox" class="select short" style=""><?php _e( $shipped_label, 'woo-advanced-shipment-tracking'); ?></label></li>
|
297 |
-
<li><label><input name="change_order_to_shipped" value="change_order_to_partial_shipped" type="checkbox" class="select short" style=""><?php _e( 'Partial Shipped', 'woo-advanced-shipment-tracking'); ?></label></li>
|
298 |
-
</ul>
|
299 |
-
</fieldset>
|
300 |
-
<?php } else{ ?>
|
301 |
-
<p class="form-field change_order_to_shipped_field ">
|
302 |
-
<label for="change_order_to_shipped"><?php echo $change_order_status_label; ?></label>
|
303 |
-
<input type="checkbox" class="checkbox" style="" name="change_order_to_shipped" id="change_order_to_shipped" value="yes" <?php if($wc_ast_default_mark_shipped == 1){ echo 'checked'; }?>>
|
304 |
-
</p>
|
305 |
-
<?php } ?>
|
306 |
-
<p class="" style="text-align:left;">
|
307 |
-
<input type="hidden" name="action" value="add_inline_tracking_number">
|
308 |
-
<input type="hidden" name="order_id" id="order_id" value="">
|
309 |
-
<input type="submit" name="Submit" value="Save Tracking" class="button-primary btn_green">
|
310 |
-
</p>
|
311 |
-
</form>
|
312 |
-
</div>
|
313 |
-
<div class="popupclose"></div>
|
314 |
-
</div>
|
315 |
-
<?php
|
316 |
-
//wp_enqueue_script( 'wc-admin-meta-boxes' );
|
317 |
-
}
|
318 |
|
319 |
/**
|
320 |
* Add the meta box for shipment info on the order page
|
321 |
*/
|
322 |
-
public function add_meta_box() {
|
323 |
add_meta_box( 'woocommerce-advanced-shipment-tracking', __( 'Shipment Tracking', 'woo-advanced-shipment-tracking' ), array( $this, 'meta_box' ), 'shop_order', 'side', 'high' );
|
324 |
}
|
325 |
|
@@ -327,8 +218,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
327 |
* Returns a HTML node for a tracking item for the admin meta box
|
328 |
*/
|
329 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
330 |
-
$formatted = $this->get_formatted_tracking_item( $order_id, $item );
|
331 |
-
|
332 |
?>
|
333 |
<div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
|
334 |
<div class="tracking-content">
|
@@ -404,7 +294,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
404 |
*/
|
405 |
public function meta_box() {
|
406 |
global $post;
|
407 |
-
global $wpdb;
|
408 |
|
409 |
$WC_Countries = new WC_Countries();
|
410 |
$countries = $WC_Countries->get_countries();
|
@@ -443,7 +333,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
443 |
$cbvalue = 1;
|
444 |
}
|
445 |
}
|
446 |
-
|
447 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
448 |
if($wc_ast_status_shipped == 1){
|
449 |
$change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
|
@@ -451,9 +341,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
451 |
} else{
|
452 |
$change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
|
453 |
$shipped_label = 'Completed';
|
454 |
-
}
|
455 |
-
|
456 |
-
|
457 |
|
458 |
echo '<div id="tracking-items">';
|
459 |
if ( count( $tracking_items ) > 0 ) {
|
@@ -502,14 +390,20 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
502 |
'id' => 'wc_shipment_tracking_create_nonce',
|
503 |
'value' => wp_create_nonce( 'create-tracking-item' ),
|
504 |
) );
|
505 |
-
|
506 |
-
|
|
|
|
|
|
|
|
|
|
|
507 |
'id' => 'tracking_number',
|
508 |
'label' => __( 'Tracking number:', 'woo-advanced-shipment-tracking' ),
|
509 |
'placeholder' => '',
|
510 |
'description' => '',
|
511 |
'value' => '',
|
512 |
-
|
|
|
513 |
|
514 |
woocommerce_wp_text_input( array(
|
515 |
'id' => 'tracking_product_code',
|
@@ -527,7 +421,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
527 |
'class' => 'date-picker-field',
|
528 |
'value' => date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ),
|
529 |
) );
|
530 |
-
|
|
|
531 |
do_action("ast_tracking_form_between_form", $post->ID);
|
532 |
|
533 |
if($wc_ast_status_partial_shipped){
|
@@ -683,11 +578,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
683 |
'tracking_product_code' => $tracking_product_code,
|
684 |
'date_shipped' => wc_clean( $_POST['date_shipped'] ),
|
685 |
);
|
686 |
-
|
|
|
|
|
687 |
$tracking_item = $this->add_tracking_item( $order_id, $args );
|
688 |
|
689 |
-
if($_POST['change_order_to_shipped'] == 'change_order_to_shipped'){
|
690 |
-
|
691 |
if('completed' == $order->get_status()){
|
692 |
WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
|
693 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
@@ -726,31 +622,21 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
726 |
'tracking_product_code' => $tracking_product_code,
|
727 |
'date_shipped' => wc_clean( $_POST['date_shipped'] ),
|
728 |
);
|
729 |
-
|
|
|
|
|
730 |
$tracking_item = $this->add_tracking_item( $order_id, $args );
|
|
|
731 |
|
732 |
-
if($_POST['change_order_to_shipped'] == 'change_order_to_shipped' || $_POST['change_order_to_shipped'] == 'yes'){
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
} else if($wc_ast_completed_to_shipped == 'wc_ast_create_shipped' && get_option('wc_ast_status_shipped_active')){
|
742 |
-
if('shipped' == $order->get_status()){
|
743 |
-
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
744 |
-
} else{
|
745 |
-
$order->update_status('shipped');
|
746 |
-
}
|
747 |
-
}
|
748 |
-
|
749 |
-
} elseif($_POST['change_order_to_shipped'] == 'change_order_to_partial_shipped'){
|
750 |
-
$order = new WC_Order($order_id);
|
751 |
-
|
752 |
-
$previous_order_status = $order->get_status();
|
753 |
-
|
754 |
if('partial-shipped' == $previous_order_status){
|
755 |
WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
|
756 |
}
|
@@ -851,9 +737,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
851 |
|
852 |
if ( is_a( $email, 'WC_Email_Customer_Invoice' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_invoice']) && $wc_ast_unclude_tracking_info['show_in_customer_invoice'] == 0){
|
853 |
return;
|
854 |
-
}
|
|
|
|
|
|
|
|
|
855 |
|
856 |
-
if(isset($wc_ast_unclude_tracking_info[$order_status]) && $wc_ast_unclude_tracking_info[$order_status] == 0 && !is_a( $email, 'WC_Email_Customer_Invoice' )){
|
857 |
return;
|
858 |
}
|
859 |
|
@@ -875,113 +765,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
875 |
}
|
876 |
}
|
877 |
}
|
878 |
-
}
|
879 |
-
|
880 |
-
/**
|
881 |
-
* Display shipment info in PDF Invoices & Packing slips.
|
882 |
-
*
|
883 |
-
* @version 1.6.8
|
884 |
-
*
|
885 |
-
* @param WC_Order $order Order object.
|
886 |
-
* Plugin - https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/
|
887 |
-
*/
|
888 |
-
public function tracking_display_in_invoice($template_type, $order){
|
889 |
-
|
890 |
-
$wc_ast_show_tracking_invoice = get_option('wc_ast_show_tracking_invoice');
|
891 |
-
$wc_ast_show_tracking_packing_slip = get_option('wc_ast_show_tracking_packing_slip');
|
892 |
-
if($template_type == 'invoice' && !$wc_ast_show_tracking_invoice){
|
893 |
-
return;
|
894 |
-
}
|
895 |
-
if($template_type == 'packing-slip' && !$wc_ast_show_tracking_packing_slip){
|
896 |
-
return;
|
897 |
-
}
|
898 |
-
|
899 |
-
$order_id = is_callable( array( $order, 'get_id' ) ) ? $order->get_id() : $order->id;
|
900 |
-
$tracking_items = $this->get_tracking_items( $order_id, true );
|
901 |
-
if($tracking_items){
|
902 |
-
$wcast_customizer_settings = new wcast_initialise_customizer_settings();
|
903 |
-
$tracking_info_settings = get_option('tracking_info_settings');
|
904 |
-
|
905 |
-
$provider_header_text = $this->get_option_value_from_array('tracking_info_settings','provider_header_text',$wcast_customizer_settings->defaults['provider_header_text']);
|
906 |
-
|
907 |
-
$tracking_number_header_text = $this->get_option_value_from_array('tracking_info_settings','tracking_number_header_text',$wcast_customizer_settings->defaults['tracking_number_header_text']);
|
908 |
-
|
909 |
-
$shipped_date_header_text = $this->get_option_value_from_array('tracking_info_settings','shipped_date_header_text',$wcast_customizer_settings->defaults['shipped_date_header_text']);
|
910 |
-
|
911 |
-
$show_track_label = $tracking_info_settings['show_track_label'];
|
912 |
-
|
913 |
-
$remove_date_from_tracking_info = $tracking_info_settings['remove_date_from_tracking'];
|
914 |
-
|
915 |
-
$track_header_text = $this->get_option_value_from_array('tracking_info_settings','track_header_text',$wcast_customizer_settings->defaults['track_header_text']);
|
916 |
-
|
917 |
-
$display_thumbnail = $tracking_info_settings['display_shipment_provider_image'];
|
918 |
-
|
919 |
-
if($tracking_info_settings['header_text_change']){ $shipment_tracking_header = $tracking_info_settings['header_text_change']; } else{ $shipment_tracking_header = "Tracking Information"; }
|
920 |
-
|
921 |
-
?>
|
922 |
-
<h2 class="header_text"><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2><br/>
|
923 |
-
<table class="order-details">
|
924 |
-
<thead>
|
925 |
-
<tr>
|
926 |
-
<th class=""><?php _e( $provider_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
927 |
-
<th class=""><?php _e( $tracking_number_header_text, 'woo-advanced-shipment-tracking' ); ?></th>
|
928 |
-
<?php if($remove_date_from_tracking_info != 1){ ?>
|
929 |
-
<th class="" style=""><span class="nobr"><?php _e( $shipped_date_header_text, 'woo-advanced-shipment-tracking' ); ?></span></th>
|
930 |
-
<?php }
|
931 |
-
?>
|
932 |
-
<th class=""><?php if($show_track_label == 1){ _e( $track_header_text, 'woo-advanced-shipment-tracking' ); } ?></th>
|
933 |
-
</tr>
|
934 |
-
</thead>
|
935 |
-
<tbody><?php
|
936 |
-
foreach ( $tracking_items as $tracking_item ) {
|
937 |
-
$date_shipped = date("Y-m-d");
|
938 |
-
if(isset($tracking_item['date_shipped'])){
|
939 |
-
$date_shipped = $tracking_item['date_shipped'];
|
940 |
-
}
|
941 |
-
?><tr class="tracking">
|
942 |
-
<td class="">
|
943 |
-
<?php
|
944 |
-
global $wpdb;
|
945 |
-
$woo_shippment_table_name = wc_advanced_shipment_tracking()->table;
|
946 |
-
$shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_item['formatted_tracking_provider']."'" );
|
947 |
-
$custom_thumb_id = $shippment_provider['0']->custom_thumb_id;
|
948 |
-
|
949 |
-
if($custom_thumb_id == 0){
|
950 |
-
$src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/".sanitize_title($tracking_item['formatted_tracking_provider']).".png";
|
951 |
-
} else{
|
952 |
-
$image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
|
953 |
-
if($image_attributes[0]){
|
954 |
-
$src = $image_attributes[0];
|
955 |
-
} else{
|
956 |
-
$src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/icon-default.png";
|
957 |
-
}
|
958 |
-
}
|
959 |
-
|
960 |
-
|
961 |
-
if($display_thumbnail == 1){ ?>
|
962 |
-
<?php }
|
963 |
-
echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
964 |
-
</td>
|
965 |
-
<td class="">
|
966 |
-
<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
|
967 |
-
</td>
|
968 |
-
<?php
|
969 |
-
if($remove_date_from_tracking_info != 1){ ?>
|
970 |
-
<td class="">
|
971 |
-
<time datetime="<?php echo date( 'Y-m-d', $date_shipped ); ?>" title="<?php echo date( 'Y-m-d', $date_shipped ); ?>"><?php echo date_i18n( get_option( 'date_format' ), $date_shipped ); ?></time>
|
972 |
-
</td>
|
973 |
-
<?php } ?>
|
974 |
-
<td class="">
|
975 |
-
<?php $url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
|
976 |
-
<a href="<?php echo esc_url( $url ); ?>" target="_blank"><?php _e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
977 |
-
</td>
|
978 |
-
</tr><?php
|
979 |
-
}
|
980 |
-
?></tbody>
|
981 |
-
</table>
|
982 |
-
<?php
|
983 |
-
}
|
984 |
-
}
|
985 |
|
986 |
/**
|
987 |
* Prevents data being copied to subscription renewals
|
@@ -998,7 +782,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
998 |
public function get_formatted_tracking_item( $order_id, $tracking_item ) {
|
999 |
$formatted = array();
|
1000 |
$tracking_items = $this->get_tracking_items( $order_id );
|
1001 |
-
|
1002 |
foreach($tracking_items as $key=>$item){
|
1003 |
if($item['tracking_id'] == $tracking_item['tracking_id']){
|
1004 |
$shipmet_key = $key;
|
@@ -1203,6 +987,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1203 |
$tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
|
1204 |
}
|
1205 |
|
|
|
|
|
1206 |
$tracking_items = $this->get_tracking_items( $order_id );
|
1207 |
if($tracking_items){
|
1208 |
$key = $this->seach_tracking_number_in_items($args['tracking_number'], $tracking_items);
|
@@ -1213,16 +999,15 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1213 |
}
|
1214 |
} else{
|
1215 |
$tracking_items[] = $tracking_item;
|
1216 |
-
}
|
1217 |
-
//echo '<pre>';print_r($
|
1218 |
-
//echo '<pre>';print_r($tracking_items);echo '</pre>';exit;
|
1219 |
-
|
1220 |
$this->save_tracking_items( $order_id, $tracking_items );
|
1221 |
|
1222 |
$status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
|
1223 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
1224 |
-
|
1225 |
-
|
|
|
1226 |
if('completed' == $order->get_status()){
|
1227 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1228 |
} else{
|
@@ -1232,17 +1017,14 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1232 |
|
1233 |
if( $status_shipped == 2){
|
1234 |
$wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
|
1235 |
-
if($wc_ast_status_partial_shipped){
|
1236 |
-
$order = new WC_Order( $order_id );
|
1237 |
$order->update_status('partial-shipped');
|
1238 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1239 |
}
|
1240 |
}
|
1241 |
|
1242 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1243 |
-
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1244 |
-
|
1245 |
-
$order = wc_get_order( $order_id );
|
1246 |
|
1247 |
// The text for the note
|
1248 |
$note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
|
@@ -1311,8 +1093,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1311 |
|
1312 |
$status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
|
1313 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
1314 |
-
|
1315 |
-
|
|
|
1316 |
if('completed' == $order->get_status()){
|
1317 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1318 |
} else{
|
@@ -1320,11 +1103,20 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1320 |
}
|
1321 |
}
|
1322 |
|
1323 |
-
if( $status_shipped == 2){
|
1324 |
-
$order = new WC_Order( $order_id );
|
1325 |
$order->update_status('partial-shipped');
|
1326 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1327 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1328 |
return $tracking_item;
|
1329 |
}
|
1330 |
|
@@ -1558,7 +1350,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1558 |
}
|
1559 |
}
|
1560 |
|
1561 |
-
if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php' ) ) {
|
1562 |
|
1563 |
// search for the order by custom order number
|
1564 |
$query_args = array(
|
@@ -1657,6 +1449,33 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1657 |
wp_reset_postdata();
|
1658 |
}
|
1659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1660 |
return $order_id;
|
1661 |
}
|
1662 |
|
@@ -1678,7 +1497,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1678 |
}
|
1679 |
}
|
1680 |
|
1681 |
-
if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php' ) ) {
|
1682 |
$custom_order_number = get_post_meta( $order_id, '_order_number_formatted', true );
|
1683 |
if(!empty($custom_order_number)){
|
1684 |
return $custom_order_number;
|
@@ -1707,7 +1526,14 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1707 |
if(!empty($custom_order_number)){
|
1708 |
return $custom_order_number;
|
1709 |
}
|
1710 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1711 |
}
|
1712 |
|
1713 |
public function get_option_value_from_array($array,$key,$default_value){
|
@@ -1723,4 +1549,29 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1723 |
}
|
1724 |
return $value;
|
1725 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1726 |
}
|
205 |
echo '–';
|
206 |
}
|
207 |
return apply_filters( 'woocommerce_shipment_tracking_get_shipment_tracking_column', ob_get_clean(), $order_id, $tracking_items );
|
208 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
/**
|
211 |
* Add the meta box for shipment info on the order page
|
212 |
*/
|
213 |
+
public function add_meta_box() {
|
214 |
add_meta_box( 'woocommerce-advanced-shipment-tracking', __( 'Shipment Tracking', 'woo-advanced-shipment-tracking' ), array( $this, 'meta_box' ), 'shop_order', 'side', 'high' );
|
215 |
}
|
216 |
|
218 |
* Returns a HTML node for a tracking item for the admin meta box
|
219 |
*/
|
220 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
221 |
+
$formatted = $this->get_formatted_tracking_item( $order_id, $item );
|
|
|
222 |
?>
|
223 |
<div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
|
224 |
<div class="tracking-content">
|
294 |
*/
|
295 |
public function meta_box() {
|
296 |
global $post;
|
297 |
+
global $wpdb;
|
298 |
|
299 |
$WC_Countries = new WC_Countries();
|
300 |
$countries = $WC_Countries->get_countries();
|
333 |
$cbvalue = 1;
|
334 |
}
|
335 |
}
|
336 |
+
|
337 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
338 |
if($wc_ast_status_shipped == 1){
|
339 |
$change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
|
341 |
} else{
|
342 |
$change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
|
343 |
$shipped_label = 'Completed';
|
344 |
+
}
|
|
|
|
|
345 |
|
346 |
echo '<div id="tracking-items">';
|
347 |
if ( count( $tracking_items ) > 0 ) {
|
390 |
'id' => 'wc_shipment_tracking_create_nonce',
|
391 |
'value' => wp_create_nonce( 'create-tracking-item' ),
|
392 |
) );
|
393 |
+
?>
|
394 |
+
<p class="form-field tracking_number_field ">
|
395 |
+
<label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
|
396 |
+
<input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
|
397 |
+
</p>
|
398 |
+
<?php
|
399 |
+
/*woocommerce_wp_text_input( array(
|
400 |
'id' => 'tracking_number',
|
401 |
'label' => __( 'Tracking number:', 'woo-advanced-shipment-tracking' ),
|
402 |
'placeholder' => '',
|
403 |
'description' => '',
|
404 |
'value' => '',
|
405 |
+
'autofocus' => true,
|
406 |
+
) );*/
|
407 |
|
408 |
woocommerce_wp_text_input( array(
|
409 |
'id' => 'tracking_product_code',
|
421 |
'class' => 'date-picker-field',
|
422 |
'value' => date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ),
|
423 |
) );
|
424 |
+
|
425 |
+
do_action("ast_after_tracking_field", $post->ID);
|
426 |
do_action("ast_tracking_form_between_form", $post->ID);
|
427 |
|
428 |
if($wc_ast_status_partial_shipped){
|
578 |
'tracking_product_code' => $tracking_product_code,
|
579 |
'date_shipped' => wc_clean( $_POST['date_shipped'] ),
|
580 |
);
|
581 |
+
|
582 |
+
$args = apply_filters( 'tracking_info_args', $args, $order_id );
|
583 |
+
|
584 |
$tracking_item = $this->add_tracking_item( $order_id, $args );
|
585 |
|
586 |
+
if($_POST['change_order_to_shipped'] == 'change_order_to_shipped'){
|
|
|
587 |
if('completed' == $order->get_status()){
|
588 |
WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
|
589 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
622 |
'tracking_product_code' => $tracking_product_code,
|
623 |
'date_shipped' => wc_clean( $_POST['date_shipped'] ),
|
624 |
);
|
625 |
+
|
626 |
+
$args = apply_filters( 'tracking_info_args', $args, $order_id );
|
627 |
+
|
628 |
$tracking_item = $this->add_tracking_item( $order_id, $args );
|
629 |
+
$order = new WC_Order($order_id);
|
630 |
|
631 |
+
if($_POST['change_order_to_shipped'] == 'change_order_to_shipped' || $_POST['change_order_to_shipped'] == 'yes'){
|
632 |
+
if('completed' == $order->get_status()){
|
633 |
+
WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
|
634 |
+
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
635 |
+
} else{
|
636 |
+
$order->update_status('completed');
|
637 |
+
}
|
638 |
+
} elseif($_POST['change_order_to_shipped'] == 'change_order_to_partial_shipped'){
|
639 |
+
$previous_order_status = $order->get_status();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
if('partial-shipped' == $previous_order_status){
|
641 |
WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
|
642 |
}
|
737 |
|
738 |
if ( is_a( $email, 'WC_Email_Customer_Invoice' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_invoice']) && $wc_ast_unclude_tracking_info['show_in_customer_invoice'] == 0){
|
739 |
return;
|
740 |
+
}
|
741 |
+
|
742 |
+
if ( is_a( $email, 'WC_Email_Customer_Note' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_note']) && $wc_ast_unclude_tracking_info['show_in_customer_note'] == 0){
|
743 |
+
return;
|
744 |
+
}
|
745 |
|
746 |
+
if(isset($wc_ast_unclude_tracking_info[$order_status]) && $wc_ast_unclude_tracking_info[$order_status] == 0 && !is_a( $email, 'WC_Email_Customer_Invoice' ) && !is_a( $email, 'WC_Email_Customer_Note' )){
|
747 |
return;
|
748 |
}
|
749 |
|
765 |
}
|
766 |
}
|
767 |
}
|
768 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
/**
|
771 |
* Prevents data being copied to subscription renewals
|
782 |
public function get_formatted_tracking_item( $order_id, $tracking_item ) {
|
783 |
$formatted = array();
|
784 |
$tracking_items = $this->get_tracking_items( $order_id );
|
785 |
+
$trackship_supported = '';
|
786 |
foreach($tracking_items as $key=>$item){
|
787 |
if($item['tracking_id'] == $tracking_item['tracking_id']){
|
788 |
$shipmet_key = $key;
|
987 |
$tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
|
988 |
}
|
989 |
|
990 |
+
$tracking_item = apply_filters( 'tracking_item_args', $tracking_item, $args, $order_id );
|
991 |
+
|
992 |
$tracking_items = $this->get_tracking_items( $order_id );
|
993 |
if($tracking_items){
|
994 |
$key = $this->seach_tracking_number_in_items($args['tracking_number'], $tracking_items);
|
999 |
}
|
1000 |
} else{
|
1001 |
$tracking_items[] = $tracking_item;
|
1002 |
+
}
|
1003 |
+
//echo '<pre>';print_r($tracking_items);echo '</pre>';
|
|
|
|
|
1004 |
$this->save_tracking_items( $order_id, $tracking_items );
|
1005 |
|
1006 |
$status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
|
1007 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
1008 |
+
$order = new WC_Order( $order_id );
|
1009 |
+
|
1010 |
+
if( $status_shipped == 1){
|
1011 |
if('completed' == $order->get_status()){
|
1012 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1013 |
} else{
|
1017 |
|
1018 |
if( $status_shipped == 2){
|
1019 |
$wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
|
1020 |
+
if($wc_ast_status_partial_shipped){
|
|
|
1021 |
$order->update_status('partial-shipped');
|
1022 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1023 |
}
|
1024 |
}
|
1025 |
|
1026 |
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1027 |
+
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
|
|
|
|
1028 |
|
1029 |
// The text for the note
|
1030 |
$note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
|
1093 |
|
1094 |
$status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
|
1095 |
$ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
|
1096 |
+
$order = new WC_Order( $order_id );
|
1097 |
+
|
1098 |
+
if( $status_shipped == 1){
|
1099 |
if('completed' == $order->get_status()){
|
1100 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1101 |
} else{
|
1103 |
}
|
1104 |
}
|
1105 |
|
1106 |
+
if( $status_shipped == 2){
|
|
|
1107 |
$order->update_status('partial-shipped');
|
1108 |
$ast_admin->trigger_woocommerce_order_status_completed( $order_id );
|
1109 |
}
|
1110 |
+
|
1111 |
+
$formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
|
1112 |
+
$tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
|
1113 |
+
|
1114 |
+
// The text for the note
|
1115 |
+
$note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
|
1116 |
+
|
1117 |
+
// Add the note
|
1118 |
+
$order->add_order_note( $note );
|
1119 |
+
|
1120 |
return $tracking_item;
|
1121 |
}
|
1122 |
|
1350 |
}
|
1351 |
}
|
1352 |
|
1353 |
+
if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.php' ) ) {
|
1354 |
|
1355 |
// search for the order by custom order number
|
1356 |
$query_args = array(
|
1449 |
wp_reset_postdata();
|
1450 |
}
|
1451 |
|
1452 |
+
if ( is_plugin_active( 'yith-woocommerce-sequential-order-number-premium/init.php' ) ) {
|
1453 |
+
$args = array(
|
1454 |
+
'post_type' => 'shop_order',
|
1455 |
+
'posts_per_page' => '1',
|
1456 |
+
'meta_query' => array(
|
1457 |
+
'relation' => 'AND',
|
1458 |
+
array(
|
1459 |
+
'key' => '_ywson_custom_number_order_complete',
|
1460 |
+
'value' => $order_id
|
1461 |
+
),
|
1462 |
+
),
|
1463 |
+
'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
|
1464 |
+
);
|
1465 |
+
$posts = get_posts( $args );
|
1466 |
+
$my_query = new WP_Query( $args );
|
1467 |
+
|
1468 |
+
if( $my_query->have_posts() ) {
|
1469 |
+
while( $my_query->have_posts()) {
|
1470 |
+
$my_query->the_post();
|
1471 |
+
if(get_the_ID()){
|
1472 |
+
$order_id = get_the_ID();
|
1473 |
+
}
|
1474 |
+
} // end while
|
1475 |
+
} // end if
|
1476 |
+
wp_reset_postdata();
|
1477 |
+
}
|
1478 |
+
|
1479 |
return $order_id;
|
1480 |
}
|
1481 |
|
1497 |
}
|
1498 |
}
|
1499 |
|
1500 |
+
if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.php' ) ) {
|
1501 |
$custom_order_number = get_post_meta( $order_id, '_order_number_formatted', true );
|
1502 |
if(!empty($custom_order_number)){
|
1503 |
return $custom_order_number;
|
1526 |
if(!empty($custom_order_number)){
|
1527 |
return $custom_order_number;
|
1528 |
}
|
1529 |
+
}
|
1530 |
+
if ( is_plugin_active( 'yith-woocommerce-sequential-order-number-premium/init.php' ) ) {
|
1531 |
+
$custom_order_number = get_post_meta( $order_id, '_ywson_custom_number_order_complete', true );
|
1532 |
+
if(!empty($custom_order_number)){
|
1533 |
+
return $custom_order_number;
|
1534 |
+
}
|
1535 |
+
}
|
1536 |
+
return $order_id;
|
1537 |
}
|
1538 |
|
1539 |
public function get_option_value_from_array($array,$key,$default_value){
|
1549 |
}
|
1550 |
return $value;
|
1551 |
}
|
1552 |
+
|
1553 |
+
public function check_if_virtual_order($order_id){
|
1554 |
+
|
1555 |
+
$order = wc_get_order( $order_id );
|
1556 |
+
|
1557 |
+
if( is_a( $order, 'WC_Order' ) ) {
|
1558 |
+
|
1559 |
+
$order_items = $order->get_items();
|
1560 |
+
|
1561 |
+
foreach( $order_items as $order_item_id => $order_item ) {
|
1562 |
+
|
1563 |
+
$product = wc_get_product( $order_item['product_id'] );
|
1564 |
+
|
1565 |
+
if ( $order_item->get_variation_id() ) {
|
1566 |
+
if ( 'product_variation' === get_post_type( $order_item->get_variation_id() ) )
|
1567 |
+
$product = wc_get_product( $order_item->get_variation_id() );
|
1568 |
+
}
|
1569 |
+
|
1570 |
+
if( $product ) {
|
1571 |
+
if( $product->is_virtual() || $product->is_downloadable()) return true;
|
1572 |
+
}
|
1573 |
+
}
|
1574 |
+
}
|
1575 |
+
return false;
|
1576 |
+
}
|
1577 |
}
|
includes/customizer/class-wc-shipped-email-customizer.php
ADDED
@@ -0,0 +1,430 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Customizer Setup and Custom Controls
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
+
*/
|
10 |
+
class wcast_shipped_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 |
+
// Register our sample default controls
|
17 |
+
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
18 |
+
|
19 |
+
// Only proceed if this is own request.
|
20 |
+
if ( ! wcast_shipped_customizer_email::is_own_customizer_request() && ! wcast_shipped_customizer_email::is_own_preview_request() ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_panels' ) );
|
24 |
+
// Register our sections
|
25 |
+
add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
|
26 |
+
|
27 |
+
// Remove unrelated components.
|
28 |
+
add_filter( 'customize_loaded_components', array( wcast_customizer(), 'remove_unrelated_components' ), 99, 2 );
|
29 |
+
|
30 |
+
// Remove unrelated sections.
|
31 |
+
add_filter( 'customize_section_active', array( wcast_customizer(), 'remove_unrelated_sections' ), 10, 2 );
|
32 |
+
|
33 |
+
// Unhook divi front end.
|
34 |
+
add_action( 'woomail_footer', array( wcast_customizer(), 'unhook_divi' ), 10 );
|
35 |
+
|
36 |
+
// Unhook Flatsome js
|
37 |
+
add_action( 'customize_preview_init', array( wcast_customizer(), 'unhook_flatsome' ), 50 );
|
38 |
+
|
39 |
+
add_filter( 'customize_controls_enqueue_scripts', array( wcast_customizer(), 'enqueue_customizer_scripts' ) );
|
40 |
+
|
41 |
+
add_action( 'parse_request', array( $this, 'set_up_preview' ) );
|
42 |
+
|
43 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue_preview_scripts' ) );
|
44 |
+
}
|
45 |
+
|
46 |
+
public function enqueue_preview_scripts() {
|
47 |
+
wp_enqueue_script('wcast-email-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
48 |
+
wp_enqueue_style('wcast-preview-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/preview-styles.css', array(), wc_advanced_shipment_tracking()->version );
|
49 |
+
// Send variables to Javascript
|
50 |
+
$preview_id = get_theme_mod('wcast_shipped_preview_order_id');
|
51 |
+
wp_localize_script('wcast-email-preview-scripts', 'wcast_preview', array(
|
52 |
+
'site_title' => $this->get_blogname(),
|
53 |
+
'order_number' => $preview_id,
|
54 |
+
));
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get blog name formatted for emails.
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function get_blogname() {
|
63 |
+
return wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Checks to see if we are opening our custom customizer preview
|
68 |
+
*
|
69 |
+
* @access public
|
70 |
+
* @return bool
|
71 |
+
*/
|
72 |
+
public static function is_own_preview_request() {
|
73 |
+
return isset( $_REQUEST['wcast-shipped-email-customizer-preview'] ) && '1' === $_REQUEST['wcast-shipped-email-customizer-preview'];
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Checks to see if we are opening our custom customizer controls
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
public static function is_own_customizer_request() {
|
83 |
+
return isset( $_REQUEST['email'] ) && $_REQUEST['email'] === 'customer_shipped_email';
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Get Customizer URL
|
88 |
+
*
|
89 |
+
*/
|
90 |
+
public static function get_customizer_url($email) {
|
91 |
+
$customizer_url = add_query_arg( array(
|
92 |
+
'wcast-customizer' => '1',
|
93 |
+
'email' => $email,
|
94 |
+
'url' => urlencode( add_query_arg( array( 'wcast-shipped-email-customizer-preview' => '1' ), home_url( '/' ) ) ),
|
95 |
+
'return' => urlencode( wcast_shipped_customizer_email::get_email_settings_page_url() ),
|
96 |
+
), admin_url( 'customize.php' ) );
|
97 |
+
|
98 |
+
return $customizer_url;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get WooCommerce email settings page URL
|
103 |
+
*
|
104 |
+
* @access public
|
105 |
+
* @return string
|
106 |
+
*/
|
107 |
+
public static function get_email_settings_page_url() {
|
108 |
+
return admin_url( 'admin.php?page=woocommerce-advanced-shipment-tracking' );
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* code for initialize default value for customizer
|
113 |
+
*/
|
114 |
+
public function wcast_generate_defaults() {
|
115 |
+
$customizer_defaults = array(
|
116 |
+
'wcast_shipped_email_subject' => __( 'Your {site_title} order is now shipped', 'woo-advanced-shipment-tracking' ),
|
117 |
+
'wcast_shipped_email_heading' => __( 'Your Order is Shipped', 'woocommerce' ),
|
118 |
+
'wcast_shipped_email_content' => __( "Hi there. we thought you'd like to know that your recent order from {site_title} has been shipped.", 'woo-advanced-shipment-tracking' ),
|
119 |
+
'wcast_enable_shipped_email' => 'no',
|
120 |
+
);
|
121 |
+
|
122 |
+
return apply_filters( 'skyrocket_customizer_defaults', $customizer_defaults );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Register our sample default controls
|
127 |
+
*/
|
128 |
+
public function wcast_register_sample_default_controls( $wp_customize ) {
|
129 |
+
/**
|
130 |
+
* Load all our Customizer Custom Controls
|
131 |
+
*/
|
132 |
+
require_once trailingslashit( dirname(__FILE__) ) . 'custom-controls.php';
|
133 |
+
|
134 |
+
$wp_customize->add_setting( 'shipped_order_email_heading',
|
135 |
+
array(
|
136 |
+
'default' => '',
|
137 |
+
'transport' => 'postMessage',
|
138 |
+
'sanitize_callback' => ''
|
139 |
+
)
|
140 |
+
);
|
141 |
+
$wp_customize->add_control( new WP_Customize_Heading_Control( $wp_customize, 'shipped_order_email_heading',
|
142 |
+
array(
|
143 |
+
'label' => __( 'Shipped status email', 'woo-advanced-shipment-tracking' ),
|
144 |
+
'description' => __( 'This section lets you customize the Email Content.', 'woo-advanced-shipment-tracking' ),
|
145 |
+
'section' => 'customer_shipped_email'
|
146 |
+
)
|
147 |
+
) );
|
148 |
+
// Display Shipment Provider image/thumbnail
|
149 |
+
$wp_customize->add_setting( 'customizer_shipped_order_settings_enabled',
|
150 |
+
array(
|
151 |
+
'default' => $this->defaults['wcast_enable_shipped_email'],
|
152 |
+
'transport' => 'postMessage',
|
153 |
+
'type' => 'option',
|
154 |
+
'sanitize_callback' => ''
|
155 |
+
)
|
156 |
+
);
|
157 |
+
$wp_customize->add_control( 'customizer_shipped_order_settings_enabled',
|
158 |
+
array(
|
159 |
+
'label' => __( 'Enable Shipped order status email', 'woo-advanced-shipment-tracking' ),
|
160 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
161 |
+
'section' => 'customer_shipped_email',
|
162 |
+
'type' => 'checkbox',
|
163 |
+
|
164 |
+
)
|
165 |
+
);
|
166 |
+
|
167 |
+
// Preview Order
|
168 |
+
$wp_customize->add_setting( 'wcast_shipped_preview_order_id',
|
169 |
+
array(
|
170 |
+
'default' => 'mockup',
|
171 |
+
'transport' => 'refresh',
|
172 |
+
'sanitize_callback' => ''
|
173 |
+
)
|
174 |
+
);
|
175 |
+
$wp_customize->add_control( new Skyrocket_Dropdown_Select_Custom_Control( $wp_customize, 'wcast_shipped_preview_order_id',
|
176 |
+
array(
|
177 |
+
'label' => __( 'Preview order', 'woo-advanced-shipment-tracking' ),
|
178 |
+
'description' => '',
|
179 |
+
'section' => 'customer_shipped_email',
|
180 |
+
'input_attrs' => array(
|
181 |
+
'placeholder' => __( 'Please select a order...', 'woo-advanced-shipment-tracking' ),
|
182 |
+
'class' => 'preview_order_select',
|
183 |
+
),
|
184 |
+
'choices' => wcast_customizer()->get_order_ids(),
|
185 |
+
)
|
186 |
+
) );
|
187 |
+
|
188 |
+
// Header Text
|
189 |
+
$wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[subject]',
|
190 |
+
array(
|
191 |
+
'default' => $this->defaults['wcast_shipped_email_subject'],
|
192 |
+
'transport' => 'postMessage',
|
193 |
+
'type' => 'option',
|
194 |
+
'sanitize_callback' => ''
|
195 |
+
)
|
196 |
+
);
|
197 |
+
$wp_customize->add_control( 'woocommerce_customer_shipped_order_settings[subject]',
|
198 |
+
array(
|
199 |
+
'label' => __( 'Subject', 'woocommerce' ),
|
200 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
201 |
+
'section' => 'customer_shipped_email',
|
202 |
+
'type' => 'text',
|
203 |
+
'input_attrs' => array(
|
204 |
+
'class' => '',
|
205 |
+
'style' => '',
|
206 |
+
'placeholder' => __( $this->defaults['wcast_shipped_email_subject'], 'woo-advanced-shipment-tracking' ),
|
207 |
+
),
|
208 |
+
)
|
209 |
+
);
|
210 |
+
|
211 |
+
// Header Text
|
212 |
+
$wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[heading]',
|
213 |
+
array(
|
214 |
+
'default' => $this->defaults['wcast_shipped_email_heading'],
|
215 |
+
'transport' => 'postMessage',
|
216 |
+
'type' => 'option',
|
217 |
+
'sanitize_callback' => ''
|
218 |
+
)
|
219 |
+
);
|
220 |
+
$wp_customize->add_control( 'woocommerce_customer_shipped_order_settings[heading]',
|
221 |
+
array(
|
222 |
+
'label' => __( 'Email heading', 'woocommerce' ),
|
223 |
+
'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
|
224 |
+
'section' => 'customer_shipped_email',
|
225 |
+
'type' => 'text',
|
226 |
+
'input_attrs' => array(
|
227 |
+
'class' => '',
|
228 |
+
'style' => '',
|
229 |
+
'placeholder' => __( $this->defaults['wcast_shipped_email_heading'], 'woo-advanced-shipment-tracking' ),
|
230 |
+
),
|
231 |
+
)
|
232 |
+
);
|
233 |
+
|
234 |
+
|
235 |
+
// Test of TinyMCE control
|
236 |
+
$wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[wcast_shipped_email_content]',
|
237 |
+
array(
|
238 |
+
'default' => $this->defaults['wcast_shipped_email_content'],
|
239 |
+
'transport' => 'refresh',
|
240 |
+
'sanitize_callback' => 'wp_kses_post',
|
241 |
+
'type' => 'option',
|
242 |
+
)
|
243 |
+
);
|
244 |
+
$wp_customize->add_control( new Skyrocket_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_shipped_order_settings[wcast_shipped_email_content]',
|
245 |
+
array(
|
246 |
+
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
247 |
+
'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
|
248 |
+
'section' => 'customer_shipped_email',
|
249 |
+
'input_attrs' => array(
|
250 |
+
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
251 |
+
'mediaButtons' => true,
|
252 |
+
'placeholder' => __( $this->defaults['wcast_shipped_email_content'], 'woo-advanced-shipment-tracking' ),
|
253 |
+
)
|
254 |
+
)
|
255 |
+
) );
|
256 |
+
|
257 |
+
$wp_customize->add_setting( 'wcast_shipped_code_block',
|
258 |
+
array(
|
259 |
+
'default' => '',
|
260 |
+
'transport' => 'postMessage',
|
261 |
+
'sanitize_callback' => ''
|
262 |
+
)
|
263 |
+
);
|
264 |
+
$wp_customize->add_control( new WP_Customize_codeinfoblock_Control( $wp_customize, 'wcast_shipped_code_block',
|
265 |
+
array(
|
266 |
+
'label' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ),
|
267 |
+
'description' => '<code>{site_title}<br>{customer_email}<br>{customer_first_name}<br>{customer_last_name}<br>{customer_company_name}<br>{customer_username}<br>{order_number}</code>',
|
268 |
+
'section' => 'customer_shipped_email',
|
269 |
+
)
|
270 |
+
) );
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Set up preview
|
275 |
+
*
|
276 |
+
* @access public
|
277 |
+
* @return void
|
278 |
+
*/
|
279 |
+
public function set_up_preview() {
|
280 |
+
wcast_shipped_customizer_email::is_own_preview_request();
|
281 |
+
// Make sure this is own preview request.
|
282 |
+
if ( ! wcast_shipped_customizer_email::is_own_preview_request() ) {
|
283 |
+
return;
|
284 |
+
}
|
285 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/shipped_preview.php';
|
286 |
+
exit;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* code for preview of delivered order status email
|
291 |
+
*/
|
292 |
+
public function preview_shipped_email(){
|
293 |
+
// Load WooCommerce emails.
|
294 |
+
$wc_emails = WC_Emails::instance();
|
295 |
+
$emails = $wc_emails->get_emails();
|
296 |
+
$preview_id = get_theme_mod('wcast_shipped_preview_order_id');
|
297 |
+
|
298 |
+
if($preview_id == '' || $preview_id == 'mockup') {
|
299 |
+
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
300 |
+
echo $content;
|
301 |
+
return;
|
302 |
+
}
|
303 |
+
|
304 |
+
$order = wc_get_order( $preview_id );
|
305 |
+
|
306 |
+
if(!$order){
|
307 |
+
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
308 |
+
echo $content;
|
309 |
+
return;
|
310 |
+
}
|
311 |
+
|
312 |
+
$email_type = 'WC_Email_Customer_Shipped_Order';
|
313 |
+
|
314 |
+
if ( false === $email_type ) {
|
315 |
+
return false;
|
316 |
+
}
|
317 |
+
|
318 |
+
|
319 |
+
|
320 |
+
// Reference email.
|
321 |
+
if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
|
322 |
+
$email = $emails[ $email_type ];
|
323 |
+
}
|
324 |
+
$order_status = 'partial-shipped';
|
325 |
+
// Get an order
|
326 |
+
$order = self::get_wc_order_for_preview( $order_status, $preview_id );
|
327 |
+
|
328 |
+
// Make sure gateways are running in case the email needs to input content from them.
|
329 |
+
WC()->payment_gateways();
|
330 |
+
// Make sure shipping is running in case the email needs to input content from it.
|
331 |
+
WC()->shipping();
|
332 |
+
|
333 |
+
$email->object = $order;
|
334 |
+
$email->find['order-date'] = '{order_date}';
|
335 |
+
$email->find['order-number'] = '{order_number}';
|
336 |
+
if ( is_object( $order ) ) {
|
337 |
+
$email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
|
338 |
+
$email->replace['order-number'] = $email->object->get_order_number();
|
339 |
+
// Other properties
|
340 |
+
$email->recipient = $email->object->get_billing_email();
|
341 |
+
}
|
342 |
+
|
343 |
+
// Get email content and apply styles.
|
344 |
+
$content = $email->get_content();
|
345 |
+
|
346 |
+
$content = $email->style_inline( $content );
|
347 |
+
$content = apply_filters( 'woocommerce_mail_content', $content );
|
348 |
+
|
349 |
+
echo $content;
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Get WooCommerce order for preview
|
354 |
+
*
|
355 |
+
* @access public
|
356 |
+
* @param string $order_status
|
357 |
+
* @return object
|
358 |
+
*/
|
359 |
+
public static function get_wc_order_for_preview( $order_status = null, $order_id = null ) {
|
360 |
+
if ( ! empty( $order_id ) && 'mockup' != $order_id ) {
|
361 |
+
return wc_get_order( $order_id );
|
362 |
+
} else {
|
363 |
+
// Use mockup order
|
364 |
+
|
365 |
+
// Instantiate order object
|
366 |
+
$order = new WC_Order();
|
367 |
+
|
368 |
+
// Other order properties
|
369 |
+
$order->set_props( array(
|
370 |
+
'id' => 1,
|
371 |
+
'status' => ( null === $order_status ? 'processing' : $order_status ),
|
372 |
+
'billing_first_name' => 'Sherlock',
|
373 |
+
'billing_last_name' => 'Holmes',
|
374 |
+
'billing_company' => 'Detectives Ltd.',
|
375 |
+
'billing_address_1' => '221B Baker Street',
|
376 |
+
'billing_city' => 'London',
|
377 |
+
'billing_postcode' => 'NW1 6XE',
|
378 |
+
'billing_country' => 'GB',
|
379 |
+
'billing_email' => 'sherlock@holmes.co.uk',
|
380 |
+
'billing_phone' => '02079304832',
|
381 |
+
'date_created' => date( 'Y-m-d H:i:s' ),
|
382 |
+
'total' => 24.90,
|
383 |
+
) );
|
384 |
+
|
385 |
+
// Item #1
|
386 |
+
$order_item = new WC_Order_Item_Product();
|
387 |
+
$order_item->set_props( array(
|
388 |
+
'name' => 'A Study in Scarlet',
|
389 |
+
'subtotal' => '9.95',
|
390 |
+
'sku' => 'kwd_ex_1',
|
391 |
+
) );
|
392 |
+
$order->add_item( $order_item );
|
393 |
+
|
394 |
+
// Item #2
|
395 |
+
$order_item = new WC_Order_Item_Product();
|
396 |
+
$order_item->set_props( array(
|
397 |
+
'name' => 'The Hound of the Baskervilles',
|
398 |
+
'subtotal' => '14.95',
|
399 |
+
'sku' => 'kwd_ex_2',
|
400 |
+
) );
|
401 |
+
$order->add_item( $order_item );
|
402 |
+
|
403 |
+
// Return mockup order
|
404 |
+
return $order;
|
405 |
+
}
|
406 |
+
|
407 |
+
}
|
408 |
+
}
|
409 |
+
/**
|
410 |
+
* Initialise our Customizer settings
|
411 |
+
*/
|
412 |
+
|
413 |
+
$wcast_shipped_customizer_settings = new wcast_shipped_customizer_email();
|
414 |
+
add_action( 'customize_save_customizer_shipped_order_settings_enabled', 'woocommerce_customer_shipped_order_settings_fun', 100, 1 );
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Update Delivered order email enable/disable
|
418 |
+
*
|
419 |
+
*/
|
420 |
+
function woocommerce_customer_shipped_order_settings_fun($data){
|
421 |
+
$post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
|
422 |
+
$shipped_order_settings = get_option( 'woocommerce_customer_shipped_order_settings');
|
423 |
+
|
424 |
+
if(isset($post_values['customizer_shipped_order_settings_enabled']) && ($post_values['customizer_shipped_order_settings_enabled'] == 1)){
|
425 |
+
$shipped_order_settings['enabled'] = 'yes';
|
426 |
+
} else{
|
427 |
+
$shipped_order_settings['enabled'] = 'no';
|
428 |
+
}
|
429 |
+
update_option( 'woocommerce_customer_shipped_order_settings',$shipped_order_settings);
|
430 |
+
}
|
includes/customizer/class-wc-tracking-info-customizer.php
CHANGED
@@ -239,6 +239,24 @@ class wcast_initialise_customizer_settings {
|
|
239 |
)
|
240 |
);
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
// Header Text
|
243 |
$wp_customize->add_setting( 'tracking_info_settings[header_text_change]',
|
244 |
array(
|
239 |
)
|
240 |
);
|
241 |
|
242 |
+
// Show track label
|
243 |
+
$wp_customize->add_setting( 'tracking_info_settings[hide_trackig_header]',
|
244 |
+
array(
|
245 |
+
'default' => '',
|
246 |
+
'transport' => 'postMessage',
|
247 |
+
'sanitize_callback' => '',
|
248 |
+
'type' => 'option',
|
249 |
+
)
|
250 |
+
);
|
251 |
+
$wp_customize->add_control( 'tracking_info_settings[hide_trackig_header]',
|
252 |
+
array(
|
253 |
+
'label' => __( 'Hide Tracking Header', 'woo-advanced-shipment-tracking' ),
|
254 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
255 |
+
'section' => 'ast_tracking_general_section',
|
256 |
+
'type' => 'checkbox'
|
257 |
+
)
|
258 |
+
);
|
259 |
+
|
260 |
// Header Text
|
261 |
$wp_customize->add_setting( 'tracking_info_settings[header_text_change]',
|
262 |
array(
|
includes/customizer/class-wcast-customizer.php
CHANGED
@@ -104,7 +104,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
104 |
'description' => '',
|
105 |
'panel' => 'wcast_naviation_panel'
|
106 |
)
|
107 |
-
);
|
108 |
|
109 |
$wp_customize->add_section( 'customer_delivered_email',
|
110 |
array(
|
@@ -113,7 +113,13 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
113 |
'panel' => 'wcast_naviation_panel'
|
114 |
)
|
115 |
);
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
$wp_customize->add_section( 'customer_partial_shipped_email',
|
118 |
array(
|
119 |
'title' => __( 'Partially Shipped status email', 'woo-advanced-shipment-tracking' ),
|
@@ -208,6 +214,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
208 |
'ajax_url' => admin_url('admin-ajax.php'),
|
209 |
'email_preview_url' => $this->get_email_preview_url(),
|
210 |
'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
|
|
|
211 |
'updated_tracking_email_preview_url' => $this->get_updated_tracking_email_preview_url(),
|
212 |
'tracking_preview_url' => $this->get_tracking_preview_url(),
|
213 |
'customer_failure_preview_url' => $this->get_customer_failure_preview_url(),
|
@@ -247,6 +254,18 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
247 |
return $email_preview_url;
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
/**
|
251 |
* Get Customizer URL
|
252 |
*
|
@@ -430,7 +449,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
|
|
430 |
*/
|
431 |
public static function is_own_section( $key ) {
|
432 |
|
433 |
-
if ($key === 'wcast_naviation_panel' || $key === 'ast_tracking_general_section' || $key === 'ast_tracking_per_item' || $key === 'ast_tracking_simple_section' || $key === 'ast_tracking_table_section' || $key === 'default_controls_section' || $key === 'tracking_page_section' || $key === 'customer_delivered_email' || $key === 'customer_partial_shipped_email' || $key === 'customer_updated_tracking_email' || $key === 'customer_failure_email' || $key === 'customer_intransit_email' || $key === 'customer_outfordelivery_email' || $key === 'customer_delivered_status_email' || $key === 'customer_returntosender_email' || $key === 'customer_availableforpickup_email' || $key === 'admin_late_shipments_email') {
|
434 |
return true;
|
435 |
}
|
436 |
|
104 |
'description' => '',
|
105 |
'panel' => 'wcast_naviation_panel'
|
106 |
)
|
107 |
+
);
|
108 |
|
109 |
$wp_customize->add_section( 'customer_delivered_email',
|
110 |
array(
|
113 |
'panel' => 'wcast_naviation_panel'
|
114 |
)
|
115 |
);
|
116 |
+
$wp_customize->add_section( 'customer_custom_completed_email',
|
117 |
+
array(
|
118 |
+
'title' => __( 'Completed order status email', 'woo-advanced-shipment-tracking' ),
|
119 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
120 |
+
'panel' => 'wcast_naviation_panel'
|
121 |
+
)
|
122 |
+
);
|
123 |
$wp_customize->add_section( 'customer_partial_shipped_email',
|
124 |
array(
|
125 |
'title' => __( 'Partially Shipped status email', 'woo-advanced-shipment-tracking' ),
|
214 |
'ajax_url' => admin_url('admin-ajax.php'),
|
215 |
'email_preview_url' => $this->get_email_preview_url(),
|
216 |
'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
|
217 |
+
'custom_completed_email_preview_url' => $this->get_custom_completed_email_preview_url(),
|
218 |
'updated_tracking_email_preview_url' => $this->get_updated_tracking_email_preview_url(),
|
219 |
'tracking_preview_url' => $this->get_tracking_preview_url(),
|
220 |
'customer_failure_preview_url' => $this->get_customer_failure_preview_url(),
|
254 |
return $email_preview_url;
|
255 |
}
|
256 |
|
257 |
+
/**
|
258 |
+
* Get Customizer URL
|
259 |
+
*
|
260 |
+
*/
|
261 |
+
public static function get_custom_completed_email_preview_url() {
|
262 |
+
$email_preview_url = add_query_arg( array(
|
263 |
+
'wcast-custom-completed-email-customizer-preview' => '1',
|
264 |
+
), home_url( '' ) );
|
265 |
+
|
266 |
+
return $email_preview_url;
|
267 |
+
}
|
268 |
+
|
269 |
/**
|
270 |
* Get Customizer URL
|
271 |
*
|
449 |
*/
|
450 |
public static function is_own_section( $key ) {
|
451 |
|
452 |
+
if ($key === 'wcast_naviation_panel' || $key === 'ast_tracking_general_section' || $key === 'ast_tracking_per_item' || $key === 'ast_tracking_simple_section' || $key === 'ast_tracking_table_section' || $key === 'default_controls_section' || $key === 'tracking_page_section' || $key === 'customer_delivered_email' || $key === 'customer_custom_completed_email' || $key === 'customer_partial_shipped_email' || $key === 'customer_shipped_email' || $key === 'customer_updated_tracking_email' || $key === 'customer_failure_email' || $key === 'customer_intransit_email' || $key === 'customer_outfordelivery_email' || $key === 'customer_delivered_status_email' || $key === 'customer_returntosender_email' || $key === 'customer_availableforpickup_email' || $key === 'admin_late_shipments_email') {
|
453 |
return true;
|
454 |
}
|
455 |
|
includes/customizer/preview/shipped_preview.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
20 |
+
<?php wcast_shipped_customizer_email::preview_shipped_email(); ?>
|
21 |
+
|
22 |
+
</div>
|
23 |
+
|
24 |
+
<?php
|
25 |
+
do_action( 'woomail_footer' );
|
26 |
+
wp_footer(); ?>
|
27 |
+
|
28 |
+
</body>
|
29 |
+
|
30 |
+
</html>
|
includes/email-manager.php
CHANGED
@@ -22,17 +22,26 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
22 |
public function custom_init_emails( $emails ) {
|
23 |
|
24 |
// Include the email class file if it's not included already
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
}
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
-
|
33 |
-
if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
|
34 |
-
$emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
|
35 |
-
}
|
36 |
return $emails;
|
37 |
}
|
38 |
|
22 |
public function custom_init_emails( $emails ) {
|
23 |
|
24 |
// Include the email class file if it's not included already
|
25 |
+
$newstatus = get_option( "wc_ast_status_delivered", 0);
|
26 |
+
if( $newstatus == true ){
|
27 |
+
if ( ! isset( $emails[ 'WC_Email_Customer_Delivered_Order' ] ) ) {
|
28 |
+
$emails[ 'WC_Email_Customer_Delivered_Order' ] = include_once( 'emails/class-shipment-delivered-email.php' );
|
29 |
+
}
|
30 |
}
|
31 |
+
|
32 |
+
$partial_shipped_status = get_option( "wc_ast_status_partial_shipped", 0);
|
33 |
+
if( $partial_shipped_status == true ){
|
34 |
+
if ( ! isset( $emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] ) ) {
|
35 |
+
$emails[ 'WC_Email_Customer_Partial_Shipped_Order' ] = include_once( 'emails/class-shipment-partial-shipped-email.php' );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
$updated_tracking_status = get_option( "wc_ast_status_updated_tracking", 0);
|
40 |
+
if( $updated_tracking_status == true ){
|
41 |
+
if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
|
42 |
+
$emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
|
43 |
+
}
|
44 |
}
|
|
|
|
|
|
|
|
|
45 |
return $emails;
|
46 |
}
|
47 |
|
includes/emails/class-shipment-delivered-email.php
CHANGED
@@ -136,14 +136,13 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
|
|
136 |
//ob_start();
|
137 |
$woocommerce_customer_delivered_order_settings = get_option('woocommerce_customer_delivered_order_settings');
|
138 |
|
|
|
139 |
$email_content = $ast->get_option_value_from_array('woocommerce_customer_delivered_order_settings','wcast_delivered_email_content',$wcast_initialise_customizer_email->defaults['wcast_delivered_email_content']);
|
140 |
|
141 |
$wcast_show_tracking_details = $woocommerce_customer_delivered_order_settings['wcast_show_tracking_details'];
|
142 |
$wcast_show_order_details = $woocommerce_customer_delivered_order_settings['wcast_show_order_details'];
|
143 |
$wcast_show_billing_address = $woocommerce_customer_delivered_order_settings['wcast_show_billing_address'];
|
144 |
-
$wcast_show_shipping_address = $woocommerce_customer_delivered_order_settings['wcast_show_shipping_address'];
|
145 |
-
|
146 |
-
|
147 |
|
148 |
$message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
|
149 |
|
@@ -223,13 +222,13 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
|
|
223 |
ob_start();
|
224 |
do_action( 'wcast_email_after_email_content', $order, $sent_to_admin, $plain_text, $this );
|
225 |
$message .= ob_get_clean();
|
|
|
226 |
// create a new email
|
227 |
$email = new WC_Email();
|
228 |
$email->id = 'WC_Delivered_email';
|
229 |
|
230 |
// wrap the content with the email template and then add styles
|
231 |
-
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
232 |
-
|
233 |
return $message;
|
234 |
}
|
235 |
}
|
136 |
//ob_start();
|
137 |
$woocommerce_customer_delivered_order_settings = get_option('woocommerce_customer_delivered_order_settings');
|
138 |
|
139 |
+
|
140 |
$email_content = $ast->get_option_value_from_array('woocommerce_customer_delivered_order_settings','wcast_delivered_email_content',$wcast_initialise_customizer_email->defaults['wcast_delivered_email_content']);
|
141 |
|
142 |
$wcast_show_tracking_details = $woocommerce_customer_delivered_order_settings['wcast_show_tracking_details'];
|
143 |
$wcast_show_order_details = $woocommerce_customer_delivered_order_settings['wcast_show_order_details'];
|
144 |
$wcast_show_billing_address = $woocommerce_customer_delivered_order_settings['wcast_show_billing_address'];
|
145 |
+
$wcast_show_shipping_address = $woocommerce_customer_delivered_order_settings['wcast_show_shipping_address'];
|
|
|
|
|
146 |
|
147 |
$message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
|
148 |
|
222 |
ob_start();
|
223 |
do_action( 'wcast_email_after_email_content', $order, $sent_to_admin, $plain_text, $this );
|
224 |
$message .= ob_get_clean();
|
225 |
+
|
226 |
// create a new email
|
227 |
$email = new WC_Email();
|
228 |
$email->id = 'WC_Delivered_email';
|
229 |
|
230 |
// wrap the content with the email template and then add styles
|
231 |
+
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
|
|
232 |
return $message;
|
233 |
}
|
234 |
}
|
includes/views/admin_options_addons.php
CHANGED
@@ -176,7 +176,8 @@
|
|
176 |
</tbody>
|
177 |
</table>
|
178 |
</div>
|
179 |
-
</div>
|
|
|
180 |
</form>
|
181 |
</div>
|
182 |
<?php include 'zorem_admin_addons_sidebar.php'; ?>
|
176 |
</tbody>
|
177 |
</table>
|
178 |
</div>
|
179 |
+
</div>
|
180 |
+
<?php do_action('ast_addons_section_html');?>
|
181 |
</form>
|
182 |
</div>
|
183 |
<?php include 'zorem_admin_addons_sidebar.php'; ?>
|
includes/views/admin_options_settings.php
CHANGED
@@ -61,14 +61,13 @@
|
|
61 |
<tbody>
|
62 |
<tr valign="top">
|
63 |
<td>
|
64 |
-
<h3 style=""><?php _e( '
|
65 |
</td>
|
66 |
</tr>
|
67 |
</tbody>
|
68 |
-
</table>
|
69 |
-
|
70 |
<table class="form-table order-status-table">
|
71 |
-
<tbody>
|
72 |
<tr valign="top" class="<?php if(!get_option('wc_ast_status_delivered')){echo 'disable_row'; } ?>">
|
73 |
<td class="forminp" style="width: 30px;">
|
74 |
<span class="mdl-list__item-secondary-action">
|
@@ -193,7 +192,8 @@
|
|
193 |
<a class='settings_edit' href="<?php echo wcast_initialise_customizer_email::get_customizer_url('customer_updated_tracking_email'); ?>"><?php _e( 'Edit', 'woocommerce' ) ?></a>
|
194 |
</fieldset>
|
195 |
</td>
|
196 |
-
</tr>
|
|
|
197 |
</tbody>
|
198 |
</table>
|
199 |
<table class="form-table">
|
61 |
<tbody>
|
62 |
<tr valign="top">
|
63 |
<td>
|
64 |
+
<h3 style=""><?php _e( 'Order Statuses', 'woo-advanced-shipment-tracking' ); ?></h3>
|
65 |
</td>
|
66 |
</tr>
|
67 |
</tbody>
|
68 |
+
</table>
|
|
|
69 |
<table class="form-table order-status-table">
|
70 |
+
<tbody>
|
71 |
<tr valign="top" class="<?php if(!get_option('wc_ast_status_delivered')){echo 'disable_row'; } ?>">
|
72 |
<td class="forminp" style="width: 30px;">
|
73 |
<span class="mdl-list__item-secondary-action">
|
192 |
<a class='settings_edit' href="<?php echo wcast_initialise_customizer_email::get_customizer_url('customer_updated_tracking_email'); ?>"><?php _e( 'Edit', 'woocommerce' ) ?></a>
|
193 |
</fieldset>
|
194 |
</td>
|
195 |
+
</tr>
|
196 |
+
<?php do_action("ast_orders_status_column_end"); ?>
|
197 |
</tbody>
|
198 |
</table>
|
199 |
<table class="form-table">
|
includes/views/admin_status_notifications.php
CHANGED
@@ -13,8 +13,7 @@
|
|
13 |
$wcast_enable_availableforpickup_email = get_theme_mod('wcast_enable_availableforpickup_email');
|
14 |
$wcast_enable_late_shipments_email = get_theme_mod('wcast_enable_late_shipments_admin_email');
|
15 |
?>
|
16 |
-
<section class="ac-container border-top">
|
17 |
-
|
18 |
<div class="headig_label <?php if($wcast_enable_intransit_email == 1){ echo 'enable'; } else{ echo 'disable'; }?>">
|
19 |
<img class="email-icon" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/css/icons/In-Transit-512.png">
|
20 |
<span class="email_status_span">
|
@@ -24,8 +23,8 @@
|
|
24 |
</label>
|
25 |
</span>
|
26 |
</span>
|
27 |
-
<a href="<?php echo wcast_intransit_customizer_email::get_customizer_url('customer_intransit_email','
|
28 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_intransit_customizer_email::get_customizer_url('customer_intransit_email','
|
29 |
<p class="shipment_about"><?php _e('Carrier has accepted or picked up shipment from shipper. The shipment is on the way.', 'woo-advanced-shipment-tracking'); ?></p>
|
30 |
</div>
|
31 |
|
@@ -38,8 +37,8 @@
|
|
38 |
</label>
|
39 |
</span>
|
40 |
</span>
|
41 |
-
<a href="<?php echo wcast_returntosender_customizer_email::get_customizer_url('customer_returntosender_email','
|
42 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_returntosender_customizer_email::get_customizer_url('customer_returntosender_email','
|
43 |
<p class="shipment_about"><?php _e('Shipment is returned to sender', 'woo-advanced-shipment-tracking'); ?></p>
|
44 |
</div>
|
45 |
|
@@ -52,8 +51,8 @@
|
|
52 |
</label>
|
53 |
</span>
|
54 |
</span>
|
55 |
-
<a href="<?php echo wcast_availableforpickup_customizer_email::get_customizer_url('customer_availableforpickup_email','
|
56 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_availableforpickup_customizer_email::get_customizer_url('customer_availableforpickup_email','
|
57 |
<p class="shipment_about"><?php _e('The shipment is ready to pickup.', 'woo-advanced-shipment-tracking'); ?></p>
|
58 |
</div>
|
59 |
<div class="headig_label <?php if($wcast_enable_outfordelivery_email == 1){ echo 'enable'; } else{ echo 'disable'; }?>">
|
@@ -65,8 +64,8 @@
|
|
65 |
</label>
|
66 |
</span>
|
67 |
</span>
|
68 |
-
<a href="<?php echo wcast_outfordelivery_customizer_email::get_customizer_url('customer_outfordelivery_email','
|
69 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_outfordelivery_customizer_email::get_customizer_url('customer_outfordelivery_email','
|
70 |
<p class="shipment_about"><?php _e('Carrier is about to deliver the shipment', 'woo-advanced-shipment-tracking'); ?></p>
|
71 |
</div>
|
72 |
|
@@ -79,8 +78,8 @@
|
|
79 |
</label>
|
80 |
</span>
|
81 |
</span>
|
82 |
-
<a href="<?php echo wcast_delivered_customizer_email::get_customizer_url('customer_delivered_status_email','
|
83 |
-
<a class="edit_customizer_a button button-primary btn_ast2 <?php if($wcast_enable_delivered_email['enabled'] === 'yes' && get_option('wc_ast_status_delivered') == 1){ echo 'disabled_link'; }?>" href="<?php echo wcast_delivered_customizer_email::get_customizer_url('customer_delivered_status_email','
|
84 |
<p class="shipment_about"><?php _e('The shipment was delivered successfully', 'woo-advanced-shipment-tracking'); ?></p>
|
85 |
<p class="delivered_message <?php if($wcast_enable_delivered_email['enabled'] === 'yes' && get_option('wc_ast_status_delivered') == 1){ echo 'disable_delivered'; }?>"><?php _e("You already have delivered email enabled, to enable this email you'll need to disable the order status delivered in settings.", 'woo-advanced-shipment-tracking'); ?></p>
|
86 |
</div>
|
@@ -94,8 +93,8 @@
|
|
94 |
</label>
|
95 |
</span>
|
96 |
</span>
|
97 |
-
<a href="<?php echo wcast_failure_customizer_email::get_customizer_url('customer_failure_email','
|
98 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_failure_customizer_email::get_customizer_url('customer_failure_email','
|
99 |
<p class="shipment_about"><?php _e('Carrier attempted to deliver but failed, and usually leaves a notice and will try to deliver the package again.', 'woo-advanced-shipment-tracking'); ?></p>
|
100 |
</div>
|
101 |
</section>
|
@@ -115,8 +114,8 @@
|
|
115 |
</label>
|
116 |
</span>
|
117 |
</span>
|
118 |
-
<a href="<?php echo wcast_late_shipments_customizer_email::get_customizer_url('admin_late_shipments_email','
|
119 |
-
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_late_shipments_customizer_email::get_customizer_url('admin_late_shipments_email','
|
120 |
<p class="shipment_about"><?php _e('If a shipment reached the number of days that you define, and the shipment is not "delivered" or "Returned to Sender" than email will trigger', 'woo-advanced-shipment-tracking'); ?></p>
|
121 |
</div>
|
122 |
</section>
|
13 |
$wcast_enable_availableforpickup_email = get_theme_mod('wcast_enable_availableforpickup_email');
|
14 |
$wcast_enable_late_shipments_email = get_theme_mod('wcast_enable_late_shipments_admin_email');
|
15 |
?>
|
16 |
+
<section class="ac-container border-top">
|
|
|
17 |
<div class="headig_label <?php if($wcast_enable_intransit_email == 1){ echo 'enable'; } else{ echo 'disable'; }?>">
|
18 |
<img class="email-icon" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/css/icons/In-Transit-512.png">
|
19 |
<span class="email_status_span">
|
23 |
</label>
|
24 |
</span>
|
25 |
</span>
|
26 |
+
<a href="<?php echo wcast_intransit_customizer_email::get_customizer_url('customer_intransit_email','notifications') ?>" class="email_heading"><?php _e('In Transit', 'woo-advanced-shipment-tracking'); ?></a>
|
27 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_intransit_customizer_email::get_customizer_url('customer_intransit_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
28 |
<p class="shipment_about"><?php _e('Carrier has accepted or picked up shipment from shipper. The shipment is on the way.', 'woo-advanced-shipment-tracking'); ?></p>
|
29 |
</div>
|
30 |
|
37 |
</label>
|
38 |
</span>
|
39 |
</span>
|
40 |
+
<a href="<?php echo wcast_returntosender_customizer_email::get_customizer_url('customer_returntosender_email','notifications') ?>" class="email_heading"><?php _e('Return To Sender', 'woo-advanced-shipment-tracking'); ?></a>
|
41 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_returntosender_customizer_email::get_customizer_url('customer_returntosender_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
42 |
<p class="shipment_about"><?php _e('Shipment is returned to sender', 'woo-advanced-shipment-tracking'); ?></p>
|
43 |
</div>
|
44 |
|
51 |
</label>
|
52 |
</span>
|
53 |
</span>
|
54 |
+
<a href="<?php echo wcast_availableforpickup_customizer_email::get_customizer_url('customer_availableforpickup_email','notifications') ?>" class="email_heading"><?php _e('Available For Pickup', 'woo-advanced-shipment-tracking'); ?></a>
|
55 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_availableforpickup_customizer_email::get_customizer_url('customer_availableforpickup_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
56 |
<p class="shipment_about"><?php _e('The shipment is ready to pickup.', 'woo-advanced-shipment-tracking'); ?></p>
|
57 |
</div>
|
58 |
<div class="headig_label <?php if($wcast_enable_outfordelivery_email == 1){ echo 'enable'; } else{ echo 'disable'; }?>">
|
64 |
</label>
|
65 |
</span>
|
66 |
</span>
|
67 |
+
<a href="<?php echo wcast_outfordelivery_customizer_email::get_customizer_url('customer_outfordelivery_email','notifications') ?>" class="email_heading"><?php _e('Out For Delivery', 'woo-advanced-shipment-tracking'); ?></a>
|
68 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_outfordelivery_customizer_email::get_customizer_url('customer_outfordelivery_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
69 |
<p class="shipment_about"><?php _e('Carrier is about to deliver the shipment', 'woo-advanced-shipment-tracking'); ?></p>
|
70 |
</div>
|
71 |
|
78 |
</label>
|
79 |
</span>
|
80 |
</span>
|
81 |
+
<a href="<?php echo wcast_delivered_customizer_email::get_customizer_url('customer_delivered_status_email','notifications') ?>" class="email_heading <?php if($wcast_enable_delivered_email['enabled'] === 'yes' && get_option('wc_ast_status_delivered') == 1){ echo 'disabled_link'; }?>"><?php _e('Delivered', 'woo-advanced-shipment-tracking'); ?></a>
|
82 |
+
<a class="edit_customizer_a button button-primary btn_ast2 <?php if($wcast_enable_delivered_email['enabled'] === 'yes' && get_option('wc_ast_status_delivered') == 1){ echo 'disabled_link'; }?>" href="<?php echo wcast_delivered_customizer_email::get_customizer_url('customer_delivered_status_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
83 |
<p class="shipment_about"><?php _e('The shipment was delivered successfully', 'woo-advanced-shipment-tracking'); ?></p>
|
84 |
<p class="delivered_message <?php if($wcast_enable_delivered_email['enabled'] === 'yes' && get_option('wc_ast_status_delivered') == 1){ echo 'disable_delivered'; }?>"><?php _e("You already have delivered email enabled, to enable this email you'll need to disable the order status delivered in settings.", 'woo-advanced-shipment-tracking'); ?></p>
|
85 |
</div>
|
93 |
</label>
|
94 |
</span>
|
95 |
</span>
|
96 |
+
<a href="<?php echo wcast_failure_customizer_email::get_customizer_url('customer_failure_email','notifications') ?>" class="email_heading"><?php _e('Failed Attempt', 'woo-advanced-shipment-tracking'); ?></a>
|
97 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_failure_customizer_email::get_customizer_url('customer_failure_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
98 |
<p class="shipment_about"><?php _e('Carrier attempted to deliver but failed, and usually leaves a notice and will try to deliver the package again.', 'woo-advanced-shipment-tracking'); ?></p>
|
99 |
</div>
|
100 |
</section>
|
114 |
</label>
|
115 |
</span>
|
116 |
</span>
|
117 |
+
<a href="<?php echo wcast_late_shipments_customizer_email::get_customizer_url('admin_late_shipments_email','notifications') ?>" class="email_heading"><?php _e('Late Shipments', 'woo-advanced-shipment-tracking'); ?></a>
|
118 |
+
<a class="edit_customizer_a button button-primary btn_ast2" href="<?php echo wcast_late_shipments_customizer_email::get_customizer_url('admin_late_shipments_email','notifications') ?>"><?php _e('Edit', 'woocommerce'); ?></a>
|
119 |
<p class="shipment_about"><?php _e('If a shipment reached the number of days that you define, and the shipment is not "delivered" or "Returned to Sender" than email will trigger', 'woo-advanced-shipment-tracking'); ?></p>
|
120 |
</div>
|
121 |
</section>
|
includes/views/admin_trackship_dashboard.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
<th scope="row" class="titledesc"><label><?php _e( 'Connection Status', 'woo-advanced-shipment-tracking' ); ?></label></th>
|
15 |
<td class="forminp">
|
16 |
<fieldset>
|
17 |
-
<a href="https://
|
18 |
</fieldset>
|
19 |
</td>
|
20 |
</tr>
|
@@ -36,8 +36,8 @@
|
|
36 |
</tr>
|
37 |
<tr valign="top">
|
38 |
<td colspan="2">
|
39 |
-
<a href="https://trackship.info/
|
40 |
-
<a href="https://
|
41 |
</td>
|
42 |
</tr>
|
43 |
</tbody>
|
14 |
<th scope="row" class="titledesc"><label><?php _e( 'Connection Status', 'woo-advanced-shipment-tracking' ); ?></label></th>
|
15 |
<td class="forminp">
|
16 |
<fieldset>
|
17 |
+
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=sidebar&utm_campaign=upgrade" target="_blank" class="api_connected"><?php _e( 'Connected', 'woo-advanced-shipment-tracking' ); ?><span class="dashicons dashicons-yes"></span></a>
|
18 |
</fieldset>
|
19 |
</td>
|
20 |
</tr>
|
36 |
</tr>
|
37 |
<tr valign="top">
|
38 |
<td colspan="2">
|
39 |
+
<a href="https://trackship.info/docs/overview/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=docs" class="" style="margin-right: 10px;" target="blank"><?php _e( 'Documentation', 'woo-advanced-shipment-tracking' ); ?></a>
|
40 |
+
<a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=dashboard" class="" target="blank"><?php _e( 'TrackShip Dashboard', 'woo-advanced-shipment-tracking' ); ?></a>
|
41 |
</td>
|
42 |
</tr>
|
43 |
</tbody>
|
readme.txt
CHANGED
@@ -84,37 +84,15 @@ USPS, ePacket, Delhivery, Yun Express Tracking, UPS, Australia Post, FedEx, Aram
|
|
84 |
|
85 |
== Compatibility ==
|
86 |
|
87 |
-
|
88 |
-
* [Kadence WooCommerce Email Customizer](https://wordpress.org/plugins/kadence-woocommerce-email-designer/)
|
89 |
-
* [Decorator – WooCommerce Email Customizer](https://wordpress.org/plugins/decorator-woocommerce-email-customizer/)
|
90 |
-
* [Email Customizer for WooCommerce](https://codecanyon.net/item/email-customizer-for-woocommerce/8654473)
|
91 |
-
|
92 |
-
= Compatibility with custom order numbers plugins =
|
93 |
-
* [Custom Order Numbers for WooCommerce](https://wordpress.org/plugins/custom-order-numbers-for-woocommerce/)
|
94 |
-
* [WooCommerce Sequential Order Numbers](https://wordpress.org/plugins/woocommerce-sequential-order-numbers/)
|
95 |
-
* [Sequential Order Numbers Pro](https://woocommerce.com/products/sequential-order-numbers-pro/)
|
96 |
-
* [Booster for WooCommerce](https://wordpress.org/plugins/woocommerce-jetpack/)
|
97 |
-
* [WP-Lister Pro for Amazon](https://www.wplab.com/plugins/wp-lister-for-amazon/)
|
98 |
-
|
99 |
-
= Compatibility with PDF Invoices & Packing Slips plugins =
|
100 |
-
* [WooCommerce PDF Invoices & Packing Slips plugin](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips)
|
101 |
-
* [DHL for WooCommerce](https://wordpress.org/plugins/dhl-for-woocommerce/)
|
102 |
-
* [ShipWorks Connector for WordPress](https://wordpress.org/plugins/shipworks-e-commerce-bridge/)
|
103 |
-
|
104 |
-
= Compatibility with SMS Plugins =
|
105 |
-
* [SMS Alert Order Notifications – WooCommerce](https://wordpress.org/plugins/sms-alert/)
|
106 |
-
* [WC – APG SMS Notifications](https://wordpress.org/plugins/woocommerce-apg-sms-notifications/)
|
107 |
-
* [Twilio SMS Notifications](https://woocommerce.com/products/twilio-sms-notifications/)
|
108 |
-
* [WPNotif: WordPress SMS & WhatsApp Message Notifications](https://codecanyon.net/item/wpnotif-wordpress-sms-whatsapp-notifications/24045791)
|
109 |
-
|
110 |
-
= Compatibility with Multilingual Plugins =
|
111 |
-
* [WPML - The WordPress Multilingual Plugin](https://wpml.org/)
|
112 |
|
113 |
== Documentation ==
|
114 |
[documentation](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking) for more details.
|
115 |
|
116 |
https://www.youtube.com/watch?v=Mw7laecPtyw
|
117 |
|
|
|
|
|
118 |
== Frequently Asked Questions ==
|
119 |
|
120 |
= Where will my customer see the tracking info?
|
@@ -156,10 +134,45 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 2.9.9.3 =
|
160 |
* Dev - Limit get orders to 100 on TrackShip tools page
|
161 |
* Fix - version 2.9.8 rollback
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
= 2.9.8 =
|
164 |
* Fix - fixed issue so trackship_supported column adding in shipping providers table and based on that use carrier website as tracking link if TrackShip not sot supported
|
165 |
|
@@ -219,59 +232,4 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
|
|
219 |
* Enhancement - Redesign Shipment Tracking Customizer
|
220 |
* Fix - Fixed issue in tracking display customizer table background-color
|
221 |
|
222 |
-
= 2.8.9 =
|
223 |
-
* Enhancement - Add editable text for simple layout in tracking info customizer
|
224 |
-
* Dev - Added Rest API v3
|
225 |
-
* Localization - Updated language translation files
|
226 |
-
* Fix - undefined variable $tracking_info_settings in emails/plain/tracking-info.php
|
227 |
-
* Fix - Fixed issue in WooCommerce app - unable to fetch Shipping providers
|
228 |
-
|
229 |
-
= 2.8.8 =
|
230 |
-
* Enhancement - Added "Date" in simple layout tracking display format
|
231 |
-
* Enhancement - Updated date format for bulk import from dd-mm-YYYY to dd/mm/YYYY
|
232 |
-
* Dev - Added missing plain email template tracking-info.php
|
233 |
-
* Dev - Updated sample csv file for bulk import
|
234 |
-
|
235 |
-
= 2.8.7 =
|
236 |
-
* Dev - Added compatibility with WooCommerce 4.0
|
237 |
-
* Dev - Added compatibility with WPML
|
238 |
-
* Dev - Migrate customizer data from theme_mode to option
|
239 |
-
* Fix - Undefined index: date_shipped in woo-advanced-shipment-tracking/includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php on line 520
|
240 |
-
* Fix - Undefined index: date_shipped in woo-advanced-shipment-tracking/templates/emails/tracking-info.php on line 259
|
241 |
-
* Fix - Undefined variable: th_column_style in woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php on line 827
|
242 |
-
|
243 |
-
= 2.8.6 =
|
244 |
-
* Localization - Added language support for Dutch / Nederlands
|
245 |
-
* Enhancement - Added functionality for Late Shipment admin nitifactions
|
246 |
-
* Enhancement - Added option for choose date format for CSV import
|
247 |
-
* Dev - Added hook in orders details email template - 'wcast_email_before_order_table' and 'wcast_email_after_order_table'
|
248 |
-
* Dev - Updated TrackShip status emails logic - if the shipment status changes to one of the tracking numbers, send only this tracking number in the email notification
|
249 |
-
* Fix - validation issue in shippment tracking page
|
250 |
-
|
251 |
-
= 2.8.5 =
|
252 |
-
* Dev - If custom provider has no tracking link remove url from tracking number
|
253 |
-
* Fix - Fixed issue with tracking page in settings, display save button when trackship tracking page disable
|
254 |
-
* Fix - Fixed error with kadence customizer in completed email
|
255 |
-
|
256 |
-
= 2.8.4 =
|
257 |
-
* Dev - Updated licensing system for AST Tracking Per Item Add-on
|
258 |
-
|
259 |
-
= 2.8.3 =
|
260 |
-
* Fix - Fixed error 'Call to undefined function SMSWOO()' in settings page
|
261 |
-
|
262 |
-
= 2.8.2 =
|
263 |
-
* Dev - Added compatibility with Sequential Order Numbers Pro
|
264 |
-
* Enhancement - Added Indonesian shipping carriers
|
265 |
-
* Enhancement - Added SMS for WooCommerce section in Add-ons tab in settings
|
266 |
-
* Fix - Fixed issue with tracking url '&' in custom shipping provider
|
267 |
-
|
268 |
-
= 2.8.1 =
|
269 |
-
* Enhancement - Updated New Zealand Post and CourierPost shipping provider image
|
270 |
-
* Enhancement - Added success admin notice for review
|
271 |
-
|
272 |
-
= 2.8 =
|
273 |
-
* Dev - Added functionality for Bulk import tracking info per item for Tracking Per Item Addon
|
274 |
-
* Dev - Added functionality for add tracking info per item for Tracking Per Item Addon
|
275 |
-
* Enhancement - Updated New Zealand Post shipment provider logo
|
276 |
-
|
277 |
[For the complete changelog](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/changelog/)
|
84 |
|
85 |
== Compatibility ==
|
86 |
|
87 |
+
The Advanced Shipment Tracking plugin is compatible with many other plguins such as shipping label plugins and services, email customizer plugins, Customer order number plugins, PDF invoices plugins, multi vendor plugins, SMS plugins and more. Check out [AST's full list of plugins compatibility](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/compatibility/).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
== Documentation ==
|
90 |
[documentation](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking) for more details.
|
91 |
|
92 |
https://www.youtube.com/watch?v=Mw7laecPtyw
|
93 |
|
94 |
+
[](http://coderisk.com/wp/plugin/woo-advanced-shipment-tracking/RIPS-gD7ZIz6_U8)
|
95 |
+
|
96 |
== Frequently Asked Questions ==
|
97 |
|
98 |
= Where will my customer see the tracking info?
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 2.9.9.6 =
|
138 |
+
* Dev - When user disconnect Trackship and connect again than Trackship enable automatically
|
139 |
+
* Fix - Removed custom order status from the Documents tab of WooCommerce PDF Invoices & Packing Slips plugin if the custom order status is disabled
|
140 |
+
* Dev - Removed Woocommerce PDF Invoices & Packing Slips plugin compatibility code from the plugin
|
141 |
+
* Enhancement - Added option for hiding Tracking Header in tracking display customizer
|
142 |
+
* Dev - Change return URL of shipment status customizer, so it will return back to the notifications tab
|
143 |
+
|
144 |
+
= 2.9.9.5 =
|
145 |
+
* Enhancement - Update TrackShip link on WordPress dashboard and on the AST settings page
|
146 |
+
* Fix - Responsive issue of the shipping provider list
|
147 |
+
* Enhancement - Added shipping providers filter dropdown in the orders page
|
148 |
+
* Fix - Fixed warning - Undefined variable: trackship_supported in plugins/woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php on line 1056
|
149 |
+
* Dev - Remove query SHOW TABLES LIKE 'wp\\_shipment\\_batch\\_process'
|
150 |
+
* Dev - Added compatibility with Yith custom order numbers plugin
|
151 |
+
* Enhancement - Added option for remove tracking info from Customer note emails
|
152 |
+
|
153 |
+
= 2.9.9.4 =
|
154 |
+
* Enhancement - Added new option for create new order status shipped not just rename, so user can use completed and shipped both order status for virtual orders and Local Pickup shipping method
|
155 |
+
* Enhancement - Set tracking number field focus on orders ans single order page
|
156 |
+
* Enhancement Change tracking_number input field name- Update TrackShip link on WordPress dashboard and on the AST settings page
|
157 |
+
* Dev - Limit get orders to 100 on TrackShip tools page
|
158 |
+
* Dev - Fix slow load issue of WordPress dashboard because of TrckShip Analytics dashboard
|
159 |
+
|
160 |
= 2.9.9.3 =
|
161 |
* Dev - Limit get orders to 100 on TrackShip tools page
|
162 |
* Fix - version 2.9.8 rollback
|
163 |
|
164 |
+
= 2.9.9.2 =
|
165 |
+
* Fix - Fatal error: Uncaught Error: Call to a member function get() on null in /home/jh1ua38qa95m/public_html/store/wp-includes/query.php:28 Stack trace: woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking-settings.php(444)
|
166 |
+
|
167 |
+
= 2.9.9.1 =
|
168 |
+
* Fix - Fatal error: Uncaught Error: Call to a member function get_items() on bool in woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php:328
|
169 |
+
|
170 |
+
= 2.9.9 =
|
171 |
+
* Enhancement - Added new option for create new order status shipped not just rename, so user can use completed and shipped both order status for virtual orders and Local Pickup shipping method
|
172 |
+
* Enhancement - Set tracking number field focus on orders ans single order page
|
173 |
+
* Enhancement - Update TrackShip link on WordPress dashboard and on the AST settings page
|
174 |
+
* Dev - Limit get orders to 100 on TrackShip tools page
|
175 |
+
|
176 |
= 2.9.8 =
|
177 |
* Fix - fixed issue so trackship_supported column adding in shipping providers table and based on that use carrier website as tracking link if TrackShip not sot supported
|
178 |
|
232 |
* Enhancement - Redesign Shipment Tracking Customizer
|
233 |
* Fix - Fixed issue in tracking display customizer table background-color
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
[For the complete changelog](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/changelog/)
|
templates/emails/customer-shipped-order.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Customer shipped order email
|
4 |
+
*
|
5 |
+
* This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-shipped-order.php.
|
6 |
+
*
|
7 |
+
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
8 |
+
* (the theme developer) will need to copy the new files to your theme to
|
9 |
+
* maintain compatibility. We try to do this as little as possible, but it does
|
10 |
+
* happen. When this occurs the version of the template file will be bumped and
|
11 |
+
* the readme will list any important changes.
|
12 |
+
*
|
13 |
+
* @see https://docs.woocommerce.com/document/template-structure/
|
14 |
+
* @package WooCommerce/Templates/Emails
|
15 |
+
* @version 3.7.0
|
16 |
+
*/
|
17 |
+
|
18 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
$wcast_shipped_customizer_settings = new wcast_shipped_customizer_email();
|
22 |
+
|
23 |
+
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
24 |
+
$email_content = $ast->get_option_value_from_array('woocommerce_customer_shipped_order_settings','wcast_shipped_email_content',$wcast_shipped_customizer_settings->defaults['wcast_shipped_email_content']);
|
25 |
+
|
26 |
+
$email_content = str_replace( '{customer_email}', $order->get_billing_email(), $email_content );
|
27 |
+
$email_content = str_replace( '{site_title}', $wcast_shipped_customizer_settings->get_blogname(), $email_content );
|
28 |
+
$email_content = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $email_content );
|
29 |
+
$email_content = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $email_content );
|
30 |
+
|
31 |
+
if($order->get_billing_company()){
|
32 |
+
$email_content = str_replace( '{customer_company_name}', $order->get_billing_company(), $email_content );
|
33 |
+
} else{
|
34 |
+
$email_content = str_replace( '{customer_company_name}','', $email_content );
|
35 |
+
}
|
36 |
+
|
37 |
+
$user = $order->get_user();
|
38 |
+
if($user){
|
39 |
+
$username = $user->user_login;
|
40 |
+
}
|
41 |
+
if(isset($username)){
|
42 |
+
$email_content = str_replace( '{customer_username}', $username, $email_content );
|
43 |
+
} else{
|
44 |
+
$email_content = str_replace( '{customer_username}', '', $email_content );
|
45 |
+
}
|
46 |
+
$email_content = str_replace( '{order_number}', $order->get_id(), $email_content );
|
47 |
+
/*
|
48 |
+
* @hooked WC_Emails::email_header() Output the email header
|
49 |
+
*/
|
50 |
+
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
51 |
+
|
52 |
+
<?php /* translators: %s: Site title */ ?>
|
53 |
+
<p class="shipped_email_content"><?php echo $email_content; ?></p>
|
54 |
+
<?php
|
55 |
+
|
56 |
+
/*
|
57 |
+
* @hooked WC_Emails::order_details() Shows the order details table.
|
58 |
+
* @hooked WC_Structured_Data::generate_order_data() Generates structured data.
|
59 |
+
* @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
|
60 |
+
* @since 2.5.0
|
61 |
+
*/
|
62 |
+
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
|
63 |
+
|
64 |
+
/*
|
65 |
+
* @hooked WC_Emails::order_meta() Shows order meta data.
|
66 |
+
*/
|
67 |
+
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
|
68 |
+
|
69 |
+
/*
|
70 |
+
* @hooked WC_Emails::customer_details() Shows customer details
|
71 |
+
* @hooked WC_Emails::email_address() Shows email address
|
72 |
+
*/
|
73 |
+
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Show user-defined additonal content - this is set in each email's settings.
|
77 |
+
*/
|
78 |
+
if ( $additional_content ) {
|
79 |
+
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
|
80 |
+
}
|
81 |
+
|
82 |
+
/*
|
83 |
+
* @hooked WC_Emails::email_footer() Output the email footer
|
84 |
+
*/
|
85 |
+
do_action( 'woocommerce_email_footer', $email );
|
templates/emails/tracking-info.php
CHANGED
@@ -33,7 +33,7 @@ if ( $tracking_items ) :
|
|
33 |
$tracking_info_settings = get_option('tracking_info_settings');
|
34 |
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
35 |
|
36 |
-
$select_tracking_template = $tracking_info_settings['select_tracking_template'];
|
37 |
|
38 |
$show_provider_th = 1;
|
39 |
$colspan = 1;
|
@@ -71,9 +71,11 @@ if ( $tracking_items ) :
|
|
71 |
|
72 |
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
|
|
|
|
77 |
|
78 |
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
|
79 |
|
@@ -93,7 +95,7 @@ if ( $tracking_items ) :
|
|
93 |
|
94 |
$tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color',$wcast_customizer_settings->defaults['tracking_link_bg_color']);
|
95 |
|
96 |
-
if($tracking_info_settings['tracking_link_border']){
|
97 |
$tracking_link_border = 'underline';
|
98 |
} else{
|
99 |
$tracking_link_border = 'unset';
|
@@ -139,8 +141,12 @@ if ( $tracking_items ) :
|
|
139 |
$text_align = is_rtl() ? 'right' : 'left';
|
140 |
|
141 |
$shipment_status = get_post_meta( $order_id, "shipment_status", true);
|
|
|
142 |
?>
|
143 |
-
<h2 class="header_text" style="text-align:<?php echo $text_align;
|
|
|
|
|
|
|
144 |
<p class="addition_header"><?php echo $shipment_tracking_header_text; ?></p>
|
145 |
<?php
|
146 |
if(isset($new_status)){ ?>
|
@@ -168,7 +174,7 @@ if ( $tracking_items ) :
|
|
168 |
|
169 |
$simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
|
170 |
|
171 |
-
$tracking_number_link = '<a href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
|
172 |
|
173 |
$simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
|
174 |
|
33 |
$tracking_info_settings = get_option('tracking_info_settings');
|
34 |
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
35 |
|
36 |
+
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template',$wcast_customizer_settings->defaults['select_tracking_template']);
|
37 |
|
38 |
$show_provider_th = 1;
|
39 |
$colspan = 1;
|
71 |
|
72 |
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
|
73 |
|
74 |
+
$hide_trackig_header = $ast->get_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
75 |
|
76 |
+
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
77 |
+
|
78 |
+
$shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
|
79 |
|
80 |
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
|
81 |
|
95 |
|
96 |
$tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color',$wcast_customizer_settings->defaults['tracking_link_bg_color']);
|
97 |
|
98 |
+
if(isset($tracking_info_settings['tracking_link_border'])){
|
99 |
$tracking_link_border = 'underline';
|
100 |
} else{
|
101 |
$tracking_link_border = 'unset';
|
141 |
$text_align = is_rtl() ? 'right' : 'left';
|
142 |
|
143 |
$shipment_status = get_post_meta( $order_id, "shipment_status", true);
|
144 |
+
if($preview){
|
145 |
?>
|
146 |
+
<h2 class="header_text <?php if($hide_trackig_header){ echo 'hide'; } ?>" style="text-align:<?php echo $text_align; ?>;"><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
147 |
+
<?php } else{ ?>
|
148 |
+
<h2 class="header_text" style="text-align:<?php echo $text_align; ?>;<?php if($hide_trackig_header){ echo 'display:none;'; } ?>"><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
149 |
+
<?php } ?>
|
150 |
<p class="addition_header"><?php echo $shipment_tracking_header_text; ?></p>
|
151 |
<?php
|
152 |
if(isset($new_status)){ ?>
|
174 |
|
175 |
$simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
|
176 |
|
177 |
+
$tracking_number_link = '<a target="_blank" href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
|
178 |
|
179 |
$simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
|
180 |
|
templates/myaccount/tracking-info.php
CHANGED
@@ -31,8 +31,8 @@ if ( $tracking_items ) :
|
|
31 |
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
32 |
|
33 |
$tracking_info_settings = get_option('tracking_info_settings');
|
34 |
-
|
35 |
-
$select_tracking_template = $tracking_info_settings['select_tracking_template'];
|
36 |
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
@@ -64,9 +64,11 @@ if ( $tracking_items ) :
|
|
64 |
|
65 |
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
66 |
|
67 |
-
|
|
|
|
|
68 |
|
69 |
-
|
70 |
|
71 |
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
|
72 |
|
@@ -117,7 +119,9 @@ if ( $tracking_items ) :
|
|
117 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
118 |
?>
|
119 |
|
120 |
-
|
|
|
|
|
121 |
<p><?php echo $shipment_tracking_header_text; ?></p>
|
122 |
<style>
|
123 |
.my_account_tracking td:first-child{
|
@@ -146,7 +150,7 @@ if ( $tracking_items ) :
|
|
146 |
|
147 |
$simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
|
148 |
|
149 |
-
$tracking_number_link = '<a href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
|
150 |
|
151 |
$simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
|
152 |
|
31 |
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
32 |
|
33 |
$tracking_info_settings = get_option('tracking_info_settings');
|
34 |
+
|
35 |
+
$select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template',$wcast_customizer_settings->defaults['select_tracking_template']);
|
36 |
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
64 |
|
65 |
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
66 |
|
67 |
+
$hide_trackig_header = $ast->get_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
68 |
+
|
69 |
+
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
70 |
|
71 |
+
$shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
|
72 |
|
73 |
$email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
|
74 |
|
119 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
120 |
?>
|
121 |
|
122 |
+
<?php if($hide_trackig_header != 1){ ?>
|
123 |
+
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
124 |
+
<?php } ?>
|
125 |
<p><?php echo $shipment_tracking_header_text; ?></p>
|
126 |
<style>
|
127 |
.my_account_tracking td:first-child{
|
150 |
|
151 |
$simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
|
152 |
|
153 |
+
$tracking_number_link = '<a target="_blank" href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
|
154 |
|
155 |
$simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
|
156 |
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,14 +4,14 @@
|
|
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: 2.9.9.
|
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 |
* Domain Path: /lang/
|
14 |
-
* WC tested up to: 4.0
|
15 |
*/
|
16 |
|
17 |
|
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
-
public $version = '2.9.9.
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
@@ -152,9 +152,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
152 |
} else{
|
153 |
add_action( 'woocommerce_email_before_order_table', array( $this->actions, 'email_display' ), 0, 4 );
|
154 |
}
|
155 |
-
}
|
156 |
-
|
157 |
-
add_action( 'wpo_wcpdf_before_order_details', array( $this->actions, 'tracking_display_in_invoice' ), 0, 4 );
|
158 |
|
159 |
add_shortcode( 'woo_mb_tracking_info' , array( $this, 'tracking_info_shortcode'));
|
160 |
|
@@ -166,8 +164,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
166 |
add_action("fix_shipment_tracking_for_deleted_tracking", array( $this->actions, 'func_fix_shipment_tracking_for_deleted_tracking' ), 10, 3 );
|
167 |
|
168 |
add_action('admin_footer', array( $this->actions, 'custom_validation_js'));
|
169 |
-
|
170 |
-
//add_action('admin_footer', array( $this->actions, 'add_inline_tracking_lightbox'));
|
171 |
add_action( 'wp_ajax_add_inline_tracking_number', array( $this->actions, 'save_inline_tracking_number' ) );
|
172 |
|
173 |
//load css js
|
@@ -184,11 +181,11 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
184 |
|
185 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
186 |
if($wc_ast_status_delivered == 1)
|
187 |
-
add_action( 'woocommerce_order_status_delivered', array( $this, 'email_trigger_delivered' ), 10, 2 );
|
188 |
|
189 |
$wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
|
190 |
if($wc_ast_status_partial_shipped == 1)
|
191 |
-
add_action( 'woocommerce_order_status_partial-shipped', array( $this, 'email_trigger_partial_shipped' ), 10, 2 );
|
192 |
|
193 |
$wc_ast_status_updated_tracking = get_option('wc_ast_status_updated_tracking');
|
194 |
if($wc_ast_status_updated_tracking == 1)
|
@@ -214,7 +211,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
214 |
public function email_trigger_partial_shipped($order_id, $order = false){
|
215 |
require_once( 'includes/email-manager.php' );
|
216 |
WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
|
217 |
-
}
|
218 |
|
219 |
/**
|
220 |
* Send email when order status change to "Updated Tracking"
|
@@ -409,7 +406,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
409 |
|
410 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
|
411 |
|
412 |
-
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-partial-shipped-email-customizer.php';
|
413 |
|
414 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-updated-tracking-email-customizer.php';
|
415 |
|
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: 2.9.9.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 |
* Domain Path: /lang/
|
14 |
+
* WC tested up to: 4.1.0
|
15 |
*/
|
16 |
|
17 |
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
+
public $version = '2.9.9.6';
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
152 |
} else{
|
153 |
add_action( 'woocommerce_email_before_order_table', array( $this->actions, 'email_display' ), 0, 4 );
|
154 |
}
|
155 |
+
}
|
|
|
|
|
156 |
|
157 |
add_shortcode( 'woo_mb_tracking_info' , array( $this, 'tracking_info_shortcode'));
|
158 |
|
164 |
add_action("fix_shipment_tracking_for_deleted_tracking", array( $this->actions, 'func_fix_shipment_tracking_for_deleted_tracking' ), 10, 3 );
|
165 |
|
166 |
add_action('admin_footer', array( $this->actions, 'custom_validation_js'));
|
167 |
+
|
|
|
168 |
add_action( 'wp_ajax_add_inline_tracking_number', array( $this->actions, 'save_inline_tracking_number' ) );
|
169 |
|
170 |
//load css js
|
181 |
|
182 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
183 |
if($wc_ast_status_delivered == 1)
|
184 |
+
add_action( 'woocommerce_order_status_delivered', array( $this, 'email_trigger_delivered' ), 10, 2 );
|
185 |
|
186 |
$wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
|
187 |
if($wc_ast_status_partial_shipped == 1)
|
188 |
+
add_action( 'woocommerce_order_status_partial-shipped', array( $this, 'email_trigger_partial_shipped' ), 10, 2 );
|
189 |
|
190 |
$wc_ast_status_updated_tracking = get_option('wc_ast_status_updated_tracking');
|
191 |
if($wc_ast_status_updated_tracking == 1)
|
211 |
public function email_trigger_partial_shipped($order_id, $order = false){
|
212 |
require_once( 'includes/email-manager.php' );
|
213 |
WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
|
214 |
+
}
|
215 |
|
216 |
/**
|
217 |
* Send email when order status change to "Updated Tracking"
|
406 |
|
407 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
|
408 |
|
409 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-partial-shipped-email-customizer.php';
|
410 |
|
411 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-updated-tracking-email-customizer.php';
|
412 |
|