PluginProbe ʕ •ᴥ•ʔ
PiWeb Delivery & Pickup Date Time for WooCommerce / 3.0.62
PiWeb Delivery & Pickup Date Time for WooCommerce v3.0.62
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 3 weeks ago img 3 weeks ago js 3 weeks ago partials 3 weeks ago class-accesscontrol.php 3 weeks ago class-adv-order-filter.php 3 weeks ago class-analytics.php 3 weeks ago class-order-tip-promotion.php 3 weeks ago class-pi-dtt-labels.php 3 weeks ago class-pi-dtt-order-table.php 3 weeks ago conflict-fixer.php 3 weeks ago menu.php 3 weeks ago options-accesscontrol.php 3 weeks ago options-addons.php 3 weeks ago options-date.php 3 weeks ago options-limit.php 3 weeks ago options-pickup.php 3 weeks ago options-time-slot.php 3 weeks ago options-time.php 3 weeks ago options.php 3 weeks ago
class-pi-dtt-order-table.php
209 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 if(!class_exists('pisol_dtt_order_table')){
5 class pisol_dtt_order_table{
6 function __construct(){
7 add_filter( 'manage_edit-shop_order_columns', array($this,'deliverPickupDateColumn') );
8 add_filter( 'manage_woocommerce_page_wc-orders_columns', array($this,'deliverPickupDateColumn') ); //hpos
9
10 add_action( 'manage_shop_order_posts_custom_column', array($this,'deliverPickupDate') );
11 add_action( 'manage_woocommerce_page_wc-orders_custom_column', array($this,'deliverPickupDateHPOS'),10, 2 ); //hpos
12
13 add_filter( 'manage_edit-shop_order_sortable_columns', array($this,'sortByDate') );
14 add_filter( 'woocommerce_shop_order_list_table_sortable_columns', array($this,'sortByDate') ); //hpos
15 add_filter( 'manage_woocommerce_page_wc-orders_sortable_columns', array($this,'sortByDate') );//hpos
16
17 add_action( 'pre_get_posts', array($this,'sortByValue') );
18 add_filter( 'woocommerce_shop_order_list_table_prepare_items_query_args', array($this, 'sortByValueHPOS') ); //hpos
19 }
20
21 function sortByDate($col){
22 $col['pisol_dpd'] = 'pisol_dpd';
23 $col['pisol_method'] = 'pisol_method';
24 $col['pisol_time'] = 'pisol_time';
25 return $col;
26 }
27
28 function sortByValue($query){
29 if( ! is_admin() ) return;
30
31 $orderby = $query->get( 'orderby');
32
33 if( 'pisol_dpd' == $orderby ) {
34 $query->set('meta_key','pi_system_delivery_date');
35 $query->set('meta_type','DATE');
36 $query->set('orderby','meta_value');
37 }
38
39 if( 'pisol_method' == $orderby ) {
40 $query->set('meta_key','pi_delivery_type');
41 $query->set('orderby','meta_value');
42 }
43
44 if( 'pisol_time' == $orderby ) {
45 $query->set('meta_key','pi_delivery_time');
46 $query->set('meta_type','TIME');
47 $query->set('orderby','meta_value');
48 }
49 }
50
51 /**
52 * At present sorting is not working
53 */
54 function sortByValueHPOS($args){
55 if( ! is_admin() ) return $args;
56
57 $orderby = isset($args[ 'orderby']) ? $args[ 'orderby'] : '';
58
59 if( 'pisol_dpd' == $orderby ) {
60 $args['orderby'] = 'meta_value';
61 $args['meta_key'] = 'pi_system_delivery_date';
62 $args['meta_type'] = 'DATE';
63 }
64
65 if( 'pisol_method' == $orderby ) {
66 $args['meta_key'] = 'pi_delivery_type';
67 $args['orderby'] = 'meta_value';
68 }
69
70 if( 'pisol_time' == $orderby ) {
71 $args['orderby'] = 'meta_value';
72 $args['meta_key'] = 'pi_delivery_time';
73 $args['meta_type'] = 'TIME';
74 }
75
76 return $args;
77 }
78
79 function deliverPickupDateColumn( $columns ) {
80 $columns['pisol_dpd'] = __('Order Arrival Date','pisol-dtt');
81 $columns['pisol_time'] = __('Order Arrival Time','pisol-dtt');
82 $columns['pisol_method'] = __('Method','pisol-dtt');
83 $columns['pisol_pickup_location'] = __('Pickup shop','pisol-dtt');
84 return $columns;
85 }
86
87 function deliverPickupDate( $column ) {
88 global $post;
89 $order = wc_get_order( $post->ID );
90
91 if(empty($order)) return;
92
93 if ( 'pisol_dpd' === $column ) {
94 $date = "";
95 $sysdeldate = $order->get_meta( 'pi_system_delivery_date', true );
96 $old_date = $order->get_meta( 'pi_delivery_date', true );
97
98 if(! empty($sysdeldate)){
99
100 $date = pi_dtt_date::translatedDate($sysdeldate);
101 echo wp_kses_post( $this->emptyValue($date) );
102
103 }elseif(!empty($old_date)){
104 $date = ($old_date);
105 echo wp_kses_post( $date );
106 }
107
108 }
109
110 if ( 'pisol_time' === $column ) {
111 $time = $order->get_meta( 'pi_delivery_time', true );
112 echo wp_kses_post( pisol_dtt_time::formatTimeForDisplay($time) );
113 }
114
115 if ( 'pisol_method' === $column ) {
116 $delivery_method = $order->get_meta( 'pi_delivery_type', true );
117
118 if( $delivery_method =='pickup'){
119 $order_delivery_type = _x('Pickup','Order table','pisol-dtt');
120 $class= "processing";
121 }else{
122 $order_delivery_type = _x('Delivery','Order table','pisol-dtt');
123 $class= "completed";
124 }
125 $order_delivery_type = '<mark class="order-status status-'.$class.' "><span>'.$order_delivery_type.'</span></mark>';
126 $order_delivery_type = apply_filters('pisol_dtt_order_table_delivery_method', $order_delivery_type, $delivery_method);
127 echo wp_kses_post( $this->emptyValue($order_delivery_type) ) ;
128 }
129
130 if ( 'pisol_pickup_location' === $column ) {
131 $old_location = $order->get_meta( 'pickup_location', true );
132 $location_id = $order->get_meta( 'pickup_location_id', true );
133
134 if(empty($location_id)){
135 echo wp_kses_post( $old_location );
136 }elseif(!empty($location_id)){
137 $location_post = get_post($location_id);
138 $location_title = $location_post->post_title;
139 echo wp_kses_post( $location_title );
140 }
141 }
142 }
143
144 function deliverPickupDateHPOS( $column, $order ) {
145
146 if(empty($order)) return;
147
148 if ( 'pisol_dpd' === $column ) {
149 $date = "";
150 $sysdeldate = $order->get_meta('pi_system_delivery_date', true );
151 $old_date = $order->get_meta( 'pi_delivery_date', true );
152
153 if(! empty($sysdeldate)){
154
155 $date = pi_dtt_date::translatedDate($sysdeldate);
156 echo wp_kses_post( $this->emptyValue($date) );
157
158 }elseif(!empty($old_date)){
159 $date = ($old_date);
160 echo wp_kses_post( $date );
161 }
162
163 }
164
165 if ( 'pisol_time' === $column ) {
166 $time = $order->get_meta( 'pi_delivery_time', true );
167 echo wp_kses_post( pisol_dtt_time::formatTimeForDisplay($time) );
168 }
169
170 if ( 'pisol_method' === $column ) {
171 $delivery_method = $order->get_meta( 'pi_delivery_type', true );
172
173 if( $delivery_method =='pickup'){
174 $order_delivery_type = _x('Pickup','Order table','pisol-dtt');
175 $class= "processing";
176 }else{
177 $order_delivery_type = _x('Delivery','Order table','pisol-dtt');
178 $class= "completed";
179 }
180 $order_delivery_type = '<mark class="order-status status-'.$class.' "><span>'.$order_delivery_type.'</span></mark>';
181 $order_delivery_type = apply_filters('pisol_dtt_order_table_delivery_method', $order_delivery_type, $delivery_method);
182 echo wp_kses_post( $this->emptyValue($order_delivery_type) ) ;
183 }
184
185 if ( 'pisol_pickup_location' === $column ) {
186 $old_location = $order->get_meta( 'pickup_location', true );
187 $location_id = $order->get_meta( 'pickup_location_id', true );
188
189 if(empty($location_id)){
190 echo wp_kses_post( $old_location );
191 }elseif(!empty($location_id)){
192 $location_post = get_post($location_id);
193 $location_title = $location_post->post_title;
194 echo wp_kses_post( $location_title );
195 }
196 }
197 }
198
199 function emptyValue($value){
200 if($value != ""){
201 return $value;
202 }else{
203 return '-';
204 }
205 }
206 }
207
208 new pisol_dtt_order_table();
209 }