PluginProbe ʕ •ᴥ•ʔ
PiWeb Delivery & Pickup Date Time for WooCommerce / 3.0.49.3
PiWeb Delivery & Pickup Date Time for WooCommerce v3.0.49.3
3.0.63 3.0.62 3.0.61 3.0.60 3.0.49.49 3.0.49.6 3.0.49.60 3.0.49.61 3.0.49.62 3.0.49.63 3.0.49.64 3.0.49.66 3.0.49.67 3.0.49.69 3.0.49.7 3.0.49.70 3.0.49.72 3.0.49.73 3.0.49.74 3.0.49.76 3.0.49.77 3.0.49.79 3.0.49.9 3.0.49.90 3.0.49.91 3.0.49.92 3.0.49.93 3.0.49.94 3.0.49.96 3.0.49.97 3.0.49.99 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 2.9.17 3.0.47 3.0.49 3.0.49.1 3.0.49.10 3.0.49.11 3.0.49.12 3.0.49.13 3.0.49.16 3.0.49.17 3.0.49.19 3.0.49.2 3.0.49.20 3.0.49.21 3.0.49.22 3.0.49.23 3.0.49.24 3.0.49.26 3.0.49.27 3.0.49.29 3.0.49.3 3.0.49.30 3.0.49.31 3.0.49.32 3.0.49.33 3.0.49.34 3.0.49.36 3.0.49.37 3.0.49.39 3.0.49.4 3.0.49.40 3.0.49.41 3.0.49.42 3.0.49.43 3.0.49.44 3.0.49.46 3.0.49.47
pi-woocommerce-order-date-time-and-type / admin / class-pi-dtt-order-table.php
pi-woocommerce-order-date-time-and-type / admin Last commit date
css 2 years ago img 2 years ago js 2 years ago class-adv-order-filter.php 2 years ago class-pi-dtt-labels.php 2 years ago class-pi-dtt-order-table.php 2 years ago conflict-fixer.php 2 years ago menu.php 2 years ago options-addons.php 2 years ago options-date.php 2 years ago options-limit.php 2 years ago options-pickup.php 2 years ago options-time-slot.php 2 years ago options-time.php 2 years ago options.php 2 years ago
class-pi-dtt-order-table.php
208 lines
1 <?php
2
3 if(!class_exists('pisol_dtt_order_table')){
4 class pisol_dtt_order_table{
5 function __construct(){
6 add_filter( 'manage_edit-shop_order_columns', array($this,'deliverPickupDateColumn') );
7 add_filter( 'manage_woocommerce_page_wc-orders_columns', array($this,'deliverPickupDateColumn') ); //hpos
8
9 add_action( 'manage_shop_order_posts_custom_column', array($this,'deliverPickupDate') );
10 add_action( 'manage_woocommerce_page_wc-orders_custom_column', array($this,'deliverPickupDateHPOS'),10, 2 ); //hpos
11
12 add_filter( 'manage_edit-shop_order_sortable_columns', array($this,'sortByDate') );
13 add_filter( 'woocommerce_shop_order_list_table_sortable_columns', array($this,'sortByDate') ); //hpos
14 add_filter( 'manage_woocommerce_page_wc-orders_sortable_columns', array($this,'sortByDate') );//hpos
15
16 add_action( 'pre_get_posts', array($this,'sortByValue') );
17 add_filter( 'woocommerce_shop_order_list_table_prepare_items_query_args', array($this, 'sortByValueHPOS') ); //hpos
18 }
19
20 function sortByDate($col){
21 $col['pisol_dpd'] = 'pisol_dpd';
22 $col['pisol_method'] = 'pisol_method';
23 $col['pisol_time'] = 'pisol_time';
24 return $col;
25 }
26
27 function sortByValue($query){
28 if( ! is_admin() ) return;
29
30 $orderby = $query->get( 'orderby');
31
32 if( 'pisol_dpd' == $orderby ) {
33 $query->set('meta_key','pi_system_delivery_date');
34 $query->set('meta_type','DATE');
35 $query->set('orderby','meta_value');
36 }
37
38 if( 'pisol_method' == $orderby ) {
39 $query->set('meta_key','pi_delivery_type');
40 $query->set('orderby','meta_value');
41 }
42
43 if( 'pisol_time' == $orderby ) {
44 $query->set('meta_key','pi_delivery_time');
45 $query->set('meta_type','TIME');
46 $query->set('orderby','meta_value');
47 }
48 }
49
50 /**
51 * At present sorting is not working
52 */
53 function sortByValueHPOS($args){
54 if( ! is_admin() ) return $args;
55
56 $orderby = isset($args[ 'orderby']) ? $args[ 'orderby'] : '';
57
58 if( 'pisol_dpd' == $orderby ) {
59 $args['orderby'] = 'meta_value';
60 $args['meta_key'] = 'pi_system_delivery_date';
61 $args['meta_type'] = 'DATE';
62 }
63
64 if( 'pisol_method' == $orderby ) {
65 $args['meta_key'] = 'pi_delivery_type';
66 $args['orderby'] = 'meta_value';
67 }
68
69 if( 'pisol_time' == $orderby ) {
70 $args['orderby'] = 'meta_value';
71 $args['meta_key'] = 'pi_delivery_time';
72 $args['meta_type'] = 'TIME';
73 }
74
75 return $args;
76 }
77
78 function deliverPickupDateColumn( $columns ) {
79 $columns['pisol_dpd'] = __('Order Arrival Date','pisol-dtt');
80 $columns['pisol_time'] = __('Order Arrival Time','pisol-dtt');
81 $columns['pisol_method'] = __('Method','pisol-dtt');
82 $columns['pisol_pickup_location'] = __('Pickup shop','pisol-dtt');
83 return $columns;
84 }
85
86 function deliverPickupDate( $column ) {
87 global $post;
88 $order = wc_get_order( $post->ID );
89
90 if(empty($order)) return;
91
92 if ( 'pisol_dpd' === $column ) {
93 $date = "";
94 $sysdeldate = $order->get_meta( 'pi_system_delivery_date', true );
95 $old_date = $order->get_meta( 'pi_delivery_date', true );
96
97 if(! empty($sysdeldate)){
98
99 $date = pi_dtt_date::translatedDate($sysdeldate);
100 echo $this->emptyValue($date);
101
102 }elseif(!empty($old_date)){
103 $date = ($old_date);
104 echo $date;
105 }
106
107 }
108
109 if ( 'pisol_time' === $column ) {
110 $time = $order->get_meta( 'pi_delivery_time', true );
111 echo pisol_dtt_time::formatTimeForDisplay($time);
112 }
113
114 if ( 'pisol_method' === $column ) {
115 $delivery_method = $order->get_meta( 'pi_delivery_type', true );
116
117 if( $delivery_method =='pickup'){
118 $order_delivery_type = __('Pickup','pisol-dtt');
119 $class= "processing";
120 }else{
121 $order_delivery_type = __('Delivery','pisol-dtt');
122 $class= "completed";
123 }
124 $order_delivery_type = '<mark class="order-status status-'.$class.' "><span>'.$order_delivery_type.'</span></mark>';
125 $order_delivery_type = apply_filters('pisol_dtt_order_table_delivery_method', $order_delivery_type, $delivery_method);
126 echo $this->emptyValue($order_delivery_type) ;
127 }
128
129 if ( 'pisol_pickup_location' === $column ) {
130 $old_location = $order->get_meta( 'pickup_location', true );
131 $location_id = $order->get_meta( 'pickup_location_id', true );
132
133 if(empty($location_id)){
134 echo $old_location;
135 }elseif(!empty($location_id)){
136 $location_post = get_post($location_id);
137 $location_title = $location_post->post_title;
138 echo $location_title;
139 }
140 }
141 }
142
143 function deliverPickupDateHPOS( $column, $order ) {
144
145 if(empty($order)) return;
146
147 if ( 'pisol_dpd' === $column ) {
148 $date = "";
149 $sysdeldate = $order->get_meta('pi_system_delivery_date', true );
150 $old_date = $order->get_meta( 'pi_delivery_date', true );
151
152 if(! empty($sysdeldate)){
153
154 $date = pi_dtt_date::translatedDate($sysdeldate);
155 echo $this->emptyValue($date);
156
157 }elseif(!empty($old_date)){
158 $date = ($old_date);
159 echo $date;
160 }
161
162 }
163
164 if ( 'pisol_time' === $column ) {
165 $time = $order->get_meta( 'pi_delivery_time', true );
166 echo pisol_dtt_time::formatTimeForDisplay($time);
167 }
168
169 if ( 'pisol_method' === $column ) {
170 $delivery_method = $order->get_meta( 'pi_delivery_type', true );
171
172 if( $delivery_method =='pickup'){
173 $order_delivery_type = __('Pickup','pisol-dtt');
174 $class= "processing";
175 }else{
176 $order_delivery_type = __('Delivery','pisol-dtt');
177 $class= "completed";
178 }
179 $order_delivery_type = '<mark class="order-status status-'.$class.' "><span>'.$order_delivery_type.'</span></mark>';
180 $order_delivery_type = apply_filters('pisol_dtt_order_table_delivery_method', $order_delivery_type, $delivery_method);
181 echo $this->emptyValue($order_delivery_type) ;
182 }
183
184 if ( 'pisol_pickup_location' === $column ) {
185 $old_location = $order->get_meta( 'pickup_location', true );
186 $location_id = $order->get_meta( 'pickup_location_id', true );
187
188 if(empty($location_id)){
189 echo $old_location;
190 }elseif(!empty($location_id)){
191 $location_post = get_post($location_id);
192 $location_title = $location_post->post_title;
193 echo $location_title;
194 }
195 }
196 }
197
198 function emptyValue($value){
199 if($value != ""){
200 return $value;
201 }else{
202 return '-';
203 }
204 }
205 }
206
207 new pisol_dtt_order_table();
208 }