Version Description
Download this release
Release Info
Developer | digitalchild |
Plugin | WC Vendors |
Version | 2.4.1 |
Comparing to | |
See all releases |
Code changes from version 2.4.0 to 2.4.1
- changelog.txt +8 -0
- class-wc-vendors.php +5 -6
- classes/admin/class-admin-menus.php +1 -1
- classes/admin/class-wcv-commissions-csv-exporter.php +6 -2
- classes/admin/class-wcv-commissions-page.php +2 -1
- classes/admin/settings/class-wcv-settings-commission.php +7 -0
- classes/class-commission.php +3 -4
- classes/class-queries.php +34 -37
- classes/class-vendors.php +1 -0
- classes/front/dashboard/class-vendor-dashboard.php +4 -3
- classes/front/orders/class-orders.php +38 -17
- classes/includes/class-functions.php +15 -0
- readme.txt +11 -3
- templates/dashboard/orders.php +39 -15
- templates/orders/orders.php +3 -1
- templates/orders/table-body.php +6 -0
changelog.txt
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
Changelog for WC Vendors Marketplace
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Version 2.4.0 - 10th January 2022
|
4 |
|
5 |
* Added: Marketplace admin can mark orders shipped (#808)
|
1 |
Changelog for WC Vendors Marketplace
|
2 |
|
3 |
+
Version 2.4.1 - 3rd March 2022
|
4 |
+
|
5 |
+
* Updated: Sales report with refund details (#822)
|
6 |
+
* Updated: Menu page parameter type in WordPress 6.0 (#826)
|
7 |
+
* Reverted: "Added: Log marketplace commissions to commissions table (#806)" (#832)
|
8 |
+
* Fixed: Undefined variable ids (#816)
|
9 |
+
* Fixed: Order export fails if the order has been deleted #813 (#814)
|
10 |
+
|
11 |
Version 2.4.0 - 10th January 2022
|
12 |
|
13 |
* Added: Marketplace admin can mark orders shipped (#808)
|
class-wc-vendors.php
CHANGED
@@ -7,18 +7,17 @@
|
|
7 |
* Author URI: https://www.wcvendors.com
|
8 |
* GitHub Plugin URI: https://github.com/wcvendors/wcvendors
|
9 |
*
|
10 |
-
* Version: 2.4.
|
11 |
* Requires at least: 5.3.0
|
12 |
-
* Tested up to:
|
13 |
* WC requires at least: 5.0
|
14 |
-
* WC tested up to: 6.1
|
15 |
*
|
16 |
* Text Domain: wc-vendors
|
17 |
* Domain Path: /languages/
|
18 |
*
|
19 |
* @category Plugin
|
20 |
-
* @copyright Copyright © 2012 Matt Gates
|
21 |
-
* @copyright Copyright © 2021 WC Vendors
|
22 |
* @author Matt Gates, WC Vendors
|
23 |
* @package WCVendors
|
24 |
* @license GPL2
|
@@ -107,7 +106,7 @@ if ( wcv_is_woocommerce_activated() ) {
|
|
107 |
*/
|
108 |
class WC_Vendors {
|
109 |
|
110 |
-
public $version = '2.4.
|
111 |
|
112 |
/**
|
113 |
* @var
|
7 |
* Author URI: https://www.wcvendors.com
|
8 |
* GitHub Plugin URI: https://github.com/wcvendors/wcvendors
|
9 |
*
|
10 |
+
* Version: 2.4.1
|
11 |
* Requires at least: 5.3.0
|
12 |
+
* Tested up to: 6.0
|
13 |
* WC requires at least: 5.0
|
14 |
+
* WC tested up to: 6.2.1
|
15 |
*
|
16 |
* Text Domain: wc-vendors
|
17 |
* Domain Path: /languages/
|
18 |
*
|
19 |
* @category Plugin
|
20 |
+
* @copyright Copyright © 2012 Matt Gates, Copyright © 2021 WC Vendors
|
|
|
21 |
* @author Matt Gates, WC Vendors
|
22 |
* @package WCVendors
|
23 |
* @license GPL2
|
106 |
*/
|
107 |
class WC_Vendors {
|
108 |
|
109 |
+
public $version = '2.4.1';
|
110 |
|
111 |
/**
|
112 |
* @var
|
classes/admin/class-admin-menus.php
CHANGED
@@ -55,7 +55,7 @@ class WCVendors_Admin_Menus {
|
|
55 |
'wc-vendors',
|
56 |
array( $this, 'extensions_page' ),
|
57 |
'dashicons-cart',
|
58 |
-
|
59 |
);
|
60 |
}
|
61 |
|
55 |
'wc-vendors',
|
56 |
array( $this, 'extensions_page' ),
|
57 |
'dashicons-cart',
|
58 |
+
50
|
59 |
);
|
60 |
}
|
61 |
|
classes/admin/class-wcv-commissions-csv-exporter.php
CHANGED
@@ -183,8 +183,12 @@ class WCV_Commissions_CSV_Export extends WC_CSV_Exporter {
|
|
183 |
break;
|
184 |
case 'shipped':
|
185 |
$order = wc_get_order( $commission->order_id );
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
188 |
break;
|
189 |
default:
|
190 |
$value = $commission->$column_id;
|
183 |
break;
|
184 |
case 'shipped':
|
185 |
$order = wc_get_order( $commission->order_id );
|
186 |
+
if ( $order ){
|
187 |
+
$shipped = get_post_meta( $order->get_id(), 'wc_pv_shipped', true );
|
188 |
+
$value = ! empty( $shipped ) && in_array( $commission->vendor_id, $shipped ) ? __( 'Yes', 'wc-vendors' ) : __( 'No', 'wc-vendors');
|
189 |
+
} else{
|
190 |
+
$value = '-';
|
191 |
+
}
|
192 |
break;
|
193 |
default:
|
194 |
$value = $commission->$column_id;
|
classes/admin/class-wcv-commissions-page.php
CHANGED
@@ -86,11 +86,12 @@ class WCVendors_Commissions_Page extends WP_List_Table {
|
|
86 |
case 'product_id':
|
87 |
$parent = get_post_ancestors( $item->product_id );
|
88 |
$product_id = $parent ? $parent[0] : $item->product_id;
|
|
|
89 |
if ( ! get_post_status( $product_id ) ) {
|
90 |
$product_id = WCV_Vendors::find_parent_id_from_order( $item->order_id, $product_id );
|
91 |
}
|
92 |
if ( '' !== get_the_title( $product_id ) ) {
|
93 |
-
$product_url = '<a href="' . admin_url( 'post.php?post=' . $product_id . '&action=edit' ) . '">' . get_the_title( $product_id ) . '</a>';
|
94 |
} else {
|
95 |
$order = wc_get_order( $item->order_id );
|
96 |
if ( $order ) {
|
86 |
case 'product_id':
|
87 |
$parent = get_post_ancestors( $item->product_id );
|
88 |
$product_id = $parent ? $parent[0] : $item->product_id;
|
89 |
+
$wcv_total_sales = get_post_meta( $product_id, 'total_sales', true );
|
90 |
if ( ! get_post_status( $product_id ) ) {
|
91 |
$product_id = WCV_Vendors::find_parent_id_from_order( $item->order_id, $product_id );
|
92 |
}
|
93 |
if ( '' !== get_the_title( $product_id ) ) {
|
94 |
+
$product_url = '<a href="' . admin_url( 'post.php?post=' . $product_id . '&action=edit' ) . '">' . get_the_title( $product_id ) . '</a> (<span title="' . get_the_title( $product_id ) . ' has sold ' . $wcv_total_sales . ' times total.">' . $wcv_total_sales . '</span>)';
|
95 |
} else {
|
96 |
$order = wc_get_order( $item->order_id );
|
97 |
if ( $order ) {
|
classes/admin/settings/class-wcv-settings-commission.php
CHANGED
@@ -75,6 +75,13 @@ if ( ! class_exists( 'WCVendors_Settings_Commission', false ) ) :
|
|
75 |
'default' => '50',
|
76 |
'type' => 'number',
|
77 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
array(
|
79 |
'type' => 'sectionend',
|
80 |
'id' => 'commission_options',
|
75 |
'default' => '50',
|
76 |
'type' => 'number',
|
77 |
),
|
78 |
+
array(
|
79 |
+
'title' => __( 'Show reversed orders', 'wc-vendors' ),
|
80 |
+
'desc' => __( 'Show reversed / refunded orders on the order dashboard', 'wc-vendors' ),
|
81 |
+
'id' => 'wcvendors_dashboard_orders_show_reversed_orders',
|
82 |
+
'type' => 'checkbox',
|
83 |
+
'default' => 'no',
|
84 |
+
),
|
85 |
array(
|
86 |
'type' => 'sectionend',
|
87 |
'id' => 'commission_options',
|
classes/class-commission.php
CHANGED
@@ -145,10 +145,9 @@ class WCV_Commission {
|
|
145 |
foreach ( $dues as $vendor_id => $details ) {
|
146 |
|
147 |
// Only process vendor commission
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
// }
|
152 |
|
153 |
// See if they currently have an amount due
|
154 |
$due = WCV_Vendors::count_due_by_vendor( $vendor_id, $order_id );
|
145 |
foreach ( $dues as $vendor_id => $details ) {
|
146 |
|
147 |
// Only process vendor commission
|
148 |
+
if ( ! WCV_Vendors::is_vendor( $vendor_id ) ) {
|
149 |
+
continue;
|
150 |
+
}
|
|
|
151 |
|
152 |
// See if they currently have an amount due
|
153 |
$due = WCV_Vendors::count_due_by_vendor( $vendor_id, $order_id );
|
classes/class-queries.php
CHANGED
@@ -13,17 +13,20 @@ class WCV_Queries {
|
|
13 |
public static function get_commission_products( $user_id ) {
|
14 |
global $wpdb;
|
15 |
|
16 |
-
$dates
|
17 |
-
$vendor_products
|
18 |
-
$sql
|
19 |
-
|
20 |
-
$sql
|
21 |
|
22 |
if ( ! empty( $dates ) ) {
|
23 |
$sql .= "AND time >= '" . $dates['after'] . "' AND time <= '" . $dates['before'] . "'";
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
$results = $wpdb->get_results( $sql );
|
29 |
|
@@ -58,25 +61,28 @@ class WCV_Queries {
|
|
58 |
public static function get_products_for_order( $order_id ) {
|
59 |
global $wpdb;
|
60 |
|
61 |
-
$vendor_products
|
|
|
|
|
|
|
62 |
|
63 |
-
$
|
64 |
-
"
|
65 |
-
|
66 |
-
FROM {$wpdb->prefix}pv_commission
|
67 |
-
WHERE order_id = {$order_id}
|
68 |
-
AND status != 'reversed'
|
69 |
-
AND vendor_id = " . get_current_user_id() . '
|
70 |
-
GROUP BY product_id'
|
71 |
-
);
|
72 |
|
73 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
foreach ( $results as $value ) {
|
76 |
-
$
|
77 |
}
|
78 |
|
79 |
-
return $
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -93,8 +99,8 @@ class WCV_Queries {
|
|
93 |
if ( empty( $product_ids ) ) {
|
94 |
return false;
|
95 |
}
|
96 |
-
|
97 |
-
$dates
|
98 |
|
99 |
$defaults = array(
|
100 |
'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
|
@@ -105,27 +111,18 @@ class WCV_Queries {
|
|
105 |
);
|
106 |
|
107 |
$args = wp_parse_args( $args, $defaults );
|
|
|
|
|
108 |
|
109 |
-
$
|
110 |
-
|
111 |
-
|
112 |
-
WHERE product_id IN ('" . implode( "','", $product_ids ) . "')
|
113 |
-
AND time >= '" . $args['dates']['after'] . "'
|
114 |
-
AND time <= '" . $args['dates']['before'] . "'
|
115 |
-
AND status != 'reversed'
|
116 |
-
";
|
117 |
|
118 |
if ( ! empty( $args['vendor_id'] ) ) {
|
119 |
-
$sql .= "
|
120 |
-
AND vendor_id = {$args['vendor_id']}
|
121 |
-
";
|
122 |
}
|
123 |
|
124 |
-
$sql
|
125 |
-
GROUP BY order_id
|
126 |
-
ORDER BY time DESC
|
127 |
-
';
|
128 |
-
|
129 |
$orders = $wpdb->get_results( $sql );
|
130 |
|
131 |
return $orders;
|
13 |
public static function get_commission_products( $user_id ) {
|
14 |
global $wpdb;
|
15 |
|
16 |
+
$dates = self::orders_within_range();
|
17 |
+
$vendor_products = array();
|
18 |
+
$sql = '';
|
19 |
+
$show_reversed_orders = wcv_is_show_reversed_order();
|
20 |
+
$sql .= "SELECT product_id FROM {$wpdb->prefix}pv_commission WHERE vendor_id = {$user_id} ";
|
21 |
|
22 |
if ( ! empty( $dates ) ) {
|
23 |
$sql .= "AND time >= '" . $dates['after'] . "' AND time <= '" . $dates['before'] . "'";
|
24 |
}
|
25 |
|
26 |
+
if ( ! $show_reversed_orders ) {
|
27 |
+
$sql .= " AND status != 'reversed' ";
|
28 |
+
}
|
29 |
+
$sql .= ' GROUP BY product_id';
|
30 |
|
31 |
$results = $wpdb->get_results( $sql );
|
32 |
|
61 |
public static function get_products_for_order( $order_id ) {
|
62 |
global $wpdb;
|
63 |
|
64 |
+
$vendor_products = array();
|
65 |
+
$vendor_id = get_current_user_id();
|
66 |
+
$show_reversed_orders = wcv_is_show_reversed_order();
|
67 |
+
$sql = "SELECT product_id FROM {$wpdb->prefix}pv_commission WHERE order_id = {$order_id} ";
|
68 |
|
69 |
+
if ( ! $show_reversed_orders ) {
|
70 |
+
$sql .= " AND status != 'reversed'";
|
71 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
$sql .= " AND vendor_id = {$vendor_id} GROUP BY product_id ";
|
74 |
+
$result = $wpdb->get_results( $sql ); // WPCS: unprepared SQL ok.
|
75 |
+
$results = apply_filters( 'wcvendors_get_vendor_products', $result );
|
76 |
+
|
77 |
+
if ( empty( $results ) ) {
|
78 |
+
return array();
|
79 |
+
}
|
80 |
|
81 |
foreach ( $results as $value ) {
|
82 |
+
$vendor_products[] = $value->product_id;
|
83 |
}
|
84 |
|
85 |
+
return $vendor_products;
|
86 |
}
|
87 |
|
88 |
/**
|
99 |
if ( empty( $product_ids ) ) {
|
100 |
return false;
|
101 |
}
|
102 |
+
$show_reversed_orders = wcv_is_show_reversed_order();
|
103 |
+
$dates = self::orders_within_range();
|
104 |
|
105 |
$defaults = array(
|
106 |
'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
|
111 |
);
|
112 |
|
113 |
$args = wp_parse_args( $args, $defaults );
|
114 |
+
$sql = "SELECT order_id FROM {$wpdb->prefix}pv_commission as order_items WHERE product_id IN ('" . implode( "','", $product_ids ) . "')";
|
115 |
+
$sql .= "AND time >= '" . $args['dates']['after'] . "'AND time <= '" . $args['dates']['before'] . "'";
|
116 |
|
117 |
+
if ( ! $show_reversed_orders ) {
|
118 |
+
$sql .= " AND status != 'reversed'";
|
119 |
+
}
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
if ( ! empty( $args['vendor_id'] ) ) {
|
122 |
+
$sql .= " AND vendor_id = {$args['vendor_id']}";
|
|
|
|
|
123 |
}
|
124 |
|
125 |
+
$sql .= ' GROUP BY order_id ORDER BY time DESC';
|
|
|
|
|
|
|
|
|
126 |
$orders = $wpdb->get_results( $sql );
|
127 |
|
128 |
return $orders;
|
classes/class-vendors.php
CHANGED
@@ -439,6 +439,7 @@ class WCV_Vendors {
|
|
439 |
*/
|
440 |
public static function get_vendor_shop_name( $vendor_id ) {
|
441 |
|
|
|
442 |
$name = $vendor_id ? get_user_meta( $vendor_id, 'pv_shop_name', true ) : false;
|
443 |
$shop_name = ( ! $name && $vendor = get_userdata( $vendor_id ) ) ? $vendor->user_login : $name;
|
444 |
|
439 |
*/
|
440 |
public static function get_vendor_shop_name( $vendor_id ) {
|
441 |
|
442 |
+
$vendor_id = self::get_vendor_id( $vendor_id );
|
443 |
$name = $vendor_id ? get_user_meta( $vendor_id, 'pv_shop_name', true ) : false;
|
444 |
$shop_name = ( ! $name && $vendor = get_userdata( $vendor_id ) ) ? $vendor->user_login : $name;
|
445 |
|
classes/front/dashboard/class-vendor-dashboard.php
CHANGED
@@ -278,7 +278,7 @@ class WCV_Vendor_Dashboard {
|
|
278 |
}
|
279 |
|
280 |
$vendor_summary = $this->format_product_details( $vendor_products );
|
281 |
-
$order_summary = WCV_Queries::get_orders_for_products( $products );
|
282 |
|
283 |
$providers = array();
|
284 |
$provider_array = array();
|
@@ -312,8 +312,8 @@ class WCV_Vendor_Dashboard {
|
|
312 |
|
313 |
if ( wc_string_to_bool( get_option( 'wcvendors_capability_frontend_reports', 'yes' ) ) ) {
|
314 |
|
315 |
-
$can_view_address
|
316 |
-
|
317 |
wc_get_template(
|
318 |
'reports.php',
|
319 |
array(
|
@@ -341,6 +341,7 @@ class WCV_Vendor_Dashboard {
|
|
341 |
'provider_array' => $provider_array,
|
342 |
'can_view_orders' => $can_view_orders,
|
343 |
'can_view_address' => $can_view_address,
|
|
|
344 |
),
|
345 |
'wc-vendors/dashboard/',
|
346 |
wcv_plugin_dir . 'templates/dashboard/'
|
278 |
}
|
279 |
|
280 |
$vendor_summary = $this->format_product_details( $vendor_products );
|
281 |
+
$order_summary = WCV_Queries::get_orders_for_products( $products, array( 'vendor_id' => $user_id ) );
|
282 |
|
283 |
$providers = array();
|
284 |
$provider_array = array();
|
312 |
|
313 |
if ( wc_string_to_bool( get_option( 'wcvendors_capability_frontend_reports', 'yes' ) ) ) {
|
314 |
|
315 |
+
$can_view_address = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_shipping', 'yes' ) );
|
316 |
+
$show_reversed_orders = wcv_is_show_reversed_order();
|
317 |
wc_get_template(
|
318 |
'reports.php',
|
319 |
array(
|
341 |
'provider_array' => $provider_array,
|
342 |
'can_view_orders' => $can_view_orders,
|
343 |
'can_view_address' => $can_view_address,
|
344 |
+
'show_reversed' => $show_reversed_orders,
|
345 |
),
|
346 |
'wc-vendors/dashboard/',
|
347 |
wcv_plugin_dir . 'templates/dashboard/'
|
classes/front/orders/class-orders.php
CHANGED
@@ -14,12 +14,12 @@ class WCV_Orders {
|
|
14 |
/**
|
15 |
* __construct()
|
16 |
*/
|
17 |
-
function __construct() {
|
18 |
|
19 |
$this->can_view_orders = wc_string_to_bool( get_option( 'wcvendors_capability_orders_enabled', 'no' ) );
|
20 |
$this->can_export_csv = wc_string_to_bool( get_option( 'wcvendors_capability_orders_export', 'no' ) );
|
21 |
$this->can_view_emails = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_email', 'no' ) );
|
22 |
-
$this->can_view_name
|
23 |
$this->can_view_shipping_name = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_shipping_name', 'no' ) );
|
24 |
$this->can_view_address = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_shipping' ) );
|
25 |
|
@@ -99,8 +99,8 @@ class WCV_Orders {
|
|
99 |
return false;
|
100 |
}
|
101 |
|
102 |
-
extract(
|
103 |
-
$headers =
|
104 |
|
105 |
// Export the CSV
|
106 |
require_once wcv_plugin_dir . 'classes/front/orders/class-export-csv.php';
|
@@ -161,8 +161,8 @@ class WCV_Orders {
|
|
161 |
exit;
|
162 |
}
|
163 |
|
164 |
-
$headers =
|
165 |
-
$all =
|
166 |
|
167 |
wp_enqueue_script( 'pv_frontend_script', wcv_assets_url . 'js/front-orders.js' );
|
168 |
|
@@ -187,14 +187,17 @@ class WCV_Orders {
|
|
187 |
}
|
188 |
|
189 |
wc_get_template(
|
190 |
-
'orders.php',
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
198 |
);
|
199 |
|
200 |
} // display_product_orders()
|
@@ -252,8 +255,13 @@ class WCV_Orders {
|
|
252 |
$product = wc_get_product( $product_id )->get_title();
|
253 |
|
254 |
foreach ( $orders as $i => $order ) {
|
255 |
-
$i
|
256 |
-
$order
|
|
|
|
|
|
|
|
|
|
|
257 |
$order_date = $order->get_date_created();
|
258 |
|
259 |
$shipping_first_name = $order->get_shipping_first_name();
|
@@ -295,13 +303,26 @@ class WCV_Orders {
|
|
295 |
}
|
296 |
|
297 |
$items[ $i ]['total_qty'] = 0;
|
|
|
298 |
foreach ( $order->get_items() as $line_id => $item ) {
|
299 |
|
300 |
if ( $item['product_id'] != $product_id && $item['variation_id'] != $product_id ) {
|
301 |
continue;
|
302 |
}
|
303 |
|
304 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
$items[ $i ]['total_qty'] += $item['qty'];
|
306 |
}
|
307 |
}
|
14 |
/**
|
15 |
* __construct()
|
16 |
*/
|
17 |
+
public function __construct() {
|
18 |
|
19 |
$this->can_view_orders = wc_string_to_bool( get_option( 'wcvendors_capability_orders_enabled', 'no' ) );
|
20 |
$this->can_export_csv = wc_string_to_bool( get_option( 'wcvendors_capability_orders_export', 'no' ) );
|
21 |
$this->can_view_emails = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_email', 'no' ) );
|
22 |
+
$this->can_view_name = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_name', 'no' ) );
|
23 |
$this->can_view_shipping_name = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_shipping_name', 'no' ) );
|
24 |
$this->can_view_address = wc_string_to_bool( get_option( 'wcvendors_capability_order_customer_shipping' ) );
|
25 |
|
99 |
return false;
|
100 |
}
|
101 |
|
102 |
+
extract( self::format_order_details( $this->orders, $this->product_id ) );
|
103 |
+
$headers = self::get_headers();
|
104 |
|
105 |
// Export the CSV
|
106 |
require_once wcv_plugin_dir . 'classes/front/orders/class-export-csv.php';
|
161 |
exit;
|
162 |
}
|
163 |
|
164 |
+
$headers = self::get_headers();
|
165 |
+
$all = self::format_order_details( $this->orders, $this->product_id );
|
166 |
|
167 |
wp_enqueue_script( 'pv_frontend_script', wcv_assets_url . 'js/front-orders.js' );
|
168 |
|
187 |
}
|
188 |
|
189 |
wc_get_template(
|
190 |
+
'orders.php',
|
191 |
+
array(
|
192 |
+
'headers' => $headers,
|
193 |
+
'body' => $all['body'],
|
194 |
+
'items' => $all['items'],
|
195 |
+
'product_id' => $all['product_id'],
|
196 |
+
'providers' => $providers,
|
197 |
+
'provider_array' => $provider_array,
|
198 |
+
),
|
199 |
+
'wc-vendors/orders/',
|
200 |
+
wcv_plugin_dir . 'templates/orders/'
|
201 |
);
|
202 |
|
203 |
} // display_product_orders()
|
255 |
$product = wc_get_product( $product_id )->get_title();
|
256 |
|
257 |
foreach ( $orders as $i => $order ) {
|
258 |
+
$i = $order->order_id;
|
259 |
+
$order = wc_get_order( $i );
|
260 |
+
|
261 |
+
if ( is_bool( $order ) ) {
|
262 |
+
continue;
|
263 |
+
}
|
264 |
+
|
265 |
$order_date = $order->get_date_created();
|
266 |
|
267 |
$shipping_first_name = $order->get_shipping_first_name();
|
303 |
}
|
304 |
|
305 |
$items[ $i ]['total_qty'] = 0;
|
306 |
+
$is_full_refunded = $order->get_total_refunded() == $order->get_total();
|
307 |
foreach ( $order->get_items() as $line_id => $item ) {
|
308 |
|
309 |
if ( $item['product_id'] != $product_id && $item['variation_id'] != $product_id ) {
|
310 |
continue;
|
311 |
}
|
312 |
|
313 |
+
$refund_total = $order->get_total_refunded_for_item( $item->get_id() );
|
314 |
+
|
315 |
+
if ( $is_full_refunded ) {
|
316 |
+
$refund_total = $item['line_total'];
|
317 |
+
}
|
318 |
+
if ( ( $refund_total > 0 ) && $item->get_product_id() == $product_id || $item->get_variation_id() == $product_id ) {
|
319 |
+
$items[ $i ]['refund'] = array(
|
320 |
+
'total' => $refund_total,
|
321 |
+
);
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
+
$items[ $i ]['items'][] = $item;
|
326 |
$items[ $i ]['total_qty'] += $item['qty'];
|
327 |
}
|
328 |
}
|
classes/includes/class-functions.php
CHANGED
@@ -140,3 +140,18 @@ if ( ! function_exists( 'wcv_set_primary_vendor_role' ) ){
|
|
140 |
}
|
141 |
}
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
}
|
142 |
}
|
143 |
+
|
144 |
+
if ( ! function_exists( 'wcv_is_show_reversed_order' ) ) {
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Check show reversed order
|
148 |
+
*
|
149 |
+
* @since 2.4.0
|
150 |
+
* @return bool
|
151 |
+
*/
|
152 |
+
function wcv_is_show_reversed_order() {
|
153 |
+
|
154 |
+
return wc_string_to_bool( get_option( 'wcvendors_dashboard_orders_show_reversed_orders', 'no' ) );
|
155 |
+
|
156 |
+
}
|
157 |
+
}
|
readme.txt
CHANGED
@@ -6,10 +6,10 @@ Author URI: https://www.wcvendors.com/
|
|
6 |
Plugin URI: https://www.wcvendors.com/
|
7 |
Requires at least: 5.3.0
|
8 |
Requires PHP: 7.4
|
9 |
-
Tested up to:
|
10 |
WC requires at least: 5.0.0
|
11 |
-
WC tested up to: 6.1
|
12 |
-
Stable tag: 2.4.
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
The original multi-vendor marketplace plugin for WordPress and WooCommerce. Best support available.
|
@@ -264,6 +264,14 @@ WC Vendors Marketplace does not work with multisite WordPress. There are no plan
|
|
264 |
|
265 |
== Changelog ==
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
= Version 2.4.0 - 10th January 2022 =
|
268 |
|
269 |
* Added: Marketplace admin can mark orders shipped (#808)
|
6 |
Plugin URI: https://www.wcvendors.com/
|
7 |
Requires at least: 5.3.0
|
8 |
Requires PHP: 7.4
|
9 |
+
Tested up to: 6.0
|
10 |
WC requires at least: 5.0.0
|
11 |
+
WC tested up to: 6.2.1
|
12 |
+
Stable tag: 2.4.1
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
The original multi-vendor marketplace plugin for WordPress and WooCommerce. Best support available.
|
264 |
|
265 |
== Changelog ==
|
266 |
|
267 |
+
= Version 2.4.1 - 3rd March 2022 =
|
268 |
+
|
269 |
+
* Updated: Sales report with refund details (#822)
|
270 |
+
* Updated: Menu page parameter type in WordPress 6.0 (#826)
|
271 |
+
* Reverted: "Added: Log marketplace commissions to commissions table (#806)" (#832)
|
272 |
+
* Fixed: Undefined variable ids (#816)
|
273 |
+
* Fixed: Order export fails if the order has been deleted #813 (#814)
|
274 |
+
|
275 |
= Version 2.4.0 - 10th January 2022 =
|
276 |
|
277 |
* Added: Marketplace admin can mark orders shipped (#808)
|
templates/dashboard/orders.php
CHANGED
@@ -61,7 +61,7 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
61 |
|
62 |
<?php
|
63 |
if ( ! empty( $order_summary ) ) :
|
64 |
-
$totals
|
65 |
$user_id = get_current_user_id();
|
66 |
?>
|
67 |
|
@@ -69,9 +69,14 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
69 |
foreach ( $order_summary as $order ) :
|
70 |
|
71 |
$order = wc_get_order( $order->order_id );
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
$needs_shipping = false;
|
76 |
|
77 |
$items = $order->get_items();
|
@@ -99,10 +104,10 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
99 |
<?php endif; ?>
|
100 |
<td>
|
101 |
<?php
|
102 |
-
$sum
|
103 |
$total = 0;
|
104 |
if ( 0 < count( $sum ) ) {
|
105 |
-
$total
|
106 |
$totals += $total;
|
107 |
}
|
108 |
echo wc_price( $total );
|
@@ -161,11 +166,20 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
161 |
<tr id="view-items-<?php echo $order_id; ?>" style="display:none;">
|
162 |
<td colspan="5">
|
163 |
<?php
|
164 |
-
$product_id
|
|
|
|
|
|
|
|
|
165 |
foreach ( $valid as $key => $item ) :
|
166 |
|
167 |
// Get variation data if there is any.
|
168 |
$variation_detail = ! empty( $item['variation_id'] ) ? WCV_Orders::get_variation_data( $item['variation_id'] ) : '';
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
?>
|
171 |
<?php echo $item['qty'] . 'x ' . $item['name']; ?>
|
@@ -173,27 +187,37 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
173 |
if ( ! empty( $variation_detail ) ) {
|
174 |
echo '<br />' . $variation_detail;
|
175 |
}
|
176 |
-
?>
|
177 |
|
|
|
|
|
|
|
|
|
178 |
|
179 |
<?php endforeach; ?>
|
|
|
|
|
|
|
|
|
180 |
|
181 |
</td>
|
182 |
</tr>
|
183 |
|
184 |
<?php if ( class_exists( 'WC_Shipment_Tracking' ) ) : ?>
|
185 |
|
186 |
-
|
187 |
<tr id="view-tracking-<?php echo $order_id; ?>" style="display:none;">
|
188 |
<td colspan="5">
|
189 |
<div class="order-tracking">
|
190 |
<?php
|
191 |
wc_get_template(
|
192 |
-
'shipping-form.php',
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
197 |
);
|
198 |
?>
|
199 |
</div>
|
@@ -215,7 +239,7 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
215 |
|
216 |
<tr>
|
217 |
<td colspan="4"
|
218 |
-
|
219 |
</tr>
|
220 |
|
221 |
<?php endif; ?>
|
61 |
|
62 |
<?php
|
63 |
if ( ! empty( $order_summary ) ) :
|
64 |
+
$totals = 0;
|
65 |
$user_id = get_current_user_id();
|
66 |
?>
|
67 |
|
69 |
foreach ( $order_summary as $order ) :
|
70 |
|
71 |
$order = wc_get_order( $order->order_id );
|
72 |
+
|
73 |
+
if ( is_bool( $order ) ) {
|
74 |
+
continue;
|
75 |
+
}
|
76 |
+
|
77 |
+
$order_id = $order->get_id();
|
78 |
+
$valid_items = WCV_Queries::get_products_for_order( $order_id );
|
79 |
+
$valid = array();
|
80 |
$needs_shipping = false;
|
81 |
|
82 |
$items = $order->get_items();
|
104 |
<?php endif; ?>
|
105 |
<td>
|
106 |
<?php
|
107 |
+
$sum = WCV_Queries::sum_for_orders( array( $order_id ), array( 'vendor_id' => get_current_user_id() ) );
|
108 |
$total = 0;
|
109 |
if ( 0 < count( $sum ) ) {
|
110 |
+
$total = $sum[0]->line_total;
|
111 |
$totals += $total;
|
112 |
}
|
113 |
echo wc_price( $total );
|
166 |
<tr id="view-items-<?php echo $order_id; ?>" style="display:none;">
|
167 |
<td colspan="5">
|
168 |
<?php
|
169 |
+
$product_id = '';
|
170 |
+
$refunded = array();
|
171 |
+
$order_refunded = $order->get_total_refunded();
|
172 |
+
$is_full_refunded = $order_refunded == $order->get_total();
|
173 |
+
|
174 |
foreach ( $valid as $key => $item ) :
|
175 |
|
176 |
// Get variation data if there is any.
|
177 |
$variation_detail = ! empty( $item['variation_id'] ) ? WCV_Orders::get_variation_data( $item['variation_id'] ) : '';
|
178 |
+
$refunded_total = $order->get_total_refunded_for_item( $item->get_id() );
|
179 |
+
|
180 |
+
if ( $is_full_refunded ) {
|
181 |
+
$refunded_total = $item['line_total'];
|
182 |
+
}
|
183 |
|
184 |
?>
|
185 |
<?php echo $item['qty'] . 'x ' . $item['name']; ?>
|
187 |
if ( ! empty( $variation_detail ) ) {
|
188 |
echo '<br />' . $variation_detail;
|
189 |
}
|
|
|
190 |
|
191 |
+
if ( $refunded_total > 0 ) {
|
192 |
+
$refunded[] = wc_price( $refunded_total ) . ' - ' . $item['name'];
|
193 |
+
}
|
194 |
+
?>
|
195 |
|
196 |
<?php endforeach; ?>
|
197 |
+
<?php if ( ! empty( $refunded ) && $show_reversed ) : ?>
|
198 |
+
<br/><strong><?php echo esc_html__( 'Refunded:', 'wc-vendors' ); ?></strong>
|
199 |
+
<?php echo implode( ', ', $refunded ); ?>
|
200 |
+
<?php endif; ?>
|
201 |
|
202 |
</td>
|
203 |
</tr>
|
204 |
|
205 |
<?php if ( class_exists( 'WC_Shipment_Tracking' ) ) : ?>
|
206 |
|
207 |
+
<?php if ( is_array( $providers ) ) : ?>
|
208 |
<tr id="view-tracking-<?php echo $order_id; ?>" style="display:none;">
|
209 |
<td colspan="5">
|
210 |
<div class="order-tracking">
|
211 |
<?php
|
212 |
wc_get_template(
|
213 |
+
'shipping-form.php',
|
214 |
+
array(
|
215 |
+
'order_id' => $order_id,
|
216 |
+
'product_id' => $product_id,
|
217 |
+
'providers' => $providers,
|
218 |
+
),
|
219 |
+
'wc-vendors/orders/shipping/',
|
220 |
+
wcv_plugin_dir . 'templates/orders/shipping/'
|
221 |
);
|
222 |
?>
|
223 |
</div>
|
239 |
|
240 |
<tr>
|
241 |
<td colspan="4"
|
242 |
+
style="text-align:center;"><?php _e( 'You have no orders during this period.', 'wc-vendors' ); ?></td>
|
243 |
</tr>
|
244 |
|
245 |
<?php endif; ?>
|
templates/orders/orders.php
CHANGED
@@ -38,7 +38,8 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
38 |
foreach ( $body as $order_id => $order ) :
|
39 |
|
40 |
$order_items = ! empty( $items[ $order_id ]['items'] ) ? $items[ $order_id ]['items'] : array();
|
41 |
-
$count
|
|
|
42 |
?>
|
43 |
|
44 |
<tr>
|
@@ -76,6 +77,7 @@ if ( function_exists( 'wc_print_notices' ) ) {
|
|
76 |
'item' => $item,
|
77 |
'count' => $count,
|
78 |
'order_id' => $order_id,
|
|
|
79 |
), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/'
|
80 |
);
|
81 |
|
38 |
foreach ( $body as $order_id => $order ) :
|
39 |
|
40 |
$order_items = ! empty( $items[ $order_id ]['items'] ) ? $items[ $order_id ]['items'] : array();
|
41 |
+
$count = count( $order_items );
|
42 |
+
$refund = isset( $items[ $order_id ]['refund'] ) ? $items[ $order_id ]['refund'] : array();
|
43 |
?>
|
44 |
|
45 |
<tr>
|
77 |
'item' => $item,
|
78 |
'count' => $count,
|
79 |
'order_id' => $order_id,
|
80 |
+
'refund' => $refund,
|
81 |
), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/'
|
82 |
);
|
83 |
|
templates/orders/table-body.php
CHANGED
@@ -34,6 +34,12 @@ if ( $count > 1 ) : ?>
|
|
34 |
<?php endif; ?>
|
35 |
|
36 |
<?php printf( __( 'Quantity: %d', 'wc-vendors' ), $item['qty'] ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
</td>
|
38 |
|
39 |
<?php if ( $count > 1 ) : ?>
|
34 |
<?php endif; ?>
|
35 |
|
36 |
<?php printf( __( 'Quantity: %d', 'wc-vendors' ), $item['qty'] ); ?>
|
37 |
+
|
38 |
+
<?php if ( $refund && !empty( $refund ) ) : ?>
|
39 |
+
<br />
|
40 |
+
<?php printf( __( 'Refunded total: %s', 'wc-vendors' ), wc_price( $refund['total'] ) ); ?>
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
</td>
|
44 |
|
45 |
<?php if ( $count > 1 ) : ?>
|