WCMp Core
-
AuthorPosts
-
-
November 27, 2021 at 3:12 AM #131116MaxenceTPParticipant
Hello,
I have an issue with the “Product Sales Report” on the main page of the vendor dashboard.
I use this plugin : https://woocommerce.com/products/product-bundles/The bundle product is displayed, that’s not a problem. But the products within this bundle are also displayed in the list.
Where I can add a condition to display the unique sales ? Even for products within bundlesThank you
-
November 27, 2021 at 12:33 PM #131126MVX Support NinjaKeymaster
Hi,
The display option comes from the plugin itself.
.
It seems to be a theme issue, kindly switch to a default theme and check again.If the issue still persists, then share a video and explain in details so that we can help you out.
-
November 27, 2021 at 9:01 PM #131161MaxenceTPParticipantThis reply has been marked as private.
-
November 27, 2021 at 9:01 PM #131162MaxenceTPParticipant
The “Revenue” is correct, but the quantity sold is not
-
November 29, 2021 at 7:32 PM #131241MVX Support NinjaKeymaster
Hi,
We couldn’t recreate this on our end.
Kindly create a staging site and share admin,ftp access.
Also do not forget to mark the response as private while sharing the access. -
November 30, 2021 at 10:55 AM #131309NerdySupportExpert MoumitaKeymaster
Also, as you can see even for bundle products WooCommerce handles each bundle product as an individual product and displays the same in the report : https://loom.com/share/8e874d7608884bd7a6e7c5a0a68f00da
-
November 30, 2021 at 3:15 PM #131332MaxenceTPParticipantThis reply has been marked as private.
-
November 30, 2021 at 7:38 PM #131370NerdySupportExpert MoumitaKeymasterThis reply has been marked as private.
-
November 30, 2021 at 10:03 PM #131377MaxenceTPParticipant
I don’t look at Woocommerce data so it doesn’t matter to me, but the problem is that sellers think they have made more sales than reality according to the data displayed in their dashboard.
Isn’t there a way to verify that the product’s commission is >0 before counting it in “Unique purshaces”?Since in the commissions, the products in the bundle are indeed 0€
-
December 1, 2021 at 6:42 PM #131418MVX Support NinjaKeymaster
HI,
As per your requirement you can change the table data using the below filter. It’s need good amount of custom code.apply_filters( ‘wcmp_widget_vendor_product_sales_report_row_data’, $row, $product_id, $sold_item_data );
Regards,
-
December 14, 2021 at 11:11 PM #132015MaxenceTPParticipant
The filters don’t allow me to make the change I want, I would just have to add 2 lines of code like this: https://prnt.sc/22zk1q4
With the filter wcmp_widget_vendor_product_sales_report_row_data I can’t know if it is a bundle product if the quantity is >= 2.How to make this modification without touching directly the plugin code?
-
December 14, 2021 at 11:12 PM #132016MaxenceTPParticipant
Can you add a filter here in an update ?
That I can use it to do that -
December 15, 2021 at 6:49 PM #132040MVX Support NinjaKeymaster
HI,
AS per your requirement, We can’t add filter there.
Kindly add filter in the selected line and try to add custom code to delete products.
Check out the image – https://prnt.sc/2343l6zOtherwise
add below code to your function.php of your active theme and make change here –function wcmp_custom_changes(){ global $WCMp; remove_action('wp_ajax_wcmp_widget_vendor_product_sales_report', array($WCMp->ajax, 'wcmp_widget_vendor_product_sales_report')); add_action('wp_ajax_wcmp_widget_vendor_product_sales_report', 'wcmp_widget_vendor_product_sales_report'); } function wcmp_widget_vendor_product_sales_report(){ global $wpdb; if (is_user_logged_in() && is_user_wcmp_vendor(get_current_vendor_id())) { $vendor = get_wcmp_vendor(get_current_vendor_id()); $requestData = ( $_REQUEST ) ? wc_clean( $_REQUEST ) : array(); $today = @date('Y-m-d 00:00:00', strtotime("+1 days")); $days_range = apply_filters('wcmp_widget_vendor_product_sales_report_days_range', 7, $requestData, $vendor); $last_seven_day_date = date('Y-m-d H:i:s', strtotime("-$days_range days")); $query = array( 'author' => $vendor->id, 'date_query' => array( array( 'after' => $last_seven_day_date, 'before' => $today, 'inclusive' => true, ), ), 'meta_query' => array( 'relation' => 'AND', array( 'key' => '_commission_id', 'value' => 0, 'compare' => '!=', ) ) ); $vendor_orders = apply_filters('wcmp_widget_vendor_product_sales_report_orders', wcmp_get_orders( $query, 'object' ), $query); $sold_product_list = array(); if ( $vendor_orders ) : foreach ( $vendor_orders as $order ) { $line_items = $order->get_items('line_item'); foreach ( $line_items as $item_id => $item ) { if (array_key_exists($item->get_product_id(), $sold_product_list)) { $sold_product_list[$item->get_product_id()]['qty'] += $item->get_quantity(); $sold_product_list[$item->get_product_id()]['item_total'] += $item->get_total(); } else { $sold_product_list[$item->get_product_id()]['qty'] = $item->get_quantity(); $sold_product_list[$item->get_product_id()]['item'] = $item; $sold_product_list[$item->get_product_id()]['item_total'] = $item->get_total(); $sold_product_list[$item->get_product_id()]['order_id'] = $order->get_id(); } } } endif; arsort($sold_product_list); $data = array(); foreach ($sold_product_list as $product_id => $sold_item_data) { $item = $sold_item_data['item']; $product = $item->get_product(); $row = array(); if ($product) { $row ['product'] = '<a href="' . wcmp_get_product_link( $product_id ) . '">' . $product->get_image(array(40, 40)) . ' ' . wp_trim_words($item->get_name(), 60, '...') . '</a>'; $row ['revenue'] = wc_price( $sold_item_data['item_total'] ); $row ['unique_purchase'] = $sold_item_data['qty']; } else { $row ['product'] = __('This product does not exists', 'dc-woocommerce-multi-vendor'); $row ['revenue'] = '-'; $row ['unique_purchase'] = $sold_item_data['qty']; } $data[] = apply_filters( 'wcmp_widget_vendor_product_sales_report_row_data', $row, $product_id, $sold_item_data ); } $json_data = array( "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. "recordsTotal" => intval(count($sold_product_list)), // total number of records "recordsFiltered" => intval(count($sold_product_list)), // total number of records after searching, if there is no searching then totalFiltered = totalData "data" => $data // total data array ); wp_send_json($json_data); die; } }
CopyRegards,
-
December 20, 2021 at 8:39 PM #132215MaxenceTPParticipant
It’s a shame to have to overwrite the whole function just for an if but if there’s no other solution I’d do it that way.
The changes I make in my theme are not taken into account, it is always the original function that is executed. Even with this code :
Copy`function wcmp_custom_changes(){
global $WCMp;
remove_action(‘wp_ajax_wcmp_widget_vendor_product_sales_report’, array($WCMp->ajax, ‘wcmp_widget_vendor_product_sales_report’));Copy`
The widget is still displayed, which means it doesn’t remove wcmp_widget_vendor_product_sales_report -
December 21, 2021 at 6:46 PM #132262MVX Support NinjaKeymaster
Hi,
The full code modification is a alternative suggestion. We can’t add filter there to check the data but also we will add filter here ( https://prnt.sc/2343l6z ). So we asked you to check if you compatible to add custom code if we add filer there.
If you are compatible then we surely add a filter here ( https://prnt.sc/2343l6z ) in our next update.Otherwise you have to add custom code to modify this.
Use below code to remove ajax request
add_action('init', 'wcmp_custom_changes'); function wcmp_custom_changes(){ global $WCMp; remove_action('wp_ajax_wcmp_widget_vendor_product_sales_report', array($WCMp->ajax, 'wcmp_widget_vendor_product_sales_report')); }
CopyRegards,
-
December 22, 2021 at 2:03 AM #132282MaxenceTPParticipant
No the filter on this line doesn’t help. Or is it possible to add a filter on this line ?
$line_items = $order->get_items('line_item');
Copy -
December 22, 2021 at 6:16 PM #132315MVX Support NinjaKeymaster
Hi,
Yes, it is possible to add filter in this line.
Kindly checkout the below plugin and confirm so we will add same filter in our next update.https://drive.google.com/file/d/17-TZzyp2EM2MG3nEH4yEjmTNQN4T-Z3z/view?usp=sharing
Use this filter – wcmp_widget_vendor_product_sales_report_line_items
Regards,
-
December 22, 2021 at 11:34 PM #132351MaxenceTPParticipant
Are you sure you sent me the right files?
I don’t see this filter in the code -
December 23, 2021 at 5:05 PM #132379MVX Support NinjaKeymaster
Hi,
Sorry for that.
Kindly check this – https://drive.google.com/file/d/11r5R2J1w-gxmQHksKIsNBdp0buWsZpV8/view?usp=sharingRegards,
-
December 28, 2021 at 7:36 PM #132515MaxenceTPParticipant
Hello,
Yes you can add it in your next update 😉 -
December 29, 2021 at 6:17 PM #132554MVX Support NinjaKeymaster
Hi,
Kindly follow this link to checkout the progress – https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/1002
Regards,
-
December 30, 2021 at 3:52 AM #132575MaxenceTPParticipant
Ok, thank you
-
December 30, 2021 at 1:00 PM #132579MVX Support NinjaKeymaster
🙂
-
January 8, 2022 at 8:43 PM #132885MaxenceTPParticipant
Thank you for the update, this thread can be closed
-
-
AuthorPosts
The topic ‘Dashboard issue with Woocommerce Bundle’ is closed to new replies.