Version Description
- Enhancement - Updated settings page option design from multiple checkbox to multiple select2
- Dev - On first installation make 15 shipping provider active by default
- Dev - On plugin activation check if shipping provider table column, if not exist any column create new and update the provider list
- Dev - Added compatibility with WooCommerce 5.0.0
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 3.2.1.5 |
Comparing to | |
See all releases |
Code changes from version 3.2.1.4 to 3.2.1.5
- assets/css/admin.css +18 -2
- assets/css/trackship.css +3 -0
- assets/js/shipping_row.js +4 -15
- includes/class-wc-advanced-shipment-tracking-admin.php +156 -31
- includes/class-wc-advanced-shipment-tracking-install.php +94 -154
- includes/class-wc-advanced-shipment-tracking-trackship.php +5 -3
- includes/class-wc-advanced-shipment-tracking.php +24 -3
- includes/customizer/class-wc-availableforpickup-email-customizer.php +3 -3
- includes/customizer/class-wc-delivered-email-customizer.php +4 -4
- includes/customizer/class-wc-failure-email-customizer.php +3 -3
- includes/customizer/class-wc-intransit-email-customizer.php +3 -3
- includes/customizer/class-wc-onhold-email-customizer.php +3 -3
- includes/customizer/class-wc-outfordelivery-email-customizer.php +3 -3
- includes/customizer/class-wc-partial-shipped-email-customizer.php +7 -5
- includes/customizer/class-wc-returntosender-email-customizer.php +3 -5
- includes/customizer/custom-controls.php +1 -1
- includes/trackship-email-manager.php +6 -6
- includes/views/admin_options_shipping_provider.php +1 -1
- readme.txt +6 -0
- templates/emails/tracking-info.php +9 -9
- templates/emails/wcast-email-order-details.php +3 -1
- templates/myaccount/tracking-info.php +13 -10
- woocommerce-advanced-shipment-tracking.php +4 -5
assets/css/admin.css
CHANGED
@@ -1124,7 +1124,7 @@ span.multiple_checkbox {
|
|
1124 |
.settings_ul li> input[type=checkbox] {
|
1125 |
vertical-align: bottom;
|
1126 |
}
|
1127 |
-
.settings_ul
|
1128 |
padding: 15px 25px;
|
1129 |
border-bottom: 1px solid #e0e0e0;
|
1130 |
margin: 0;
|
@@ -1134,7 +1134,7 @@ span.multiple_checkbox {
|
|
1134 |
.settings_ul li:last-child {
|
1135 |
border-bottom: 0;
|
1136 |
}
|
1137 |
-
.settings_ul .settings_radio_li>label {
|
1138 |
width: 40%;
|
1139 |
display: inline-block;
|
1140 |
}
|
@@ -2078,6 +2078,22 @@ ul.csv_error_details_ul li:before{
|
|
2078 |
overflow: hidden;
|
2079 |
text-overflow: ellipsis;
|
2080 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2081 |
|
2082 |
/*** RTL CSS ***/
|
2083 |
.rtl .zorem-layout__header .zorem-layout__header-breadcrumbs{
|
1124 |
.settings_ul li> input[type=checkbox] {
|
1125 |
vertical-align: bottom;
|
1126 |
}
|
1127 |
+
.settings_ul>li{
|
1128 |
padding: 15px 25px;
|
1129 |
border-bottom: 1px solid #e0e0e0;
|
1130 |
margin: 0;
|
1134 |
.settings_ul li:last-child {
|
1135 |
border-bottom: 0;
|
1136 |
}
|
1137 |
+
.settings_ul .settings_radio_li>label,.settings_ul .multiple_select_li>label {
|
1138 |
width: 40%;
|
1139 |
display: inline-block;
|
1140 |
}
|
2078 |
overflow: hidden;
|
2079 |
text-overflow: ellipsis;
|
2080 |
}
|
2081 |
+
.multiple_select_container {
|
2082 |
+
display: inline-block;
|
2083 |
+
}
|
2084 |
+
.multiple_select_container .select2-container{
|
2085 |
+
width: 500px !important;
|
2086 |
+
}
|
2087 |
+
.multiple_select_container .select2-container .select2-selection--multiple .select2-selection__choice{
|
2088 |
+
line-height: 21px;
|
2089 |
+
height: 23px;
|
2090 |
+
}
|
2091 |
+
.multiple_select_container .select2-container .select2-search__field{
|
2092 |
+
min-width: 50px;
|
2093 |
+
}
|
2094 |
+
.wc-wp-version-gte-53 .multiple_select_container .select2-container .select2-selection--multiple{
|
2095 |
+
border-color: #e0e0e0;
|
2096 |
+
}
|
2097 |
|
2098 |
/*** RTL CSS ***/
|
2099 |
.rtl .zorem-layout__header .zorem-layout__header-breadcrumbs{
|
assets/css/trackship.css
CHANGED
@@ -260,6 +260,9 @@ ul.wcast-shipment-status-list {
|
|
260 |
.ast-shipment-status .icon-invalid_user_key:before{
|
261 |
background-image: url(icons/invalid-user-key-v4.png);
|
262 |
}
|
|
|
|
|
|
|
263 |
.woocommerce.zorem_admin_layout table.form-table.shipment-status-email-table td {
|
264 |
padding: 15px;
|
265 |
}
|
260 |
.ast-shipment-status .icon-invalid_user_key:before{
|
261 |
background-image: url(icons/invalid-user-key-v4.png);
|
262 |
}
|
263 |
+
.woocommerce.zorem_admin_layout table.form-table.trackship_status_table tr td strong{
|
264 |
+
vertical-align:middle;
|
265 |
+
}
|
266 |
.woocommerce.zorem_admin_layout table.form-table.shipment-status-email-table td {
|
267 |
padding: 15px;
|
268 |
}
|
assets/js/shipping_row.js
CHANGED
@@ -648,15 +648,6 @@ jQuery(document).on("click", ".remove", function(){
|
|
648 |
});
|
649 |
});
|
650 |
|
651 |
-
jQuery(document).on( "click", ".add_more_api_provider", function(){
|
652 |
-
jQuery(this).closest('.api_provider_name_container').append('<div class="api_provider_new"><input type="text" name="api_provider_name[]" class="api_provider_name" value="" placeholder="API Name"><span class="dashicons dashicons-remove remove_more_api_provider"></span></div>');
|
653 |
-
});
|
654 |
-
|
655 |
-
jQuery(document).on("click",".remove_more_api_provider", function(e){ //user click on remove text links
|
656 |
-
e.preventDefault();
|
657 |
-
jQuery(this).parent('.api_provider_new').remove();
|
658 |
-
});
|
659 |
-
|
660 |
jQuery(document).on("click", ".edit_provider", function(){
|
661 |
var id = jQuery(this).data('pid');
|
662 |
var provider = jQuery(this).data('provider');
|
@@ -704,9 +695,7 @@ jQuery(document).on("click", ".edit_provider", function(){
|
|
704 |
jQuery('.edit_provider_popup .shipping_display_name').val(custom_provider_name);
|
705 |
jQuery('.api_provider_new').remove();
|
706 |
|
707 |
-
if(response.api_provider_name == null){
|
708 |
-
//jQuery('.edit_provider_popup .api_provider_name').val(response.api_provider_name);
|
709 |
-
//jQuery('.api_provider_name_container').hide();
|
710 |
} else if( IsValidJSONString(response.api_provider_name) ){
|
711 |
var api_provider_name = jQuery.parseJSON( response.api_provider_name );
|
712 |
var api_length = api_provider_name.length;
|
@@ -716,7 +705,7 @@ jQuery(document).on("click", ".edit_provider", function(){
|
|
716 |
if( index == 0){
|
717 |
jQuery('.edit_provider_popup .api_provider_name').val(value);
|
718 |
} else{
|
719 |
-
jQuery('.api_provider_name_container').append('<div class="api_provider_new"><input type="text" name="api_provider_name[]" class="api_provider_name" value="'+value+'" placeholder="API Name"
|
720 |
}
|
721 |
});
|
722 |
} else{
|
@@ -834,7 +823,7 @@ jQuery(document).on("submit", "#edit_provider_form", function(){
|
|
834 |
}
|
835 |
}
|
836 |
|
837 |
-
|
838 |
for(var i=0; i<api_provider_name.length; i++) {
|
839 |
if(validate(api_provider_name[i]) == false){
|
840 |
showerror(jQuery(api_provider_name[i]));
|
@@ -843,7 +832,7 @@ jQuery(document).on("submit", "#edit_provider_form", function(){
|
|
843 |
hideerror(jQuery(api_provider_name[i]));
|
844 |
}
|
845 |
}
|
846 |
-
}
|
847 |
|
848 |
if(error == true){
|
849 |
return false;
|
648 |
});
|
649 |
});
|
650 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
651 |
jQuery(document).on("click", ".edit_provider", function(){
|
652 |
var id = jQuery(this).data('pid');
|
653 |
var provider = jQuery(this).data('provider');
|
695 |
jQuery('.edit_provider_popup .shipping_display_name').val(custom_provider_name);
|
696 |
jQuery('.api_provider_new').remove();
|
697 |
|
698 |
+
if(response.api_provider_name == null){
|
|
|
|
|
699 |
} else if( IsValidJSONString(response.api_provider_name) ){
|
700 |
var api_provider_name = jQuery.parseJSON( response.api_provider_name );
|
701 |
var api_length = api_provider_name.length;
|
705 |
if( index == 0){
|
706 |
jQuery('.edit_provider_popup .api_provider_name').val(value);
|
707 |
} else{
|
708 |
+
jQuery('.api_provider_name_container').append('<div class="api_provider_new"><input type="text" name="api_provider_name[]" class="api_provider_name" value="'+value+'" placeholder="API Name"></div>');
|
709 |
}
|
710 |
});
|
711 |
} else{
|
823 |
}
|
824 |
}
|
825 |
|
826 |
+
if(provider_type.val() == 'default_provider'){
|
827 |
for(var i=0; i<api_provider_name.length; i++) {
|
828 |
if(validate(api_provider_name[i]) == false){
|
829 |
showerror(jQuery(api_provider_name[i]));
|
832 |
hideerror(jQuery(api_provider_name[i]));
|
833 |
}
|
834 |
}
|
835 |
+
}
|
836 |
|
837 |
if(error == true){
|
838 |
return false;
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -450,8 +450,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
450 |
<input class="ast-tgl ast-tgl-flat" id="<?php echo $id?>" name="<?php echo $id?>" type="checkbox" <?php echo $checked ?> value="1"/>
|
451 |
<label class="ast-tgl-btn" for="<?php echo $id?>"></label>
|
452 |
<?php }
|
453 |
-
elseif( isset( $array['type'] ) && $array['type'] == 'multiple_checkbox' ){
|
454 |
-
<?php
|
455 |
foreach((array)$array['options'] as $key => $val ){
|
456 |
$multi_checkbox_data = get_option($id);
|
457 |
if(isset($multi_checkbox_data[$key]) && $multi_checkbox_data[$key] == 1){
|
@@ -625,7 +624,29 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
625 |
</span>
|
626 |
<?php } ?>
|
627 |
</li>
|
628 |
-
<?php } else if($array['type'] == '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
<li>
|
630 |
<div class="multiple_checkbox_label">
|
631 |
<label for=""><strong><?php echo $array['title']?></strong></label>
|
@@ -826,18 +847,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
826 |
|
827 |
$order_status_array = array_merge($order_status,$custom_order_status);
|
828 |
|
829 |
-
$action_order_status_array = array_merge($actions_order_status,$custom_order_status);
|
830 |
-
|
831 |
-
//$ast_add_tracking_options = array();
|
832 |
-
//$ast_add_tracking_options = apply_filters( 'ast_add_tracking_options', $ast_add_tracking_options );
|
833 |
|
834 |
-
$form_data = array(
|
835 |
-
/*'wc_ast_status_shipped' => array(
|
836 |
-
'type' => 'checkbox',
|
837 |
-
'title' => __( 'Rename the “Completed” Order status label to “Shipped”', 'woo-advanced-shipment-tracking' ),
|
838 |
-
'show' => true,
|
839 |
-
'class' => '',
|
840 |
-
), */
|
841 |
'wc_ast_default_mark_shipped' => array(
|
842 |
'type' => 'checkbox',
|
843 |
'title' => __( 'Set the "mark as shipped" option checked when adding tracking info to orders', 'woo-advanced-shipment-tracking' ),
|
@@ -845,17 +857,17 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
845 |
'class' => '',
|
846 |
),
|
847 |
'wc_ast_unclude_tracking_info' => array(
|
848 |
-
'type' => '
|
849 |
-
'title' => __( 'Order
|
850 |
-
'
|
851 |
'options' => $order_status_array,
|
852 |
'show' => true,
|
853 |
'class' => '',
|
854 |
),
|
855 |
'wc_ast_show_orders_actions' => array(
|
856 |
-
'type' => '
|
857 |
-
'title' => __( 'Add Tracking action
|
858 |
-
'
|
859 |
'options' => $action_order_status_array,
|
860 |
'show' => true,
|
861 |
'class' => '',
|
@@ -985,9 +997,22 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
985 |
$data = $this->get_settings_data();
|
986 |
|
987 |
foreach( $data as $key => $val ){
|
988 |
-
|
989 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
990 |
}
|
|
|
991 |
if(isset($val['type']) && $val['type']=='inline_checkbox' ){
|
992 |
foreach((array)$val['checkbox_array'] as $key1 => $val1){
|
993 |
if(isset($_POST[ $key1 ])){
|
@@ -1213,9 +1238,19 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1213 |
'qty' => $qty,
|
1214 |
);
|
1215 |
|
|
|
|
|
1216 |
$product_data_array = array();
|
1217 |
$product_data_array[$product_id] = $qty;
|
1218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1219 |
if ( count( $tracking_items ) > 0 ) {
|
1220 |
foreach ( $tracking_items as $key => $item ) {
|
1221 |
if($item['tracking_number'] == $_POST['tracking_number']){
|
@@ -1245,8 +1280,6 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1245 |
|
1246 |
$order = new WC_Order( $order_id );
|
1247 |
|
1248 |
-
$status_shipped = (isset($_POST["status_shipped"])?$_POST["status_shipped"]:"");
|
1249 |
-
|
1250 |
if( $status_shipped == 1){
|
1251 |
if('completed' == $order->get_status()){
|
1252 |
do_action("send_order_to_trackship", $order_id);
|
@@ -1292,7 +1325,6 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1292 |
}
|
1293 |
}
|
1294 |
|
1295 |
-
array_push($products_list,$product_data);
|
1296 |
$product_args = array(
|
1297 |
'products_list' => $products_list,
|
1298 |
);
|
@@ -1308,6 +1340,95 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1308 |
}
|
1309 |
}
|
1310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1311 |
/**
|
1312 |
* Check if the value is a valid date
|
1313 |
*
|
@@ -1544,9 +1665,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1544 |
|
1545 |
<?php if( $d_s_p->shipping_default == 0 ){ ?>
|
1546 |
<span class="dashicons dashicons-trash remove provider_actions_btn" data-pid="<?php echo $d_s_p->id; ?>"></span>
|
1547 |
-
<?php }
|
|
|
|
|
1548 |
|
1549 |
-
<span class="
|
1550 |
|
1551 |
<?php $default_provider = get_option("wc_ast_default_provider" );?>
|
1552 |
|
@@ -1841,9 +1964,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1841 |
public function filter_orders_by_shipping_provider_query( $vars ){
|
1842 |
global $typenow;
|
1843 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && $_GET['_shop_order_shipping_provider'] != '') {
|
1844 |
-
$vars['
|
1845 |
-
|
1846 |
-
|
|
|
|
|
1847 |
}
|
1848 |
|
1849 |
return $vars;
|
450 |
<input class="ast-tgl ast-tgl-flat" id="<?php echo $id?>" name="<?php echo $id?>" type="checkbox" <?php echo $checked ?> value="1"/>
|
451 |
<label class="ast-tgl-btn" for="<?php echo $id?>"></label>
|
452 |
<?php }
|
453 |
+
elseif( isset( $array['type'] ) && $array['type'] == 'multiple_checkbox' ){
|
|
|
454 |
foreach((array)$array['options'] as $key => $val ){
|
455 |
$multi_checkbox_data = get_option($id);
|
456 |
if(isset($multi_checkbox_data[$key]) && $multi_checkbox_data[$key] == 1){
|
624 |
</span>
|
625 |
<?php } ?>
|
626 |
</li>
|
627 |
+
<?php } else if($array['type'] == 'multiple_select'){ ?>
|
628 |
+
<li class="multiple_select_li">
|
629 |
+
<label><?php echo $array['title']?>
|
630 |
+
<?php if( isset($array['tooltip']) ){?>
|
631 |
+
<span class="woocommerce-help-tip tipTip" title="<?php echo $array['tooltip']?>"></span>
|
632 |
+
<?php } ?>
|
633 |
+
</label>
|
634 |
+
<div class="multiple_select_container">
|
635 |
+
<select multiple class="wc-enhanced-select" name="<?php echo $id?>[]" id="<?php echo $id?>">
|
636 |
+
<?php
|
637 |
+
foreach((array)$array['options'] as $key => $val ){
|
638 |
+
$multi_checkbox_data = get_option($id);
|
639 |
+
if(isset($multi_checkbox_data[$key]) && $multi_checkbox_data[$key] == 1){
|
640 |
+
$checked="selected";
|
641 |
+
} else{
|
642 |
+
$checked="";
|
643 |
+
} ?>
|
644 |
+
<option value="<?php echo esc_attr( $key ); ?>" <?php echo $checked; ?>><?php echo $val['status']; ?></option>
|
645 |
+
<?php } ?>
|
646 |
+
</select>
|
647 |
+
</div>
|
648 |
+
</li>
|
649 |
+
<?php } else if($array['type'] == 'multiple_checkbox'){ ?>
|
650 |
<li>
|
651 |
<div class="multiple_checkbox_label">
|
652 |
<label for=""><strong><?php echo $array['title']?></strong></label>
|
847 |
|
848 |
$order_status_array = array_merge($order_status,$custom_order_status);
|
849 |
|
850 |
+
$action_order_status_array = array_merge($actions_order_status,$custom_order_status);
|
|
|
|
|
|
|
851 |
|
852 |
+
$form_data = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
853 |
'wc_ast_default_mark_shipped' => array(
|
854 |
'type' => 'checkbox',
|
855 |
'title' => __( 'Set the "mark as shipped" option checked when adding tracking info to orders', 'woo-advanced-shipment-tracking' ),
|
857 |
'class' => '',
|
858 |
),
|
859 |
'wc_ast_unclude_tracking_info' => array(
|
860 |
+
'type' => 'multiple_select',
|
861 |
+
'title' => __( 'Order Emails Display', 'woo-advanced-shipment-tracking' ),
|
862 |
+
'tooltip' => __( 'Choose on which order emails to include the shipment tracking info', 'woo-advanced-shipment-tracking' ),
|
863 |
'options' => $order_status_array,
|
864 |
'show' => true,
|
865 |
'class' => '',
|
866 |
),
|
867 |
'wc_ast_show_orders_actions' => array(
|
868 |
+
'type' => 'multiple_select',
|
869 |
+
'title' => __( 'Add Tracking Order action', 'woo-advanced-shipment-tracking' ),
|
870 |
+
'tooltip' => __( 'Choose for which Order status to display Add Tracking action button', 'woo-advanced-shipment-tracking' ),
|
871 |
'options' => $action_order_status_array,
|
872 |
'show' => true,
|
873 |
'class' => '',
|
997 |
$data = $this->get_settings_data();
|
998 |
|
999 |
foreach( $data as $key => $val ){
|
1000 |
+
|
1001 |
+
if(isset($val['type']) && $val['type']=='multiple_select' ){
|
1002 |
+
|
1003 |
+
foreach( $val['options'] as $op_status => $op_data){
|
1004 |
+
$_POST[ $key ][$op_status] = 0;
|
1005 |
+
}
|
1006 |
+
foreach( $_POST[ $key ] as $key1 => $status){
|
1007 |
+
$_POST[ $key ][$status] = 1;
|
1008 |
+
}
|
1009 |
+
update_option( $key, wc_clean($_POST[ $key ]) );
|
1010 |
+
} else{
|
1011 |
+
if(isset($_POST[ $key ])){
|
1012 |
+
update_option( $key, wc_clean($_POST[ $key ]) );
|
1013 |
+
}
|
1014 |
}
|
1015 |
+
|
1016 |
if(isset($val['type']) && $val['type']=='inline_checkbox' ){
|
1017 |
foreach((array)$val['checkbox_array'] as $key1 => $val1){
|
1018 |
if(isset($_POST[ $key1 ])){
|
1238 |
'qty' => $qty,
|
1239 |
);
|
1240 |
|
1241 |
+
array_push($products_list,$product_data);
|
1242 |
+
|
1243 |
$product_data_array = array();
|
1244 |
$product_data_array[$product_id] = $qty;
|
1245 |
+
|
1246 |
+
$status_shipped = (isset($_POST["status_shipped"])?$_POST["status_shipped"]:"");
|
1247 |
+
|
1248 |
+
$autocomplete_order_tpi = get_option('autocomplete_order_tpi',0);
|
1249 |
+
if($autocomplete_order_tpi == 1){
|
1250 |
+
$status_shipped = $this->autocomplete_order_after_adding_all_products( $order_id, $status_shipped, $products_list );
|
1251 |
+
$args['status_shipped'] = $status_shipped;
|
1252 |
+
}
|
1253 |
+
|
1254 |
if ( count( $tracking_items ) > 0 ) {
|
1255 |
foreach ( $tracking_items as $key => $item ) {
|
1256 |
if($item['tracking_number'] == $_POST['tracking_number']){
|
1280 |
|
1281 |
$order = new WC_Order( $order_id );
|
1282 |
|
|
|
|
|
1283 |
if( $status_shipped == 1){
|
1284 |
if('completed' == $order->get_status()){
|
1285 |
do_action("send_order_to_trackship", $order_id);
|
1325 |
}
|
1326 |
}
|
1327 |
|
|
|
1328 |
$product_args = array(
|
1329 |
'products_list' => $products_list,
|
1330 |
);
|
1340 |
}
|
1341 |
}
|
1342 |
|
1343 |
+
public function autocomplete_order_after_adding_all_products( $order_id, $status_shipped, $products_list ){
|
1344 |
+
|
1345 |
+
$order = wc_get_order( $order_id );
|
1346 |
+
$items = $order->get_items();
|
1347 |
+
$items_count = count($items);
|
1348 |
+
|
1349 |
+
$added_products = $this->get_all_added_product_list_with_qty( $order_id );
|
1350 |
+
|
1351 |
+
|
1352 |
+
$new_products = array();
|
1353 |
+
//echo '<pre>';print_r($products_list);echo '</pre>';exit;
|
1354 |
+
foreach($products_list as $in_list){
|
1355 |
+
|
1356 |
+
if(isset($new_products[$in_list->product])){
|
1357 |
+
$new_products[$in_list->product] = (int)$new_products[$in_list->product] + (int)$in_list->qty;
|
1358 |
+
} else{
|
1359 |
+
$new_products[$in_list->product] = $in_list->qty;
|
1360 |
+
}
|
1361 |
+
}
|
1362 |
+
|
1363 |
+
$total_products_data = array();
|
1364 |
+
|
1365 |
+
foreach (array_keys($new_products + $added_products) as $products) {
|
1366 |
+
$total_products_data[$products] = (isset($new_products[$products]) ? $new_products[$products] : 0) + (isset($added_products[$products]) ? $added_products[$products] : 0);
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
$orders_products_data = array();
|
1370 |
+
foreach($items as $item){
|
1371 |
+
$checked = 0;
|
1372 |
+
$qty = $item->get_quantity();
|
1373 |
+
|
1374 |
+
if( $items_count == 1 && $qty == 1 )return $status_shipped;
|
1375 |
+
|
1376 |
+
$variation_id = $item->get_variation_id();
|
1377 |
+
$product_id = $item->get_product_id();
|
1378 |
+
if($variation_id != 0){
|
1379 |
+
$product_id = $variation_id;
|
1380 |
+
}
|
1381 |
+
$orders_products_data[$product_id] = $qty;
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
$change_status = 0;
|
1385 |
+
$autocomplete_order = true;
|
1386 |
+
|
1387 |
+
foreach($orders_products_data as $product_id => $qty){
|
1388 |
+
if(isset($total_products_data[$product_id])){
|
1389 |
+
if( $qty > $total_products_data[$product_id] ){
|
1390 |
+
$autocomplete_order = false;
|
1391 |
+
$change_status = 1;
|
1392 |
+
} else{
|
1393 |
+
$change_status = 1;
|
1394 |
+
}
|
1395 |
+
} else{
|
1396 |
+
$autocomplete_order = false;
|
1397 |
+
}
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
if( $autocomplete_order && $change_status == 1 ){
|
1401 |
+
$status_shipped = 1;
|
1402 |
+
}
|
1403 |
+
return $status_shipped;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
public function get_all_added_product_list_with_qty( $order_id ){
|
1407 |
+
|
1408 |
+
$ast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
1409 |
+
$tracking_items = $ast->get_tracking_items( $order_id, true );
|
1410 |
+
|
1411 |
+
$product_list = array();
|
1412 |
+
|
1413 |
+
foreach($tracking_items as $tracking_item){
|
1414 |
+
if(isset($tracking_item['products_list'])){
|
1415 |
+
$product_list[] = $tracking_item['products_list'];
|
1416 |
+
}
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
$all_list = array();
|
1420 |
+
foreach($product_list as $list){
|
1421 |
+
foreach($list as $in_list){
|
1422 |
+
if(isset($all_list[$in_list->product])){
|
1423 |
+
$all_list[$in_list->product] = (int)$all_list[$in_list->product] + (int)$in_list->qty;
|
1424 |
+
} else{
|
1425 |
+
$all_list[$in_list->product] = $in_list->qty;
|
1426 |
+
}
|
1427 |
+
}
|
1428 |
+
}
|
1429 |
+
return $all_list;
|
1430 |
+
}
|
1431 |
+
|
1432 |
/**
|
1433 |
* Check if the value is a valid date
|
1434 |
*
|
1665 |
|
1666 |
<?php if( $d_s_p->shipping_default == 0 ){ ?>
|
1667 |
<span class="dashicons dashicons-trash remove provider_actions_btn" data-pid="<?php echo $d_s_p->id; ?>"></span>
|
1668 |
+
<?php }
|
1669 |
+
$edit_provider_class = apply_filters( 'edit_provider_class', 'edit_provider' );
|
1670 |
+
?>
|
1671 |
|
1672 |
+
<span class="<?php echo $edit_provider_class;?> provider_actions_btn" data-provider="<?php echo ($d_s_p->shipping_default == 1) ? 'default_provider' : 'custom_provider';?>" data-pid="<?php echo $d_s_p->id; ?>"><?php _e( 'edit', 'woo-advanced-shipment-tracking' ); ?></span>
|
1673 |
|
1674 |
<?php $default_provider = get_option("wc_ast_default_provider" );?>
|
1675 |
|
1964 |
public function filter_orders_by_shipping_provider_query( $vars ){
|
1965 |
global $typenow;
|
1966 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && $_GET['_shop_order_shipping_provider'] != '') {
|
1967 |
+
$vars['meta_query'][] = array(
|
1968 |
+
'key' => '_wc_shipment_tracking_items',
|
1969 |
+
'value' => $_GET['_shop_order_shipping_provider'],
|
1970 |
+
'compare' => 'LIKE'
|
1971 |
+
);
|
1972 |
}
|
1973 |
|
1974 |
return $vars;
|
includes/class-wc-advanced-shipment-tracking-install.php
CHANGED
@@ -74,9 +74,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
74 |
set_transient( '_ast_activation_redirect', 1, 30 );
|
75 |
|
76 |
$this->create_shippment_tracking_table();
|
77 |
-
$this->update_shipping_providers();
|
78 |
-
|
79 |
-
update_option( 'wc_advanced_shipment_tracking', '3.19');
|
80 |
|
81 |
$wc_ast_default_mark_shipped = get_option('wc_ast_default_mark_shipped');
|
82 |
if($wc_ast_default_mark_shipped == ''){
|
@@ -94,8 +92,12 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
94 |
$data_array = array('processing' => 1,'completed' => 1,'partial-shipped' => 1,'updated-tracking' => 1);
|
95 |
update_option( 'wc_ast_show_orders_actions', $data_array );
|
96 |
}
|
|
|
97 |
}
|
98 |
-
|
|
|
|
|
|
|
99 |
public function create_shippment_tracking_table(){
|
100 |
|
101 |
global $wpdb;
|
@@ -119,165 +121,88 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
119 |
) $charset_collate;";
|
120 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
121 |
dbDelta( $sql );
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
/*
|
126 |
* database update
|
127 |
*/
|
128 |
public function update_database_check(){
|
129 |
-
if ( is_admin() ){
|
130 |
-
|
131 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'1.2', '<') ){
|
132 |
-
global $wpdb;
|
133 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
134 |
-
if(!isset($results->sort_order)) {
|
135 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD sort_order int(11) NOT NULL DEFAULT '0'" );
|
136 |
-
}
|
137 |
-
update_option( 'wc_advanced_shipment_tracking', '1.2');
|
138 |
-
}
|
139 |
-
|
140 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'1.3', '<') ){
|
141 |
-
global $wpdb;
|
142 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
143 |
-
if(!isset($results->custom_thumb_id)) {
|
144 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD custom_thumb_id int(11) NOT NULL DEFAULT '0'" );
|
145 |
-
}
|
146 |
-
update_option( 'wc_advanced_shipment_tracking', '1.3');
|
147 |
-
}
|
148 |
-
|
149 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.3', '<') ){
|
150 |
-
global $wpdb;
|
151 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
152 |
-
if(!isset($results->ts_slug)) {
|
153 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD ts_slug text NULL DEFAULT NULL AFTER provider_name" );
|
154 |
-
}
|
155 |
-
$this->update_shipping_providers();
|
156 |
-
update_option( 'wc_advanced_shipment_tracking', '3.3');
|
157 |
-
}
|
158 |
-
|
159 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.4', '<') ){
|
160 |
-
$multi_checkbox_data = get_option('wc_ast_unclude_tracking_info');
|
161 |
-
$data_array = array('completed' => 1);
|
162 |
-
if($multi_checkbox_data){
|
163 |
-
$data_array = array_merge($multi_checkbox_data,$data_array);
|
164 |
-
}
|
165 |
-
update_option( 'wc_ast_unclude_tracking_info', $data_array );
|
166 |
-
update_option( 'wc_advanced_shipment_tracking', '3.4');
|
167 |
-
}
|
168 |
-
|
169 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.5', '<') ){
|
170 |
-
$multi_checkbox_data = get_option('wc_ast_unclude_tracking_info');
|
171 |
-
$data_array = array('partial-shipped' => 1);
|
172 |
-
if($multi_checkbox_data){
|
173 |
-
$data_array = array_merge($multi_checkbox_data,$data_array);
|
174 |
-
}
|
175 |
-
update_option( 'wc_ast_unclude_tracking_info', $data_array );
|
176 |
-
update_option( 'wc_advanced_shipment_tracking', '3.5');
|
177 |
-
}
|
178 |
-
|
179 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.6', '<') ){
|
180 |
-
set_theme_mod('display_shipment_provider_name', 1);
|
181 |
-
set_theme_mod('select_tracking_template', 'default_table');
|
182 |
-
set_theme_mod('simple_provider_font_size', '14');
|
183 |
-
set_theme_mod('simple_provider_font_color', '#575f6d');
|
184 |
-
set_theme_mod('show_provider_border', 1);
|
185 |
-
set_theme_mod('provider_border_color', '#e0e0e0');
|
186 |
-
update_option( 'wc_advanced_shipment_tracking', '3.6');
|
187 |
-
}
|
188 |
-
|
189 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.10', '<') ){
|
190 |
-
global $wpdb;
|
191 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
192 |
-
if(!isset($results->trackship_supported)) {
|
193 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD trackship_supported int(11) NOT NULL DEFAULT '0'" );
|
194 |
-
}
|
195 |
-
|
196 |
-
$url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
|
197 |
-
$resp = wp_remote_get( $url );
|
198 |
-
if ( is_array( $resp ) && ! is_wp_error( $resp ) ) {
|
199 |
-
$providers = json_decode($resp['body'],true);
|
200 |
-
}
|
201 |
-
foreach($providers as $provider){
|
202 |
-
$data_array = array(
|
203 |
-
'trackship_supported' => $provider['trackship_supported'],
|
204 |
-
);
|
205 |
-
$where_array = array(
|
206 |
-
'provider_name' => $provider['shipping_provider'],
|
207 |
-
);
|
208 |
-
$wpdb->update( $this->table, $data_array, $where_array);
|
209 |
-
}
|
210 |
-
update_option( 'wc_advanced_shipment_tracking', '3.10');
|
211 |
-
}
|
212 |
-
|
213 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.13', '<') ){
|
214 |
-
$wc_ast_unclude_tracking_info = get_option('wc_ast_unclude_tracking_info');
|
215 |
-
$wc_ast_unclude_tracking_info['show_in_customer_note'] = 0;
|
216 |
-
update_option('wc_ast_unclude_tracking_info',$wc_ast_unclude_tracking_info);
|
217 |
-
update_option( 'wc_advanced_shipment_tracking', '3.13');
|
218 |
-
}
|
219 |
|
220 |
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.14', '<') ){
|
221 |
$this->add_provider_image_in_upload_directory();
|
222 |
update_option( 'wc_advanced_shipment_tracking', '3.14');
|
223 |
}
|
224 |
|
225 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.15', '<') ){
|
226 |
-
global $wpdb;
|
227 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
228 |
-
if(!isset($results->custom_provider_name)) {
|
229 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD custom_provider_name text NULL DEFAULT NULL AFTER provider_name" );
|
230 |
-
}
|
231 |
-
update_option( 'wc_advanced_shipment_tracking', '3.15');
|
232 |
-
}
|
233 |
-
|
234 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.16', '<') ){
|
235 |
-
global $wpdb;
|
236 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
237 |
-
if(!isset($results->api_provider_name)) {
|
238 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD api_provider_name text NULL DEFAULT NULL AFTER provider_name" );
|
239 |
-
}
|
240 |
-
update_option( 'wc_advanced_shipment_tracking', '3.16');
|
241 |
-
}
|
242 |
-
|
243 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.17', '<') ){
|
244 |
-
$data_array = array('processing' => 1,'completed' => 1,'partial-shipped' => 1);
|
245 |
-
update_option( 'wc_ast_show_orders_actions', $data_array );
|
246 |
-
update_option( 'wc_advanced_shipment_tracking', '3.17');
|
247 |
-
}
|
248 |
-
|
249 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.18', '<') ){
|
250 |
-
update_option( 'display_track_in_my_account', 1);
|
251 |
-
update_option( 'open_track_in_new_tab', 1);
|
252 |
-
|
253 |
-
$ast = new WC_Advanced_Shipment_Tracking_Actions;
|
254 |
-
$table_content_font_weight = $ast->get_option_value_from_array('tracking_info_settings','table_content_font_weight',$wcast_customizer_settings->defaults['table_content_font_weight']);
|
255 |
-
|
256 |
-
$tracking_info_settings = get_option('tracking_info_settings');
|
257 |
-
$tracking_info_settings['table_content_font_weight'] = 400;
|
258 |
-
|
259 |
-
if($table_content_font_weight < 400){
|
260 |
-
update_option('tracking_info_settings',$tracking_info_settings);
|
261 |
-
}
|
262 |
-
|
263 |
-
update_option( 'wc_advanced_shipment_tracking', '3.18');
|
264 |
-
}
|
265 |
-
|
266 |
-
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.19', '<') ){
|
267 |
-
|
268 |
-
global $wpdb;
|
269 |
-
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
270 |
-
|
271 |
-
if(!isset($results->custom_provider_name)) {
|
272 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD custom_provider_name text NULL DEFAULT NULL AFTER provider_name" );
|
273 |
-
}
|
274 |
-
|
275 |
-
if(!isset($results->api_provider_name)) {
|
276 |
-
$res = $wpdb->query( "ALTER TABLE $this->table ADD api_provider_name text NULL DEFAULT NULL AFTER provider_name" );
|
277 |
-
}
|
278 |
-
update_option( 'wc_advanced_shipment_tracking', '3.19');
|
279 |
-
}
|
280 |
-
|
281 |
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.20', '<') ){
|
282 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 1 ), '' );
|
283 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 2 ), '' );
|
@@ -291,9 +216,17 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
291 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 10 ), '' );
|
292 |
update_option( 'wc_advanced_shipment_tracking', '3.20');
|
293 |
}
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
}
|
296 |
|
|
|
|
|
|
|
297 |
public function update_ts_shipment_status_order_mete( $page ){
|
298 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
299 |
if( !$wc_ast_api_key )return;
|
@@ -316,6 +249,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
316 |
}
|
317 |
}
|
318 |
}
|
|
|
319 |
/**
|
320 |
* function for add provider image in uploads directory under wp-content/uploads/ast-shipping-providers
|
321 |
*/
|
@@ -379,6 +313,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
379 |
$providers_name[ $val['provider_name'] ] = $val;
|
380 |
}
|
381 |
|
|
|
382 |
foreach($providers as $provider){
|
383 |
|
384 |
$provider_name = $provider['shipping_provider'];
|
@@ -420,19 +355,24 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
420 |
curl_close($ch);
|
421 |
|
422 |
file_put_contents($img, $data);
|
423 |
-
|
|
|
|
|
|
|
424 |
$data_array = array(
|
425 |
'shipping_country' => sanitize_text_field($shipping_country),
|
426 |
'provider_name' => sanitize_text_field($provider_name),
|
427 |
'ts_slug' => $ts_slug,
|
428 |
'provider_url' => sanitize_text_field($provider_url),
|
429 |
-
'display_in_order' =>
|
430 |
'shipping_default' => 1,
|
431 |
'trackship_supported' => $provider['trackship_supported'],
|
432 |
);
|
433 |
-
$result = $wpdb->insert( $this->table, $data_array );
|
|
|
434 |
}
|
435 |
-
}
|
|
|
436 |
foreach($default_shippment_providers as $db_provider){
|
437 |
|
438 |
if(!isset($providers_name[$db_provider->provider_name])){
|
74 |
set_transient( '_ast_activation_redirect', 1, 30 );
|
75 |
|
76 |
$this->create_shippment_tracking_table();
|
77 |
+
$this->update_shipping_providers();
|
|
|
|
|
78 |
|
79 |
$wc_ast_default_mark_shipped = get_option('wc_ast_default_mark_shipped');
|
80 |
if($wc_ast_default_mark_shipped == ''){
|
92 |
$data_array = array('processing' => 1,'completed' => 1,'partial-shipped' => 1,'updated-tracking' => 1);
|
93 |
update_option( 'wc_ast_show_orders_actions', $data_array );
|
94 |
}
|
95 |
+
update_option( 'wc_advanced_shipment_tracking', '3.21');
|
96 |
}
|
97 |
+
|
98 |
+
/*
|
99 |
+
* function for create shipping provider table
|
100 |
+
*/
|
101 |
public function create_shippment_tracking_table(){
|
102 |
|
103 |
global $wpdb;
|
121 |
) $charset_collate;";
|
122 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
123 |
dbDelta( $sql );
|
124 |
+
} else{
|
125 |
+
$this->check_all_column_exist();
|
126 |
}
|
127 |
}
|
128 |
|
129 |
+
/*
|
130 |
+
* check if all column exist in shipping provider database
|
131 |
+
*/
|
132 |
+
public function check_all_column_exist(){
|
133 |
+
|
134 |
+
global $wpdb;
|
135 |
+
$results = $wpdb->get_row( "SELECT * FROM $this->table LIMIT 1" );
|
136 |
+
$db_update_need = false;
|
137 |
+
|
138 |
+
if(!isset($results->provider_name)) {
|
139 |
+
$wpdb->query( "ALTER TABLE $this->table ADD provider_name varchar(500) DEFAULT '' NOT NULL AFTER id" );
|
140 |
+
$db_update_need = true;
|
141 |
+
}
|
142 |
+
|
143 |
+
if(!isset($results->api_provider_name)) {
|
144 |
+
$wpdb->query( "ALTER TABLE $this->table ADD api_provider_name text NULL DEFAULT NULL AFTER provider_name" );
|
145 |
+
$db_update_need = true;
|
146 |
+
}
|
147 |
+
|
148 |
+
if(!isset($results->custom_provider_name)) {
|
149 |
+
$wpdb->query( "ALTER TABLE $this->table ADD custom_provider_name text NULL DEFAULT NULL AFTER api_provider_name" );
|
150 |
+
$db_update_need = true;
|
151 |
+
}
|
152 |
+
|
153 |
+
if(!isset($results->ts_slug)) {
|
154 |
+
$wpdb->query( "ALTER TABLE $this->table ADD ts_slug text NULL DEFAULT NULL AFTER custom_provider_name" );
|
155 |
+
$db_update_need = true;
|
156 |
+
}
|
157 |
+
|
158 |
+
if(!isset($results->provider_url)) {
|
159 |
+
$wpdb->query( "ALTER TABLE $this->table ADD provider_url varchar(500) DEFAULT '' NULL AFTER ts_slug" );
|
160 |
+
$db_update_need = true;
|
161 |
+
}
|
162 |
+
|
163 |
+
if(!isset($results->shipping_country)) {
|
164 |
+
$wpdb->query( "ALTER TABLE $this->table ADD shipping_country varchar(45) DEFAULT '' NULL AFTER provider_url" );
|
165 |
+
$db_update_need = true;
|
166 |
+
}
|
167 |
+
|
168 |
+
if(!isset($results->shipping_default)) {
|
169 |
+
$wpdb->query( "ALTER TABLE $this->table ADD shipping_default tinyint(4) NULL DEFAULT '0' AFTER shipping_country" );
|
170 |
+
$db_update_need = true;
|
171 |
+
}
|
172 |
+
|
173 |
+
if(!isset($results->custom_thumb_id)) {
|
174 |
+
$wpdb->query( "ALTER TABLE $this->table ADD custom_thumb_id int(11) NOT NULL DEFAULT '0' AFTER shipping_default" );
|
175 |
+
$db_update_need = true;
|
176 |
+
}
|
177 |
+
|
178 |
+
if(!isset($results->display_in_order)) {
|
179 |
+
$wpdb->query( "ALTER TABLE $this->table ADD display_in_order tinyint(4) NOT NULL DEFAULT '1' AFTER custom_thumb_id" );
|
180 |
+
$db_update_need = true;
|
181 |
+
}
|
182 |
+
|
183 |
+
if(!isset($results->trackship_supported)) {
|
184 |
+
$wpdb->query( "ALTER TABLE $this->table ADD trackship_supported int(11) NOT NULL DEFAULT '0' AFTER display_in_order" );
|
185 |
+
$db_update_need = true;
|
186 |
+
}
|
187 |
+
|
188 |
+
if(!isset($results->sort_order)) {
|
189 |
+
$wpdb->query( "ALTER TABLE $this->table ADD sort_order int(11) NOT NULL DEFAULT '0' AFTER trackship_supported" );
|
190 |
+
$db_update_need = true;
|
191 |
+
}
|
192 |
+
if( $db_update_need )$this->update_shipping_providers();
|
193 |
+
}
|
194 |
+
|
195 |
/*
|
196 |
* database update
|
197 |
*/
|
198 |
public function update_database_check(){
|
199 |
+
if ( is_admin() ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.14', '<') ){
|
202 |
$this->add_provider_image_in_upload_directory();
|
203 |
update_option( 'wc_advanced_shipment_tracking', '3.14');
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.20', '<') ){
|
207 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 1 ), '' );
|
208 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 2 ), '' );
|
216 |
as_schedule_single_action( time(), 'update_ts_shipment_status_order_mete' , array( 'order_page' => 10 ), '' );
|
217 |
update_option( 'wc_advanced_shipment_tracking', '3.20');
|
218 |
}
|
219 |
+
|
220 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.21', '<') ){
|
221 |
+
$this->check_all_column_exist();
|
222 |
+
update_option( 'wc_advanced_shipment_tracking', '3.21');
|
223 |
+
}
|
224 |
}
|
225 |
}
|
226 |
|
227 |
+
/*
|
228 |
+
* function for update order meta from shipment_status to ts_shipment_status for filter order by shipment status
|
229 |
+
*/
|
230 |
public function update_ts_shipment_status_order_mete( $page ){
|
231 |
$wc_ast_api_key = get_option('wc_ast_api_key');
|
232 |
if( !$wc_ast_api_key )return;
|
249 |
}
|
250 |
}
|
251 |
}
|
252 |
+
|
253 |
/**
|
254 |
* function for add provider image in uploads directory under wp-content/uploads/ast-shipping-providers
|
255 |
*/
|
313 |
$providers_name[ $val['provider_name'] ] = $val;
|
314 |
}
|
315 |
|
316 |
+
$n = 0;
|
317 |
foreach($providers as $provider){
|
318 |
|
319 |
$provider_name = $provider['shipping_provider'];
|
355 |
curl_close($ch);
|
356 |
|
357 |
file_put_contents($img, $data);
|
358 |
+
|
359 |
+
$display_in_order = 1;
|
360 |
+
if($n > 14)$display_in_order = 0;
|
361 |
+
|
362 |
$data_array = array(
|
363 |
'shipping_country' => sanitize_text_field($shipping_country),
|
364 |
'provider_name' => sanitize_text_field($provider_name),
|
365 |
'ts_slug' => $ts_slug,
|
366 |
'provider_url' => sanitize_text_field($provider_url),
|
367 |
+
'display_in_order' => $display_in_order,
|
368 |
'shipping_default' => 1,
|
369 |
'trackship_supported' => $provider['trackship_supported'],
|
370 |
);
|
371 |
+
$result = $wpdb->insert( $this->table, $data_array );
|
372 |
+
$n++;
|
373 |
}
|
374 |
+
}
|
375 |
+
|
376 |
foreach($default_shippment_providers as $db_provider){
|
377 |
|
378 |
if(!isset($providers_name[$db_provider->provider_name])){
|
includes/class-wc-advanced-shipment-tracking-trackship.php
CHANGED
@@ -813,9 +813,11 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
813 |
public function filter_orders_by_shipment_status_query( $vars ){
|
814 |
global $typenow;
|
815 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] ) && $_GET['_shop_order_shipment_status'] != '') {
|
816 |
-
$vars['
|
817 |
-
|
818 |
-
|
|
|
|
|
819 |
}
|
820 |
|
821 |
return $vars;
|
813 |
public function filter_orders_by_shipment_status_query( $vars ){
|
814 |
global $typenow;
|
815 |
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] ) && $_GET['_shop_order_shipment_status'] != '') {
|
816 |
+
$vars['meta_query'][] = array(
|
817 |
+
'key' => 'ts_shipment_status',
|
818 |
+
'value' => $_GET['_shop_order_shipment_status'],
|
819 |
+
'compare' => 'LIKE'
|
820 |
+
);
|
821 |
}
|
822 |
|
823 |
return $vars;
|
includes/class-wc-advanced-shipment-tracking.php
CHANGED
@@ -1711,15 +1711,36 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
1711 |
return $order_id;
|
1712 |
}
|
1713 |
|
|
|
|
|
|
|
1714 |
public function get_option_value_from_array($array,$key,$default_value){
|
1715 |
$array_data = get_option($array);
|
1716 |
$value = '';
|
1717 |
|
1718 |
if(isset($array_data[$key])){
|
1719 |
-
$value = $array_data[$key];
|
1720 |
-
|
1721 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1722 |
|
|
|
|
|
|
|
|
|
1723 |
if($value == ''){
|
1724 |
$value = $default_value;
|
1725 |
}
|
1711 |
return $order_id;
|
1712 |
}
|
1713 |
|
1714 |
+
/*
|
1715 |
+
* Return option value for customizer
|
1716 |
+
*/
|
1717 |
public function get_option_value_from_array($array,$key,$default_value){
|
1718 |
$array_data = get_option($array);
|
1719 |
$value = '';
|
1720 |
|
1721 |
if(isset($array_data[$key])){
|
1722 |
+
$value = $array_data[$key];
|
1723 |
+
if( $value != ''){
|
1724 |
+
return $value;
|
1725 |
+
}
|
1726 |
+
}
|
1727 |
+
if($value == ''){
|
1728 |
+
$value = $default_value;
|
1729 |
+
}
|
1730 |
+
return $value;
|
1731 |
+
}
|
1732 |
+
|
1733 |
+
/*
|
1734 |
+
* Return checkbox option value for customizer
|
1735 |
+
*/
|
1736 |
+
public function get_checkbox_option_value_from_array($array,$key,$default_value){
|
1737 |
+
$array_data = get_option($array);
|
1738 |
+
$value = '';
|
1739 |
|
1740 |
+
if(isset($array_data[$key])){
|
1741 |
+
$value = $array_data[$key];
|
1742 |
+
return $value;
|
1743 |
+
}
|
1744 |
if($value == ''){
|
1745 |
$value = $default_value;
|
1746 |
}
|
includes/customizer/class-wc-availableforpickup-email-customizer.php
CHANGED
@@ -413,11 +413,11 @@ class wcast_availableforpickup_customizer_email {
|
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_email_content',$this->defaults['wcast_availableforpickup_email_content']);
|
415 |
|
416 |
-
$wcast_show_order_details = $ast->
|
417 |
|
418 |
-
$hide_shipping_item_price = $ast->
|
419 |
|
420 |
-
$wcast_show_shipping_address = $ast->
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_email_content',$this->defaults['wcast_availableforpickup_email_content']);
|
415 |
|
416 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_show_order_details',$this->defaults['wcast_availableforpickup_show_order_details']);
|
417 |
|
418 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_hide_shipping_item_price',$this->defaults['wcast_availableforpickup_hide_shipping_item_price']);
|
419 |
|
420 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_availableforpickup_email_settings','wcast_availableforpickup_show_shipping_address',$this->defaults['wcast_availableforpickup_show_shipping_address']);
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
includes/customizer/class-wc-delivered-email-customizer.php
CHANGED
@@ -430,13 +430,13 @@ class wcast_delivered_customizer_email {
|
|
430 |
|
431 |
$email_content = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_email_content',$this->defaults['wcast_delivered_status_email_content']);
|
432 |
|
433 |
-
$wcast_show_tracking_details = $ast->
|
434 |
|
435 |
-
$wcast_show_order_details = $ast->
|
436 |
|
437 |
-
$hide_shipping_item_price = $ast->
|
438 |
|
439 |
-
$wcast_show_shipping_address = $ast->
|
440 |
|
441 |
$sent_to_admin = false;
|
442 |
$plain_text = false;
|
430 |
|
431 |
$email_content = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_email_content',$this->defaults['wcast_delivered_status_email_content']);
|
432 |
|
433 |
+
$wcast_show_tracking_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_tracking_details',$this->defaults['wcast_delivered_status_show_tracking_details']);
|
434 |
|
435 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_order_details',$this->defaults['wcast_delivered_status_show_order_details']);
|
436 |
|
437 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_hide_shipping_item_price',$this->defaults['wcast_delivered_status_hide_shipping_item_price']);
|
438 |
|
439 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_shipping_address',$this->defaults['wcast_delivered_status_show_shipping_address']);
|
440 |
|
441 |
$sent_to_admin = false;
|
442 |
$plain_text = false;
|
includes/customizer/class-wc-failure-email-customizer.php
CHANGED
@@ -413,11 +413,11 @@ class wcast_failure_customizer_email {
|
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_failure_email_settings','wcast_failure_email_content',$this->defaults['wcast_failure_email_content']);
|
415 |
|
416 |
-
$wcast_show_order_details = $ast->
|
417 |
|
418 |
-
$hide_shipping_item_price = $ast->
|
419 |
|
420 |
-
$wcast_show_shipping_address = $ast->
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_failure_email_settings','wcast_failure_email_content',$this->defaults['wcast_failure_email_content']);
|
415 |
|
416 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_order_details',$this->defaults['wcast_failure_show_order_details']);
|
417 |
|
418 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_order_details',$this->defaults['wcast_failure_show_order_details']);
|
419 |
|
420 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_failure_email_settings','wcast_failure_show_shipping_address',$this->defaults['wcast_failure_show_shipping_address']);
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
includes/customizer/class-wc-intransit-email-customizer.php
CHANGED
@@ -465,11 +465,11 @@ class wcast_intransit_customizer_email {
|
|
465 |
|
466 |
$email_content = $ast->get_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_email_content',$this->defaults['wcast_intransit_email_content']);
|
467 |
|
468 |
-
$wcast_show_order_details = $ast->
|
469 |
|
470 |
-
$hide_shipping_item_price = $ast->
|
471 |
|
472 |
-
$wcast_show_shipping_address = $ast->
|
473 |
|
474 |
$sent_to_admin = false;
|
475 |
$plain_text = false;
|
465 |
|
466 |
$email_content = $ast->get_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_email_content',$this->defaults['wcast_intransit_email_content']);
|
467 |
|
468 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_show_order_details',$this->defaults['wcast_intransit_show_order_details']);
|
469 |
|
470 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_hide_shipping_item_price',$this->defaults['wcast_intransit_hide_shipping_item_price']);
|
471 |
|
472 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_intransit_email_settings','wcast_intransit_show_shipping_address',$this->defaults['wcast_intransit_show_shipping_address']);
|
473 |
|
474 |
$sent_to_admin = false;
|
475 |
$plain_text = false;
|
includes/customizer/class-wc-onhold-email-customizer.php
CHANGED
@@ -413,11 +413,11 @@ class wcast_onhold_customizer_email {
|
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_email_content',$this->defaults['wcast_onhold_email_content']);
|
415 |
|
416 |
-
$wcast_show_order_details = $ast->
|
417 |
|
418 |
-
$hide_shipping_item_price = $ast->
|
419 |
|
420 |
-
$wcast_show_shipping_address = $ast->
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
413 |
|
414 |
$email_content = $ast->get_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_email_content',$this->defaults['wcast_onhold_email_content']);
|
415 |
|
416 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_show_order_details',$this->defaults['wcast_onhold_show_order_details']);
|
417 |
|
418 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_hide_shipping_item_price',$this->defaults['wcast_onhold_hide_shipping_item_price']);
|
419 |
|
420 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_onhold_email_settings','wcast_onhold_show_shipping_address',$this->defaults['wcast_onhold_show_shipping_address']);
|
421 |
|
422 |
$sent_to_admin = false;
|
423 |
$plain_text = false;
|
includes/customizer/class-wc-outfordelivery-email-customizer.php
CHANGED
@@ -412,11 +412,11 @@ class wcast_outfordelivery_customizer_email {
|
|
412 |
|
413 |
$email_content = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_email_content',$this->defaults['wcast_outfordelivery_email_content']);
|
414 |
|
415 |
-
$wcast_show_order_details = $ast->
|
416 |
|
417 |
-
$hide_shipping_item_price = $ast->
|
418 |
|
419 |
-
$wcast_show_shipping_address = $ast->
|
420 |
|
421 |
$sent_to_admin = false;
|
422 |
$plain_text = false;
|
412 |
|
413 |
$email_content = $ast->get_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_email_content',$this->defaults['wcast_outfordelivery_email_content']);
|
414 |
|
415 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_show_order_details',$this->defaults['wcast_outfordelivery_show_order_details']);
|
416 |
|
417 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_hide_shipping_item_price',$this->defaults['wcast_outfordelivery_hide_shipping_item_price']);
|
418 |
|
419 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_outfordelivery_email_settings','wcast_outfordelivery_show_shipping_address',$this->defaults['wcast_outfordelivery_show_shipping_address']);
|
420 |
|
421 |
$sent_to_admin = false;
|
422 |
$plain_text = false;
|
includes/customizer/class-wc-partial-shipped-email-customizer.php
CHANGED
@@ -168,7 +168,12 @@ class wcast_partial_shipped_customizer_email {
|
|
168 |
'choices' => wcast_customizer()->get_order_ids(),
|
169 |
)
|
170 |
) );
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
172 |
// Preview Order
|
173 |
$wp_customize->add_setting( 'wcast_order_status_email_type',
|
174 |
array(
|
@@ -187,10 +192,7 @@ class wcast_partial_shipped_customizer_email {
|
|
187 |
'placeholder' => __( 'Select email type', 'woo-advanced-shipment-tracking' ),
|
188 |
'class' => 'preview_email_type',
|
189 |
),
|
190 |
-
'choices' =>
|
191 |
-
'partially_shipped' => __( 'Partially Shipped', 'woo-advanced-shipment-tracking' ),
|
192 |
-
'updated_tracking' => __( 'Updated Tracking', 'woo-advanced-shipment-tracking' ),
|
193 |
-
),
|
194 |
)
|
195 |
) );
|
196 |
|
168 |
'choices' => wcast_customizer()->get_order_ids(),
|
169 |
)
|
170 |
) );
|
171 |
+
|
172 |
+
$order_status = array(
|
173 |
+
'partially_shipped' => __( 'Partially Shipped', 'woo-advanced-shipment-tracking' ),
|
174 |
+
'updated_tracking' => __( 'Updated Tracking', 'woo-advanced-shipment-tracking' ),
|
175 |
+
);
|
176 |
+
$order_status = apply_filters('wcast_order_status_email_type', $tracking_template);
|
177 |
// Preview Order
|
178 |
$wp_customize->add_setting( 'wcast_order_status_email_type',
|
179 |
array(
|
192 |
'placeholder' => __( 'Select email type', 'woo-advanced-shipment-tracking' ),
|
193 |
'class' => 'preview_email_type',
|
194 |
),
|
195 |
+
'choices' => $order_status,
|
|
|
|
|
|
|
196 |
)
|
197 |
) );
|
198 |
|
includes/customizer/class-wc-returntosender-email-customizer.php
CHANGED
@@ -409,13 +409,11 @@ class wcast_returntosender_customizer_email {
|
|
409 |
|
410 |
$email_content = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_email_content',$this->defaults['wcast_returntosender_email_content']);
|
411 |
|
412 |
-
$
|
413 |
-
|
414 |
-
$wcast_show_order_details = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_order_details',$this->defaults['wcast_returntosender_show_order_details']);
|
415 |
|
416 |
-
$hide_shipping_item_price = $ast->
|
417 |
|
418 |
-
$wcast_show_shipping_address = $ast->
|
419 |
|
420 |
$sent_to_admin = false;
|
421 |
$plain_text = false;
|
409 |
|
410 |
$email_content = $ast->get_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_email_content',$this->defaults['wcast_returntosender_email_content']);
|
411 |
|
412 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_order_details',$this->defaults['wcast_returntosender_show_order_details']);
|
|
|
|
|
413 |
|
414 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_hide_shipping_item_price',$this->defaults['wcast_returntosender_hide_shipping_item_price']);
|
415 |
|
416 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_returntosender_email_settings','wcast_returntosender_show_shipping_address',$this->defaults['wcast_returntosender_show_shipping_address']);
|
417 |
|
418 |
$sent_to_admin = false;
|
419 |
$plain_text = false;
|
includes/customizer/custom-controls.php
CHANGED
@@ -16,7 +16,7 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
|
|
16 |
</label>
|
17 |
<?php
|
18 |
}
|
19 |
-
}
|
20 |
|
21 |
class WP_Customize_codeinfoblock_Control extends WP_Customize_Control {
|
22 |
|
16 |
</label>
|
17 |
<?php
|
18 |
}
|
19 |
+
}
|
20 |
|
21 |
class WP_Customize_codeinfoblock_Control extends WP_Customize_Control {
|
22 |
|
includes/trackship-email-manager.php
CHANGED
@@ -38,11 +38,11 @@ class WC_TrackShip_Email_Manager {
|
|
38 |
|
39 |
$email_content = $ast->get_option_value_from_array('wcast_'.$status.'_email_settings','wcast_'.$status.'_email_content',$wcast_status_customizer_email->defaults['wcast_'.$status.'_email_content']);
|
40 |
|
41 |
-
$wcast_show_order_details = $ast->
|
42 |
|
43 |
-
$hide_shipping_item_price = $ast->
|
44 |
|
45 |
-
$wcast_show_shipping_address = $ast->
|
46 |
|
47 |
$sent_to_admin = false;
|
48 |
$plain_text = false;
|
@@ -160,11 +160,11 @@ class WC_TrackShip_Email_Manager {
|
|
160 |
|
161 |
$wcast_show_tracking_details = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_tracking_details',$wcast_delivered_customizer_email->defaults['wcast_delivered_status_show_tracking_details']);
|
162 |
|
163 |
-
$wcast_show_order_details = $ast->
|
164 |
|
165 |
-
$wcast_show_shipping_address = $ast->
|
166 |
|
167 |
-
$hide_shipping_item_price = $ast->
|
168 |
|
169 |
$sent_to_admin = false;
|
170 |
$plain_text = false;
|
38 |
|
39 |
$email_content = $ast->get_option_value_from_array('wcast_'.$status.'_email_settings','wcast_'.$status.'_email_content',$wcast_status_customizer_email->defaults['wcast_'.$status.'_email_content']);
|
40 |
|
41 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_'.$status.'_email_settings','wcast_'.$status.'_show_order_details',$wcast_status_customizer_email->defaults['wcast_'.$status.'_show_order_details']);
|
42 |
|
43 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_'.$status.'_email_settings','wcast_'.$status.'_hide_shipping_item_price',$wcast_status_customizer_email->defaults['wcast_'.$status.'_hide_shipping_item_price']);
|
44 |
|
45 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_'.$status.'_email_settings','wcast_'.$status.'_show_shipping_address','');
|
46 |
|
47 |
$sent_to_admin = false;
|
48 |
$plain_text = false;
|
160 |
|
161 |
$wcast_show_tracking_details = $ast->get_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_tracking_details',$wcast_delivered_customizer_email->defaults['wcast_delivered_status_show_tracking_details']);
|
162 |
|
163 |
+
$wcast_show_order_details = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_order_details',$wcast_delivered_customizer_email->defaults['wcast_delivered_status_show_order_details']);
|
164 |
|
165 |
+
$wcast_show_shipping_address = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_show_shipping_address',$wcast_delivered_customizer_email->defaults['wcast_delivered_status_show_shipping_address']);
|
166 |
|
167 |
+
$hide_shipping_item_price = $ast->get_checkbox_option_value_from_array('wcast_delivered_email_settings','wcast_delivered_status_hide_shipping_item_price',$wcast_delivered_customizer_email->defaults['wcast_delivered_status_hide_shipping_item_price']);
|
168 |
|
169 |
$sent_to_admin = false;
|
170 |
$plain_text = false;
|
includes/views/admin_options_shipping_provider.php
CHANGED
@@ -104,7 +104,7 @@ if(isset($_GET['open']) && $_GET['open'] == 'synch_providers'){ ?>
|
|
104 |
<label><?php _e( 'Custom API name', 'woo-advanced-shipment-tracking' ); ?> <span class="woocommerce-help-tip tipTip" title="<?php _e( "Add API name aliases to map Shipping providers names with the provider names that are updated in the shipment tracking API by external shipping services", 'woo-advanced-shipment-tracking' ); ?>"></span></label>
|
105 |
<div class="api_provider_div">
|
106 |
<input type="text" name="api_provider_name[]" class="api_provider_name" value="" placeholder="<?php _e( 'API Name', 'woo-advanced-shipment-tracking' ); ?>">
|
107 |
-
|
108 |
</div>
|
109 |
</div>
|
110 |
<div class="shipping_country form-field form-50">
|
104 |
<label><?php _e( 'Custom API name', 'woo-advanced-shipment-tracking' ); ?> <span class="woocommerce-help-tip tipTip" title="<?php _e( "Add API name aliases to map Shipping providers names with the provider names that are updated in the shipment tracking API by external shipping services", 'woo-advanced-shipment-tracking' ); ?>"></span></label>
|
105 |
<div class="api_provider_div">
|
106 |
<input type="text" name="api_provider_name[]" class="api_provider_name" value="" placeholder="<?php _e( 'API Name', 'woo-advanced-shipment-tracking' ); ?>">
|
107 |
+
<?php do_action('add_more_api_provider'); ?>
|
108 |
</div>
|
109 |
</div>
|
110 |
<div class="shipping_country form-field form-50">
|
readme.txt
CHANGED
@@ -142,6 +142,12 @@ Yes, if you use external shipping services that work with the WooCommerce REST A
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
= 3.2.1.4 =
|
146 |
* Enhancement - Improved the TrackShip tools page design
|
147 |
* Enhancement - Set pagination in shipping provider list when bulk Activate/Deactivate all providers
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 3.2.1.5 =
|
146 |
+
* Enhancement - Updated settings page option design from multiple checkbox to multiple select2
|
147 |
+
* Dev - On first installation make 15 shipping provider active by default
|
148 |
+
* Dev - On plugin activation check if shipping provider table column, if not exist any column create new and update the provider list
|
149 |
+
* Dev - Added compatibility with WooCommerce 5.0.0
|
150 |
+
|
151 |
= 3.2.1.4 =
|
152 |
* Enhancement - Improved the TrackShip tools page design
|
153 |
* Enhancement - Set pagination in shipping provider list when bulk Activate/Deactivate all providers
|
templates/emails/tracking-info.php
CHANGED
@@ -36,11 +36,11 @@ if ( $tracking_items ) :
|
|
36 |
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
39 |
-
$display_thumbnail = $ast->
|
40 |
|
41 |
-
$display_shipping_provider_name = $ast->
|
42 |
|
43 |
-
$tracking_number_link = $ast->
|
44 |
|
45 |
if($display_shipping_provider_name == 1 && $display_thumbnail == 1){
|
46 |
$show_provider_th = 1;
|
@@ -70,7 +70,7 @@ if ( $tracking_items ) :
|
|
70 |
|
71 |
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
|
72 |
|
73 |
-
$hide_trackig_header = $ast->
|
74 |
|
75 |
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
76 |
|
@@ -106,11 +106,11 @@ if ( $tracking_items ) :
|
|
106 |
|
107 |
$tracking_link_style2 = "color: ".$tracking_link_font_color.";padding: 10px;text-decoration: none;";
|
108 |
|
109 |
-
$hide_table_header = $ast->
|
110 |
|
111 |
-
$remove_date_from_tracking_info = $ast->
|
112 |
|
113 |
-
$show_track_label = $ast->
|
114 |
|
115 |
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text',$wcast_customizer_settings->defaults['provider_header_text']);
|
116 |
|
@@ -126,7 +126,7 @@ if ( $tracking_items ) :
|
|
126 |
|
127 |
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color',$wcast_customizer_settings->defaults['simple_provider_font_color']);
|
128 |
|
129 |
-
$show_provider_border = $ast->
|
130 |
|
131 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
132 |
|
@@ -277,7 +277,7 @@ if ( $tracking_items ) :
|
|
277 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
278 |
<?php if($tracking_item['formatted_tracking_link'] && $tracking_number_link){
|
279 |
$url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
|
280 |
-
<a href="<?php echo esc_url( $url ); ?>" style="
|
281 |
<?php } else{
|
282 |
echo esc_html( $tracking_item['tracking_number'] );
|
283 |
} ?>
|
36 |
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
39 |
+
$display_thumbnail = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_image',$wcast_customizer_settings->defaults['display_shipment_provider_image']);
|
40 |
|
41 |
+
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_name',$wcast_customizer_settings->defaults['display_shipment_provider_name']);
|
42 |
|
43 |
+
$tracking_number_link = $ast->get_checkbox_option_value_from_array('tracking_info_settings','tracking_number_link','');
|
44 |
|
45 |
if($display_shipping_provider_name == 1 && $display_thumbnail == 1){
|
46 |
$show_provider_th = 1;
|
70 |
|
71 |
$email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
|
72 |
|
73 |
+
$hide_trackig_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
74 |
|
75 |
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
76 |
|
106 |
|
107 |
$tracking_link_style2 = "color: ".$tracking_link_font_color.";padding: 10px;text-decoration: none;";
|
108 |
|
109 |
+
$hide_table_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_table_header','');
|
110 |
|
111 |
+
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array('tracking_info_settings','remove_date_from_tracking',$wcast_customizer_settings->defaults['remove_date_from_tracking']);
|
112 |
|
113 |
+
$show_track_label = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_track_label',$wcast_customizer_settings->defaults['show_track_label']);
|
114 |
|
115 |
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text',$wcast_customizer_settings->defaults['provider_header_text']);
|
116 |
|
126 |
|
127 |
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color',$wcast_customizer_settings->defaults['simple_provider_font_color']);
|
128 |
|
129 |
+
$show_provider_border = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_provider_border',$wcast_customizer_settings->defaults['show_provider_border']);
|
130 |
|
131 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
132 |
|
277 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
278 |
<?php if($tracking_item['formatted_tracking_link'] && $tracking_number_link){
|
279 |
$url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
|
280 |
+
<a href="<?php echo esc_url( $url ); ?>" style="text-decoration: none;" target="_blank"><?php echo esc_html( $tracking_item['tracking_number'] ); ?></a>
|
281 |
<?php } else{
|
282 |
echo esc_html( $tracking_item['tracking_number'] );
|
283 |
} ?>
|
templates/emails/wcast-email-order-details.php
CHANGED
@@ -70,6 +70,7 @@ if ( true == $responsive_check ) { ?>
|
|
70 |
<thead>
|
71 |
<tr>
|
72 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
|
|
73 |
<?php if(!$hide_shipping_item_price){ ?>
|
74 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
75 |
<?php } ?>
|
@@ -97,7 +98,8 @@ if ( true == $responsive_check ) { ?>
|
|
97 |
'show_image' => $args['show_image'],
|
98 |
'image_size' => $args['image_size'],
|
99 |
'plain_text' => $args['plain_text'],
|
100 |
-
'sent_to_admin' => $args['sent_to_admin']
|
|
|
101 |
),
|
102 |
'woocommerce-advanced-shipment-tracking/',
|
103 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
70 |
<thead>
|
71 |
<tr>
|
72 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
73 |
+
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
74 |
<?php if(!$hide_shipping_item_price){ ?>
|
75 |
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
76 |
<?php } ?>
|
98 |
'show_image' => $args['show_image'],
|
99 |
'image_size' => $args['image_size'],
|
100 |
'plain_text' => $args['plain_text'],
|
101 |
+
'sent_to_admin' => $args['sent_to_admin'],
|
102 |
+
'hide_shipping_item_price' => $hide_shipping_item_price
|
103 |
),
|
104 |
'woocommerce-advanced-shipment-tracking/',
|
105 |
wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/'
|
templates/myaccount/tracking-info.php
CHANGED
@@ -37,11 +37,11 @@ if ( $tracking_items ) :
|
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
39 |
|
40 |
-
$display_thumbnail = $ast->
|
41 |
|
42 |
-
$display_shipping_provider_name = $ast->
|
43 |
|
44 |
-
$tracking_number_link = $ast->
|
45 |
|
46 |
if($display_shipping_provider_name == 1 && $display_thumbnail == 1){
|
47 |
$show_provider_th = 1;
|
@@ -63,7 +63,7 @@ if ( $tracking_items ) :
|
|
63 |
|
64 |
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
65 |
|
66 |
-
$hide_trackig_header = $ast->
|
67 |
|
68 |
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
69 |
|
@@ -103,11 +103,11 @@ if ( $tracking_items ) :
|
|
103 |
|
104 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";margin-bottom: 0;";
|
105 |
|
106 |
-
$hide_table_header = $ast->
|
107 |
|
108 |
-
$remove_date_from_tracking_info = $ast->
|
109 |
|
110 |
-
$show_track_label = $ast->
|
111 |
|
112 |
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text',$wcast_customizer_settings->defaults['provider_header_text']);
|
113 |
|
@@ -123,7 +123,7 @@ if ( $tracking_items ) :
|
|
123 |
|
124 |
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color',$wcast_customizer_settings->defaults['simple_provider_font_color']);
|
125 |
|
126 |
-
$show_provider_border = $ast->
|
127 |
|
128 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
129 |
?>
|
@@ -190,7 +190,7 @@ if ( $tracking_items ) :
|
|
190 |
<?php } ?>
|
191 |
</ul>
|
192 |
</div>
|
193 |
-
<?php } else{ ?>
|
194 |
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;background:<?php echo $email_table_backgroud_color; ?>">
|
195 |
<?php if($hide_table_header != 1){ ?>
|
196 |
<thead>
|
@@ -280,7 +280,10 @@ if ( $tracking_items ) :
|
|
280 |
?></tbody>
|
281 |
</table>
|
282 |
<?php
|
283 |
-
}
|
|
|
|
|
|
|
284 |
<div id="" class="popupwrapper ts_tracking_popup" style="display:none;">
|
285 |
<div class="popuprow">
|
286 |
|
37 |
$show_provider_th = 1;
|
38 |
$colspan = 1;
|
39 |
|
40 |
+
$display_thumbnail = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_image',$wcast_customizer_settings->defaults['display_shipment_provider_image']);
|
41 |
|
42 |
+
$display_shipping_provider_name = $ast->get_checkbox_option_value_from_array('tracking_info_settings','display_shipment_provider_name',$wcast_customizer_settings->defaults['display_shipment_provider_name']);
|
43 |
|
44 |
+
$tracking_number_link = $ast->get_checkbox_option_value_from_array('tracking_info_settings','tracking_number_link','');
|
45 |
|
46 |
if($display_shipping_provider_name == 1 && $display_thumbnail == 1){
|
47 |
$show_provider_th = 1;
|
63 |
|
64 |
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
65 |
|
66 |
+
$hide_trackig_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_trackig_header','');
|
67 |
|
68 |
$shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
|
69 |
|
103 |
|
104 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";margin-bottom: 0;";
|
105 |
|
106 |
+
$hide_table_header = $ast->get_checkbox_option_value_from_array('tracking_info_settings','hide_table_header','');
|
107 |
|
108 |
+
$remove_date_from_tracking_info = $ast->get_checkbox_option_value_from_array('tracking_info_settings','remove_date_from_tracking',$wcast_customizer_settings->defaults['remove_date_from_tracking']);
|
109 |
|
110 |
+
$show_track_label = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_track_label',$wcast_customizer_settings->defaults['show_track_label']);
|
111 |
|
112 |
$provider_header_text = $ast->get_option_value_from_array('tracking_info_settings','provider_header_text',$wcast_customizer_settings->defaults['provider_header_text']);
|
113 |
|
123 |
|
124 |
$simple_provider_font_color = $ast->get_option_value_from_array('tracking_info_settings','simple_provider_font_color',$wcast_customizer_settings->defaults['simple_provider_font_color']);
|
125 |
|
126 |
+
$show_provider_border = $ast->get_checkbox_option_value_from_array('tracking_info_settings','show_provider_border',$wcast_customizer_settings->defaults['show_provider_border']);
|
127 |
|
128 |
$provider_border_color = $ast->get_option_value_from_array('tracking_info_settings','provider_border_color',$wcast_customizer_settings->defaults['provider_border_color']);
|
129 |
?>
|
190 |
<?php } ?>
|
191 |
</ul>
|
192 |
</div>
|
193 |
+
<?php } else if( $select_tracking_template == 'default_table' ){ ?>
|
194 |
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;background:<?php echo $email_table_backgroud_color; ?>">
|
195 |
<?php if($hide_table_header != 1){ ?>
|
196 |
<thead>
|
280 |
?></tbody>
|
281 |
</table>
|
282 |
<?php
|
283 |
+
}
|
284 |
+
if( !isset($show_shipment_status) ) $show_shipment_status = false;
|
285 |
+
do_action( 'my_account_tracking_info_template' , $order_id, $tracking_items, $show_shipment_status );
|
286 |
+
?>
|
287 |
<div id="" class="popupwrapper ts_tracking_popup" style="display:none;">
|
288 |
<div class="popuprow">
|
289 |
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,16 +4,15 @@
|
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
-
* Version: 3.2.1.
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
-
* WC tested up to:
|
14 |
*/
|
15 |
|
16 |
-
|
17 |
class zorem_woocommerce_advanced_shipment_tracking {
|
18 |
|
19 |
/**
|
@@ -21,12 +20,12 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
-
public $version = '3.2.1.
|
25 |
|
26 |
/**
|
27 |
* Initialize the main plugin function
|
28 |
*/
|
29 |
-
public function __construct() {
|
30 |
|
31 |
$this->plugin_file = __FILE__;
|
32 |
// Add your templates to this array.
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
+
* Version: 3.2.1.5
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
+
* WC tested up to: 5.0.0
|
14 |
*/
|
15 |
|
|
|
16 |
class zorem_woocommerce_advanced_shipment_tracking {
|
17 |
|
18 |
/**
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
public $version = '3.2.1.5';
|
24 |
|
25 |
/**
|
26 |
* Initialize the main plugin function
|
27 |
*/
|
28 |
+
public function __construct() {
|
29 |
|
30 |
$this->plugin_file = __FILE__;
|
31 |
// Add your templates to this array.
|